Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Link to PR-specific grid in PR message #576

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading