Skip to content

Commit

Permalink
Add icon to in_testing, tested_on, and failed_on labels
Browse files Browse the repository at this point in the history
  • Loading branch information
kwk committed Mar 31, 2024
1 parent c7d92d8 commit 77a4efb
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 16 deletions.
4 changes: 4 additions & 0 deletions snapshot_manager/snapshot_manager/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@ class Config:
test_repo_url: str = "https://github.com/fedora-llvm-team/llvm-snapshots"
"""TBD"""

label_prefix_in_testing: str = "in_testing/"
label_prefix_tested_on: str = "tested_on/"
label_prefix_failed_on: str = "failed_on/"

@property
def copr_projectname(self) -> str:
"""Takes the copr_project_tpl and replaces the YYYYMMDD placeholder (if any) with a date.
Expand Down
15 changes: 12 additions & 3 deletions snapshot_manager/snapshot_manager/github_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,15 +220,24 @@ def create_labels_for_archs(self, labels: list[str], **kw_args):

def create_labels_for_in_testing(self, labels: list[str], **kw_args):
self._create_labels(
labels=labels, prefix="in_testing/", color="FEF2C0", *kw_args
labels=labels,
prefix=self.config.label_prefix_in_testing,
color="FEF2C0",
*kw_args,
)

def create_labels_for_tested_on(self, labels: list[str], **kw_args):
self._create_labels(
labels=labels, prefix="tested_on/", color="0E8A16", *kw_args
labels=labels,
prefix=self.config.label_prefix_tested_on,
color="0E8A16",
*kw_args,
)

def create_labels_for_failed_on(self, labels: list[str], **kw_args):
self._create_labels(
labels=labels, prefix="failed_on/", color="D93F0B", *kw_args
labels=labels,
prefix=self.config.label_prefix_failed_on,
color="D93F0B",
*kw_args,
)
48 changes: 35 additions & 13 deletions snapshot_manager/snapshot_manager/snapshot_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,17 +187,37 @@ def check_todays_builds(self):
tf.TestingFarmWatchResult.TESTS_ERROR,
tf.TestingFarmWatchResult.TESTS_FAILED,
]:
if f"in_testing/{chroot}" in labels_on_issue:
issue.remove_from_labels(f"in_testing/{chroot}")
if f"tested_on/{chroot}" in labels_on_issue:
issue.remove_from_labels(f"tested_on/{chroot}")
issue.add_to_labels(f"failed_on/{chroot}")
if (
f"{self.config.label_prefix_in_testing}{chroot}"
in labels_on_issue
):
issue.remove_from_labels(
f"{self.config.label_prefix_in_testing}{chroot}"
)
if (
f"{self.config.label_prefix_tested_on}{chroot}"
in labels_on_issue
):
issue.remove_from_labels(
f"{self.config.label_prefix_tested_on}{chroot}"
)
issue.add_to_labels(f"{self.config.label_prefix_failed_on}{chroot}")
elif watch_result == tf.TestingFarmWatchResult.TESTS_PASSED:
if f"in_testing/{chroot}" in labels_on_issue:
issue.remove_from_labels(f"in_testing/{chroot}")
if f"failed_on/{chroot}" in labels_on_issue:
issue.remove_from_labels(f"failed_on/{chroot}")
issue.add_to_labels(f"tested_on/{chroot}")
if (
f"{self.config.label_prefix_in_testing}{chroot}"
in labels_on_issue
):
issue.remove_from_labels(
f"{self.config.label_prefix_in_testing}{chroot}"
)
if (
f"{self.config.label_prefix_failed_on}{chroot}"
in labels_on_issue
):
issue.remove_from_labels(
f"{self.config.label_prefix_failed_on}{chroot}"
)
issue.add_to_labels(f"{self.config.label_prefix_tested_on}{chroot}")
else:
logging.info(f"Starting tests for chroot {chroot}")
request_id = tf.make_testing_farm_request(
Expand All @@ -207,7 +227,7 @@ def check_todays_builds(self):
)
logging.info(f"Request ID: {request_id}")
testing_farm_requests[chroot] = request_id
issue.add_to_labels(f"in_testing/{chroot}")
issue.add_to_labels(f"{self.config.label_prefix_in_testing}{chroot}")

if len(failed_test_cases) > 0:
testing_farm_comment_body = f"""
Expand Down Expand Up @@ -244,10 +264,12 @@ def check_todays_builds(self):
logging.info("Checking if issue can be closed")
# issue.update()
tested_chroot_labels = [
label.name for label in issue.labels if label.name.startswith("tested_on/")
label.name
for label in issue.labels
if label.name.startswith("{self.config.label_prefix_tested_on}")
]
required_chroot_abels = [
"tested_on/{chroot}"
"{self.config.label_prefix_tested_on}{chroot}"
for chroot in all_chroots
if tf.is_chroot_supported(chroot)
]
Expand Down

0 comments on commit 77a4efb

Please sign in to comment.