From 0549b84f9ec3821cb12055f0646bf8c135fe774c Mon Sep 17 00:00:00 2001 From: Konrad Kleine Date: Thu, 6 Jun 2024 13:35:58 +0200 Subject: [PATCH] Fix retest title change Fix #538 --- snapshot_manager/snapshot_manager/github_util.py | 16 +++++++++------- .../snapshot_manager/snapshot_manager.py | 13 +++++++++---- 2 files changed, 18 insertions(+), 11 deletions(-) diff --git a/snapshot_manager/snapshot_manager/github_util.py b/snapshot_manager/snapshot_manager/github_util.py index 705ec0ce..5046160b 100644 --- a/snapshot_manager/snapshot_manager/github_util.py +++ b/snapshot_manager/snapshot_manager/github_util.py @@ -137,13 +137,15 @@ def initial_comment(self) -> str: def last_updated_html(cls) -> str: return f"

Last updated: {datetime.datetime.now().isoformat()}

" - @property - def issue_title(self) -> str: + def issue_title(self, strategy: str = None, yyyymmdd: str = None) -> str: """Constructs the issue title we want to use""" - strategy = self.config.build_strategy - llvm_release = util.get_release_for_yyyymmdd(self.config.yyyymmdd) - llvm_git_revision = util.get_git_revision_for_yyyymmdd(self.config.yyyymmdd) - return f"Snapshot for {self.config.yyyymmdd}, v{llvm_release}, {llvm_git_revision[:7]} ({strategy})" + if strategy is None: + strategy = self.config.build_strategy + if yyyymmdd is None: + yyyymmdd = self.config.yyyymmdd + llvm_release = util.get_release_for_yyyymmdd(yyyymmdd) + llvm_git_revision = util.get_git_revision_for_yyyymmdd(yyyymmdd) + return f"Snapshot for {yyyymmdd}, v{llvm_release}, {llvm_git_revision[:7]} ({strategy})" def create_or_get_todays_github_issue( self, @@ -164,7 +166,7 @@ def create_or_get_todays_github_issue( issue = repo.create_issue( assignee=maintainer_handle, - title=self.issue_title, + title=self.issue_title(), body=self.initial_comment, ) self.create_labels_for_strategies(labels=[strategy]) diff --git a/snapshot_manager/snapshot_manager/snapshot_manager.py b/snapshot_manager/snapshot_manager/snapshot_manager.py index 1ea54e1f..d4792221 100644 --- a/snapshot_manager/snapshot_manager/snapshot_manager.py +++ b/snapshot_manager/snapshot_manager/snapshot_manager.py @@ -139,7 +139,10 @@ def retest( new_comment_body = self.remove_chroot_html_comment( comment_body=new_comment_body, chroot=chroot ) - issue.edit(body=new_comment_body, title=self.github.issue_title) + issue.edit( + body=new_comment_body, + title=self.github.issue_title(strategy=strategy, yyyymmdd=yyyymmdd), + ) # Kick off a new workflow run and pass the exact date in YYYYMMDD # form because we don't know if the issue was for today @@ -222,7 +225,7 @@ def check_todays_builds(self) -> None: {build_status_matrix} {tf.TestingFarmRequest.dict_to_html_comment(requests)} """ - issue.edit(body=comment_body, title=self.github.issue_title) + issue.edit(body=comment_body, title=self.github.issue_title()) logging.info("Filter testing-farm requests by chroot of interest") new_requests = dict() @@ -388,7 +391,7 @@ def check_todays_builds(self) -> None: {build_status_matrix} {tf.TestingFarmRequest.dict_to_html_comment(requests)} """ - issue.edit(body=comment_body, title=self.github.issue_title) + issue.edit(body=comment_body, title=self.github.issue_title()) logging.info("Checking if issue can be closed") # issue.update() @@ -407,7 +410,9 @@ def check_todays_builds(self) -> None: logging.info(msg) issue.create_comment(body=msg) issue.edit( - state="closed", state_reason="completed", title=self.github.issue_title + state="closed", + state_reason="completed", + title=self.github.issue_title(), ) # TODO(kwk): Promotion of issue goes here. else: