Skip to content
Merged
Show file tree
Hide file tree
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
27 changes: 26 additions & 1 deletion master/custom/builders.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
# Tier-2 builder.
UNSTABLE = "unstable"

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


def get_builder_tier(builder: str) -> str:
# Strip trailing branch name
import re
builder = re.sub(r" 3\.[x\d]+$", "", builder)

for builders, tier in (
(STABLE_BUILDERS_TIER_1, TIER_1),
(STABLE_BUILDERS_TIER_2,TIER_2),
(STABLE_BUILDERS_TIER_3, TIER_3),
(STABLE_BUILDERS_NO_TIER, NO_TIER),
(UNSTABLE_BUILDERS_TIER_1, TIER_1),
(UNSTABLE_BUILDERS_TIER_2, TIER_2),
(UNSTABLE_BUILDERS_TIER_3, TIER_3),
(UNSTABLE_BUILDERS_NO_TIER, NO_TIER),
Comment on lines +340 to +347
Copy link
Member

@picnixz picnixz Mar 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we should have a data structure holding those? like STABLE_TIER_LIST = {TIER_1: STABLE_BUILDERS_TIER_1, ... and UNSTABLE_TIER_LIST = {...}?

):
for name, _, _ in builders:
if name == builder:
if tier == NO_TIER:
return "no tier"
else:
return tier

return "unknown tier"


# Match builder name (excluding the branch name) of builders that should only
# run on the main and PR branches.
ONLY_MAIN_BRANCH = (
Expand Down
7 changes: 5 additions & 2 deletions master/custom/discord_reporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,13 @@
from buildbot.plugins import reporters
from buildbot.reporters.utils import getDetailsForBuild

from custom.builders import get_builder_tier
from custom.testsuite_utils import get_logs_and_tracebacks_from_build

MESSAGE = """\
:warning: **Buildbot failure** :warning:

The buildbot **{buildername}** has failed when building commit {sha}(https://github.com/python/cpython/commit/{sha}).
The buildbot **{buildername}** ({tier}) has failed when building commit {sha}(https://github.com/python/cpython/commit/{sha}).

You can take a look at the buildbot page here:

Expand Down Expand Up @@ -149,9 +150,11 @@ def createReport(
sha,
logs,
):
buildername = build["builder"]["name"]

message = MESSAGE.format(
buildername=build["builder"]["name"],
buildername=buildername,
tier=get_builder_tier(buildername),
build_url=self._getURLForBuild(
build["builder"]["builderid"], build["number"]
),
Expand Down
7 changes: 5 additions & 2 deletions master/custom/pr_reporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,14 @@
from buildbot.plugins import reporters
from buildbot.reporters.utils import getDetailsForBuild

from custom.builders import get_builder_tier
from custom.testsuite_utils import get_logs_and_tracebacks_from_build

PR_MESSAGE = """\
:warning::warning::warning: Buildbot failure :warning::warning::warning:
------------------------------------------------------------------------

Hi! The buildbot **{buildername}** has failed when building commit {sha}.
Hi! The buildbot **{buildername}** ({tier}) has failed when building commit {sha}.

What do you need to do:

Expand Down Expand Up @@ -212,9 +213,11 @@ def createStatus(
tracebacks=None,
logs=None,
):
buildername = build["builder"]["name"]

message = PR_MESSAGE.format(
buildername=build["builder"]["name"],
buildername=buildername,
tier=get_builder_tier(buildername),
build_url=self._getURLForBuild(
build["builder"]["builderid"], build["number"]
),
Expand Down