Skip to content

Commit

Permalink
Link to PR-specific grid in PR message (#576)
Browse files Browse the repository at this point in the history
Also add the link to 'command' PR runs rather than just 'label' runs.

Expansion of #571; ref #327.

Note that, at present, the link does not actually filter to the specified branch.  It is hoped that a later update to buildbot will enable that.
  • Loading branch information
zware authored Feb 16, 2025
1 parent 34208ed commit bb43ee6
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions master/custom/pr_testing.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,20 @@

GITHUB_PROPERTIES_WHITELIST = ["*.labels"]

BUILD_SCHEDULED_MESSAGE_TEMPLATE = """\
BUILD_MESSAGE_HEADER = """\
:robot: New build scheduled with the buildbot fleet by @{user} for commit {commit} :robot:
Results will be shown at:
https://buildbot.python.org/all/#/grid?branch=refs%2Fpull%2F30617%2Fmerge
https://buildbot.python.org/all/#/grid?branch=refs%2Fpull%2F{pr_number}%2Fmerge
If you want to schedule another build, you need to add the <kbd>{label}</kbd> label again.
"""

BUILD_COMMAND_SCHEDULED_MESSAGE_TEMPLATE = """\
:robot: New build scheduled with the buildbot fleet by @{user} for commit {commit} :robot:
BUILD_SCHEDULED_MESSAGE_TEMPLATE = BUILD_MESSAGE_HEADER + """\
If you want to schedule another build, you need to add the <kbd>{label}</kbd> label again.
"""

BUILD_COMMAND_SCHEDULED_MESSAGE_TEMPLATE = BUILD_MESSAGE_HEADER + """\
The command will test the builders whose names match following regular expression: `{filter}`
The builders matched are:
Expand Down Expand Up @@ -83,11 +84,15 @@ def _remove_label_and_comment(self, payload, label):
url = payload["pull_request"]["comments_url"]
username = payload["sender"]["login"]
commit = payload["pull_request"]["head"]["sha"]
pr_number = payload["issue"]["number"]
yield http.post(
url.replace(self.github_api_endpoint, ""),
json={
"body": BUILD_SCHEDULED_MESSAGE_TEMPLATE.format(
user=username, commit=commit, label=label
user=username,
commit=commit,
label=label,
pr_number=pr_number,
)
},
)
Expand Down Expand Up @@ -281,6 +286,7 @@ def handle_issue_comment(self, payload, event):
user=payload["sender"]["login"],
commit=head_sha,
filter=builder_filter,
pr_number=number,
builders="\n".join(
{
f"- `{builder}`"
Expand Down

0 comments on commit bb43ee6

Please sign in to comment.