Skip to content

Commit 6ab531a

Browse files
authored
Show tier in buildbot failure message (#583)
1 parent c1892be commit 6ab531a

File tree

3 files changed

+36
-5
lines changed

3 files changed

+36
-5
lines changed

master/custom/builders.py

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@
6161
# Tier-2 builder.
6262
UNSTABLE = "unstable"
6363

64-
# https://peps.python.org/pep-0011/ defines Platfom Support Tiers
64+
# https://peps.python.org/pep-0011/ defines Platform Support Tiers
6565
TIER_1 = "tier-1"
6666
TIER_2 = "tier-2"
6767
TIER_3 = "tier-3"
@@ -331,6 +331,31 @@ def get_builders(settings):
331331
return all_builders
332332

333333

334+
def get_builder_tier(builder: str) -> str:
335+
# Strip trailing branch name
336+
import re
337+
builder = re.sub(r" 3\.[x\d]+$", "", builder)
338+
339+
for builders, tier in (
340+
(STABLE_BUILDERS_TIER_1, TIER_1),
341+
(STABLE_BUILDERS_TIER_2,TIER_2),
342+
(STABLE_BUILDERS_TIER_3, TIER_3),
343+
(STABLE_BUILDERS_NO_TIER, NO_TIER),
344+
(UNSTABLE_BUILDERS_TIER_1, TIER_1),
345+
(UNSTABLE_BUILDERS_TIER_2, TIER_2),
346+
(UNSTABLE_BUILDERS_TIER_3, TIER_3),
347+
(UNSTABLE_BUILDERS_NO_TIER, NO_TIER),
348+
):
349+
for name, _, _ in builders:
350+
if name == builder:
351+
if tier == NO_TIER:
352+
return "no tier"
353+
else:
354+
return tier
355+
356+
return "unknown tier"
357+
358+
334359
# Match builder name (excluding the branch name) of builders that should only
335360
# run on the main and PR branches.
336361
ONLY_MAIN_BRANCH = (

master/custom/discord_reporter.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,13 @@
1717
from buildbot.plugins import reporters
1818
from buildbot.reporters.utils import getDetailsForBuild
1919

20+
from custom.builders import get_builder_tier
2021
from custom.testsuite_utils import get_logs_and_tracebacks_from_build
2122

2223
MESSAGE = """\
2324
:warning: **Buildbot failure** :warning:
2425
25-
The buildbot **{buildername}** has failed when building commit {sha}(https://github.com/python/cpython/commit/{sha}).
26+
The buildbot **{buildername}** ({tier}) has failed when building commit {sha}(https://github.com/python/cpython/commit/{sha}).
2627
2728
You can take a look at the buildbot page here:
2829
@@ -149,9 +150,11 @@ def createReport(
149150
sha,
150151
logs,
151152
):
153+
buildername = build["builder"]["name"]
152154

153155
message = MESSAGE.format(
154-
buildername=build["builder"]["name"],
156+
buildername=buildername,
157+
tier=get_builder_tier(buildername),
155158
build_url=self._getURLForBuild(
156159
build["builder"]["builderid"], build["number"]
157160
),

master/custom/pr_reporter.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,14 @@
1818
from buildbot.plugins import reporters
1919
from buildbot.reporters.utils import getDetailsForBuild
2020

21+
from custom.builders import get_builder_tier
2122
from custom.testsuite_utils import get_logs_and_tracebacks_from_build
2223

2324
PR_MESSAGE = """\
2425
:warning::warning::warning: Buildbot failure :warning::warning::warning:
2526
------------------------------------------------------------------------
2627
27-
Hi! The buildbot **{buildername}** has failed when building commit {sha}.
28+
Hi! The buildbot **{buildername}** ({tier}) has failed when building commit {sha}.
2829
2930
What do you need to do:
3031
@@ -212,9 +213,11 @@ def createStatus(
212213
tracebacks=None,
213214
logs=None,
214215
):
216+
buildername = build["builder"]["name"]
215217

216218
message = PR_MESSAGE.format(
217-
buildername=build["builder"]["name"],
219+
buildername=buildername,
220+
tier=get_builder_tier(buildername),
218221
build_url=self._getURLForBuild(
219222
build["builder"]["builderid"], build["number"]
220223
),

0 commit comments

Comments
 (0)