@@ -29,6 +29,8 @@ def check_todays_builds(self):
29
29
)
30
30
return
31
31
32
+ all_chroots = self .copr .get_copr_chroots ()
33
+
32
34
logging .info ("Get build states from copr" )
33
35
states = self .copr .get_build_states_from_copr_monitor (
34
36
copr_ownername = self .config .copr_ownername ,
@@ -50,7 +52,7 @@ def check_todays_builds(self):
50
52
51
53
logging .info ("Add a build matrix" )
52
54
comment_body += build_status .markdown_build_status_matrix (
53
- chroots = self . copr . get_copr_chroots () ,
55
+ chroots = all_chroots ,
54
56
packages = self .config .packages ,
55
57
build_states = states ,
56
58
)
@@ -88,6 +90,9 @@ def check_todays_builds(self):
88
90
self .github .create_labels_for_projects (project_labels )
89
91
self .github .create_labels_for_archs (arch_labels )
90
92
self .github .create_labels_for_strategies (strategy_labels )
93
+ self .github .create_labels_for_in_testing (all_chroots )
94
+ self .github .create_labels_for_tested_on (all_chroots )
95
+ self .github .create_labels_for_failed_on (all_chroots )
91
96
92
97
# Remove old labels from issue if they no longer apply. This is greate
93
98
# for restarted builds for example to make all builds green and be able
@@ -118,18 +123,64 @@ def check_todays_builds(self):
118
123
logging .info (f"Adding label: { label } " )
119
124
issue .add_to_labels (label )
120
125
126
+ # TODO(kwk): Once only tested_on/<CHROOT> labels are assigned to the
127
+ # issue we can turn this to True.
128
+ num_builds_to_succeed = len (
129
+ all_chroots
130
+ ) # The wording is misleading this is the number of chroots that need successful builds
131
+ num_tests_to_run = len (all_chroots )
132
+ all_tests_succeeded = True
133
+ labels_on_issue = [label .name for label in issue .labels ]
134
+
135
+ for chroot in all_chroots :
136
+ logging .info (f"Check if all builds in chroot { chroot } have succeeded" )
137
+ builds_succeeded = self .copr .has_all_good_builds (
138
+ copr_ownername = self .config .copr_ownername ,
139
+ copr_projectname = self .config .copr_projectname ,
140
+ required_chroots = [chroot ],
141
+ required_packages = self .config .packages ,
142
+ states = states ,
143
+ )
144
+
145
+ if not builds_succeeded :
146
+ all_tests_succeeded = False
147
+ continue
148
+
149
+ num_builds_to_succeed -= 1
150
+
151
+ logging .info (f"All builds in chroot { chroot } have succeeded!" )
152
+ if f"in_testing/{ chroot } " in labels_on_issue :
153
+ logging .info (
154
+ f"Chroot { chroot } is currently in testing! Not kicking off new tests."
155
+ )
156
+ all_tests_succeeded = False
157
+ elif f"tested_on/{ chroot } " in labels_on_issue :
158
+ logging .info (
159
+ f"Chroot { chroot } has passed tests testing! Not kicking off new tests."
160
+ )
161
+ num_tests_to_run -= 1
162
+ elif f"failed_on/{ chroot } " in labels_on_issue :
163
+ logging .info (
164
+ f"Chroot { chroot } has unsuccessful tests! Not kicking off new tests."
165
+ )
166
+ num_tests_to_run -= 1
167
+ all_tests_succeeded = False
168
+ else :
169
+ logging .info (f"Kicking off new tests for chroot { chroot } ." )
170
+ all_tests_succeeded = False
171
+ issue .add_to_labels (f"in_testing/{ chroot } " )
172
+ # TODO(kwk): Add testing-farm code here.
173
+
121
174
logging .info ("Checking if issue can be closed" )
122
- all_good = self .copr .has_all_good_builds (
123
- copr_ownername = self .config .copr_ownername ,
124
- copr_projectname = self .config .copr_projectname ,
125
- required_chroots = self .copr .get_copr_chroots (),
126
- required_packages = self .config .packages ,
127
- states = states ,
128
- )
129
- if all_good :
175
+ building_is_done = num_builds_to_succeed == 0
176
+ testing_is_done = num_tests_to_run == 0 and all_tests_succeeded
177
+
178
+ if building_is_done and testing_is_done :
130
179
msg = f"@{ self .config .maintainer_handle } , all required packages have been successfully built in all required chroots. We'll close this issue for you now as completed. Congratulations!"
131
180
logging .info (msg )
132
181
issue .create_comment (body = msg )
133
182
issue .edit (state = "closed" , state_reason = "completed" )
183
+ else :
184
+ logging .info ("Cannot close issue yet." )
134
185
135
186
logging .info (f"Updated today's issue: { issue .html_url } " )
0 commit comments