Skip to content

Commit 77a4efb

Browse files
committed
Add icon to in_testing, tested_on, and failed_on labels
1 parent c7d92d8 commit 77a4efb

File tree

3 files changed

+51
-16
lines changed

3 files changed

+51
-16
lines changed

snapshot_manager/snapshot_manager/config.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,10 @@ class Config:
6262
test_repo_url: str = "https://github.com/fedora-llvm-team/llvm-snapshots"
6363
"""TBD"""
6464

65+
label_prefix_in_testing: str = "in_testing/"
66+
label_prefix_tested_on: str = "tested_on/"
67+
label_prefix_failed_on: str = "failed_on/"
68+
6569
@property
6670
def copr_projectname(self) -> str:
6771
"""Takes the copr_project_tpl and replaces the YYYYMMDD placeholder (if any) with a date.

snapshot_manager/snapshot_manager/github_util.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -220,15 +220,24 @@ def create_labels_for_archs(self, labels: list[str], **kw_args):
220220

221221
def create_labels_for_in_testing(self, labels: list[str], **kw_args):
222222
self._create_labels(
223-
labels=labels, prefix="in_testing/", color="FEF2C0", *kw_args
223+
labels=labels,
224+
prefix=self.config.label_prefix_in_testing,
225+
color="FEF2C0",
226+
*kw_args,
224227
)
225228

226229
def create_labels_for_tested_on(self, labels: list[str], **kw_args):
227230
self._create_labels(
228-
labels=labels, prefix="tested_on/", color="0E8A16", *kw_args
231+
labels=labels,
232+
prefix=self.config.label_prefix_tested_on,
233+
color="0E8A16",
234+
*kw_args,
229235
)
230236

231237
def create_labels_for_failed_on(self, labels: list[str], **kw_args):
232238
self._create_labels(
233-
labels=labels, prefix="failed_on/", color="D93F0B", *kw_args
239+
labels=labels,
240+
prefix=self.config.label_prefix_failed_on,
241+
color="D93F0B",
242+
*kw_args,
234243
)

snapshot_manager/snapshot_manager/snapshot_manager.py

Lines changed: 35 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -187,17 +187,37 @@ def check_todays_builds(self):
187187
tf.TestingFarmWatchResult.TESTS_ERROR,
188188
tf.TestingFarmWatchResult.TESTS_FAILED,
189189
]:
190-
if f"in_testing/{chroot}" in labels_on_issue:
191-
issue.remove_from_labels(f"in_testing/{chroot}")
192-
if f"tested_on/{chroot}" in labels_on_issue:
193-
issue.remove_from_labels(f"tested_on/{chroot}")
194-
issue.add_to_labels(f"failed_on/{chroot}")
190+
if (
191+
f"{self.config.label_prefix_in_testing}{chroot}"
192+
in labels_on_issue
193+
):
194+
issue.remove_from_labels(
195+
f"{self.config.label_prefix_in_testing}{chroot}"
196+
)
197+
if (
198+
f"{self.config.label_prefix_tested_on}{chroot}"
199+
in labels_on_issue
200+
):
201+
issue.remove_from_labels(
202+
f"{self.config.label_prefix_tested_on}{chroot}"
203+
)
204+
issue.add_to_labels(f"{self.config.label_prefix_failed_on}{chroot}")
195205
elif watch_result == tf.TestingFarmWatchResult.TESTS_PASSED:
196-
if f"in_testing/{chroot}" in labels_on_issue:
197-
issue.remove_from_labels(f"in_testing/{chroot}")
198-
if f"failed_on/{chroot}" in labels_on_issue:
199-
issue.remove_from_labels(f"failed_on/{chroot}")
200-
issue.add_to_labels(f"tested_on/{chroot}")
206+
if (
207+
f"{self.config.label_prefix_in_testing}{chroot}"
208+
in labels_on_issue
209+
):
210+
issue.remove_from_labels(
211+
f"{self.config.label_prefix_in_testing}{chroot}"
212+
)
213+
if (
214+
f"{self.config.label_prefix_failed_on}{chroot}"
215+
in labels_on_issue
216+
):
217+
issue.remove_from_labels(
218+
f"{self.config.label_prefix_failed_on}{chroot}"
219+
)
220+
issue.add_to_labels(f"{self.config.label_prefix_tested_on}{chroot}")
201221
else:
202222
logging.info(f"Starting tests for chroot {chroot}")
203223
request_id = tf.make_testing_farm_request(
@@ -207,7 +227,7 @@ def check_todays_builds(self):
207227
)
208228
logging.info(f"Request ID: {request_id}")
209229
testing_farm_requests[chroot] = request_id
210-
issue.add_to_labels(f"in_testing/{chroot}")
230+
issue.add_to_labels(f"{self.config.label_prefix_in_testing}{chroot}")
211231

212232
if len(failed_test_cases) > 0:
213233
testing_farm_comment_body = f"""
@@ -244,10 +264,12 @@ def check_todays_builds(self):
244264
logging.info("Checking if issue can be closed")
245265
# issue.update()
246266
tested_chroot_labels = [
247-
label.name for label in issue.labels if label.name.startswith("tested_on/")
267+
label.name
268+
for label in issue.labels
269+
if label.name.startswith("{self.config.label_prefix_tested_on}")
248270
]
249271
required_chroot_abels = [
250-
"tested_on/{chroot}"
272+
"{self.config.label_prefix_tested_on}{chroot}"
251273
for chroot in all_chroots
252274
if tf.is_chroot_supported(chroot)
253275
]

0 commit comments

Comments
 (0)