@@ -52,6 +52,7 @@ class ProductionInfo:
5252 name : str = "prod"
5353 app_name : str = "Packit-as-a-Service"
5454 pr_comment : str = "/packit build"
55+ pr_comment_vm_image_build : str = "/packit vm-image-build"
5556 opened_pr_trigger__packit_yaml_fix : YamlFix = None
5657 copr_user = "packit"
5758 push_trigger_tests_prefix = "Basic test case - push trigger"
@@ -64,6 +65,7 @@ class StagingInfo:
6465 name : str = "stg"
6566 app_name = "Packit-as-a-Service-stg"
6667 pr_comment = "/packit-stg build"
68+ pr_comment_vm_image_build : str = "/packit-stg vm-image-build"
6769 opened_pr_trigger__packit_yaml_fix = YamlFix (
6870 "---" , '---\n packit_instances: ["stg"]' , "Build using Packit-stg"
6971 )
@@ -89,6 +91,7 @@ def __init__(
8991 pr : PullRequest = None ,
9092 trigger : Trigger = Trigger .pr_opened ,
9193 deployment : DeploymentInfo = None ,
94+ comment : str = None ,
9295 ):
9396 self .project = project
9497 self .pr = pr
@@ -98,6 +101,7 @@ def __init__(
98101 self .head_commit = pr .head_commit if pr else None
99102 self ._copr_project_name = None
100103 self .deployment = deployment or ProductionInfo ()
104+ self .comment = comment
101105
102106 @property
103107 def copr_project_name (self ):
@@ -133,7 +137,8 @@ def trigger_build(self):
133137 """
134138 logging .info (f"Triggering a build for { self .pr if self .pr else 'new PR' } " )
135139 if self .trigger == Trigger .comment :
136- self .pr .comment (self .deployment .pr_comment )
140+ comment = self .deployment .pr_comment if not self .comment else self .comment
141+ self .pr .comment (comment )
137142 elif self .trigger == Trigger .push :
138143 self .push_to_pr ()
139144 else :
@@ -624,6 +629,23 @@ class Tests:
624629 test_case_kls : Type
625630
626631 def run (self ):
632+ logging .info (
633+ "Run testcases where the build is triggered by a '/packit vm-image-build' comment"
634+ )
635+ prs_for_comment = [
636+ pr
637+ for pr in self .project .get_pr_list ()
638+ if pr .title .startswith ("Test VM Image builds" )
639+ ]
640+ for pr in prs_for_comment :
641+ self .test_case_kls (
642+ project = self .project ,
643+ pr = pr ,
644+ trigger = Trigger .comment ,
645+ deployment = deployment ,
646+ comment = deployment .pr_comment_vm_image_build ,
647+ ).run_test ()
648+
627649 logging .info (
628650 "Run testcases where the build is triggered by a '/packit build' comment"
629651 )
0 commit comments