@@ -52,6 +52,7 @@ class ProductionInfo:
52
52
name : str = "prod"
53
53
app_name : str = "Packit-as-a-Service"
54
54
pr_comment : str = "/packit build"
55
+ pr_comment_vm_image_build : str = "/packit vm-image-build"
55
56
opened_pr_trigger__packit_yaml_fix : YamlFix = None
56
57
copr_user = "packit"
57
58
push_trigger_tests_prefix = "Basic test case - push trigger"
@@ -64,6 +65,7 @@ class StagingInfo:
64
65
name : str = "stg"
65
66
app_name = "Packit-as-a-Service-stg"
66
67
pr_comment = "/packit-stg build"
68
+ pr_comment_vm_image_build : str = "/packit-stg vm-image-build"
67
69
opened_pr_trigger__packit_yaml_fix = YamlFix (
68
70
"---" , '---\n packit_instances: ["stg"]' , "Build using Packit-stg"
69
71
)
@@ -89,6 +91,7 @@ def __init__(
89
91
pr : PullRequest = None ,
90
92
trigger : Trigger = Trigger .pr_opened ,
91
93
deployment : DeploymentInfo = None ,
94
+ comment : str = None ,
92
95
):
93
96
self .project = project
94
97
self .pr = pr
@@ -98,6 +101,7 @@ def __init__(
98
101
self .head_commit = pr .head_commit if pr else None
99
102
self ._copr_project_name = None
100
103
self .deployment = deployment or ProductionInfo ()
104
+ self .comment = comment
101
105
102
106
@property
103
107
def copr_project_name (self ):
@@ -133,7 +137,8 @@ def trigger_build(self):
133
137
"""
134
138
logging .info (f"Triggering a build for { self .pr if self .pr else 'new PR' } " )
135
139
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 )
137
142
elif self .trigger == Trigger .push :
138
143
self .push_to_pr ()
139
144
else :
@@ -624,6 +629,23 @@ class Tests:
624
629
test_case_kls : Type
625
630
626
631
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
+
627
649
logging .info (
628
650
"Run testcases where the build is triggered by a '/packit build' comment"
629
651
)
0 commit comments