0

Auto generate consoles for gardener rotations

This generates consoles for each gardener rotation.

I've created a default short name by separating the builder name of
various delimiters and recombining using the first 3 letters of each
word. This will be removed after the gardener console category
and short name are required (see the fuchsia builder for an example).

These consoles are also not currently setup to appear in the top
banner.

If this approach is acceptable I'll create a CL to create each
rotation (i.e. setting the category/short name, verify the console, and
then swap the existing console in the top banner

Bug: 394945600
Change-Id: I3c8b57f6d82e834b5ae81168118984cbf3c7c103
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6240255
Reviewed-by: Garrett Beaty <gbeaty@google.com>
Commit-Queue: Struan Shrimpton <sshrimp@google.com>
Cr-Commit-Position: refs/heads/main@{#1419564}
This commit is contained in:
Struan Shrimpton
2025-02-12 14:42:17 -08:00
committed by Chromium LUCI CQ
parent 5568297168
commit a8fe82e775
6 changed files with 5690 additions and 1 deletions

@ -52,6 +52,8 @@ rules {
arg: "free_space"
arg: "gce"
arg: "gardener_rotations"
arg: "gardener_rotation_console_category"
arg: "gardener_rotation_console_short_name"
arg: "tree_closing"
arg: "console_view_entry"
arg: "main_console_view"

File diff suppressed because it is too large Load Diff

@ -32,7 +32,7 @@ load("./branches.star", "branches")
load("./builder_config.star", "register_builder_config")
load("./builder_exemptions.star", "exempted_from_description_builders")
load("./builder_health_indicators.star", "register_health_spec")
load("./consoles.star", "register_builder_to_console_view")
load("./consoles.star", "consoles", "register_builder_to_console_view")
load("./gn_args.star", "register_gn_args")
load("./nodes.star", "nodes")
load("./recipe_experiments.star", "register_recipe_experiments_ref")
@ -125,6 +125,9 @@ def _rotation(name):
value = [name],
)
def _gardener_rotation_name(rotation):
return rotation + " rotation"
# Gardener rotations that a builder can be added to (only takes effect on trunk)
# New rotations can be added, but won't automatically show up in SoM without
# changes to SoM code.
@ -162,6 +165,20 @@ _DEFAULT_BUILDERLESS_OS_CATEGORIES = [os_category.LINUX, os_category.WINDOWS]
# setting ssd:0 dimension
_EXCLUDE_BUILDERLESS_SSD_OS_CATEGORIES = [os_category.MAC]
# TODO(crbug.com/394945600): Remove this after migrating existing builders and
# the short name is a required parameter for gardened builders.
def _default_short_name(name):
words = [name]
for s in (" ", "-", "_"):
parts = [word.replace("(", "").split(s) for word in words]
words = []
for new_parts in parts:
words = args.listify(
words,
new_parts,
)
return "".join([part[0].upper() + part[1:3] for part in words])
def _code_coverage_property(
*,
coverage_gs_bucket,
@ -440,6 +457,8 @@ def builder(
pool = args.DEFAULT,
ssd = args.DEFAULT,
gardener_rotations = None,
gardener_rotation_console_category = None,
gardener_rotation_console_short_name = None,
xcode = args.DEFAULT,
console_view_entry = None,
list_view = args.DEFAULT,
@ -593,6 +612,12 @@ def builder(
gardener_rotations: A string or list of strings identifying the gardener
rotations that the builder should be included in. Will be merged
with the module-level default.
gardener_rotation_console_category: A string to use as the category in
the gardener rotation console. This value is only used when a
gardener_rotations value is present.
gardener_rotation_console_short_name: A string to use as the short name
in the gardener rotation console. This value is only used when a
gardener_rotations value is present.
xcode: a member of the `xcode` enum indicating the xcode version the
builder requires. Emits a cache declaration of the form
```{
@ -843,6 +868,14 @@ def builder(
properties["sheriff_rotations"] = gardener_rotations
properties["gardener_rotations"] = gardener_rotations
if gardener_rotation_console_category and not gardener_rotations:
fail("gardener_rotations must also be set when " +
"gardener_rotation_console_category is set")
if gardener_rotation_console_short_name and not gardener_rotations:
fail("gardener_rotations must also be set when " +
"gardener_rotation_console_short_name is set")
ssd = defaults.get_value("ssd", ssd)
if ssd == args.COMPUTE:
ssd = None
@ -1127,6 +1160,19 @@ def builder(
entries = [console_view_entry]
else:
entries = console_view_entry
for rotation in gardener_rotations:
rotations = [getattr(builders.gardener_rotations, a) for a in dir(builders.gardener_rotations)]
if any([r and r[0] == rotation for r in rotations]):
console_view = _gardener_rotation_name(rotation)
default_short_name = _default_short_name(name)
entries = args.listify(
entries,
consoles.console_view_entry(
console_view = _gardener_rotation_name(rotation),
category = gardener_rotation_console_category,
short_name = gardener_rotation_console_short_name or default_short_name,
),
)
entries_without_console_view = [
e
for e in entries
@ -1189,5 +1235,6 @@ builders = struct(
defaults = defaults,
os = os,
gardener_rotations = gardener_rotations,
gardener_rotation_name = _gardener_rotation_name,
free_space = free_space,
)

@ -390,6 +390,7 @@ def register_builder_to_console_view(
"group": group,
"builder": builder,
},
idempotent = True,
),
)

@ -149,6 +149,14 @@ luci.gitiles_poller(
("mirrors", "{} CQ Mirrors Console".format(settings.project_title)),
)]
def register_gardener_rotation_consoles():
rotations = [getattr(builders.gardener_rotations, a) for a in dir(builders.gardener_rotations)]
for rotation in rotations:
if rotation and len(rotation) > 0:
consoles.console_view(name = builders.gardener_rotation_name(rotation[0]))
register_gardener_rotation_consoles()
# The main console includes some entries for builders from the chrome project
[branches.console_view_entry(
console_view = "main",

@ -66,6 +66,8 @@ ci.builder(
# Runs two builds, which can cause the builder to run out of disk space
# with standard free space.
free_space = free_space.high,
gardener_rotation_console_category = "ci|x64",
gardener_rotation_console_short_name = "det",
console_view_entry = [
consoles.console_view_entry(
category = "det",