Skip to content

Commit

Permalink
Fix retest title change
Browse files Browse the repository at this point in the history
Fix #538
  • Loading branch information
kwk committed Jun 6, 2024
1 parent 87d4a0c commit 0549b84
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 11 deletions.
16 changes: 9 additions & 7 deletions snapshot_manager/snapshot_manager/github_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,13 +137,15 @@ def initial_comment(self) -> str:
def last_updated_html(cls) -> str:
return f"<p><b>Last updated: {datetime.datetime.now().isoformat()}</b></p>"

@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,
Expand All @@ -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])
Expand Down
13 changes: 9 additions & 4 deletions snapshot_manager/snapshot_manager/snapshot_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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()
Expand All @@ -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:
Expand Down

0 comments on commit 0549b84

Please sign in to comment.