Commit 1569b82f authored by Garrett Beaty's avatar Garrett Beaty Committed by Commit Bot

Add support for generating builder_group property.

Bug: 1109276
Change-Id: Ief72c4d315bb12cb588454cc09555e6e6f6e51b0
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2362995
Auto-Submit: Garrett Beaty <gbeaty@chromium.org>
Reviewed-by: default avatarErik Staab <estaab@chromium.org>
Commit-Queue: Erik Staab <estaab@chromium.org>
Cr-Commit-Position: refs/heads/master@{#799199}
parent f65ca6f5
...@@ -236,6 +236,7 @@ defaults = args.defaults( ...@@ -236,6 +236,7 @@ defaults = args.defaults(
# Our custom arguments # Our custom arguments
auto_builder_dimension = args.COMPUTE, auto_builder_dimension = args.COMPUTE,
builder_group = None,
builderless = args.COMPUTE, builderless = args.COMPUTE,
bucketed_triggers = False, bucketed_triggers = False,
configure_kitchen = False, configure_kitchen = False,
...@@ -246,6 +247,7 @@ defaults = args.defaults( ...@@ -246,6 +247,7 @@ defaults = args.defaults(
goma_enable_ats = args.COMPUTE, goma_enable_ats = args.COMPUTE,
goma_jobs = None, goma_jobs = None,
goma_use_luci_auth = None, goma_use_luci_auth = None,
# TODO(https://crbug.com/1109276) Remove mastername
mastername = None, mastername = None,
os = None, os = None,
project_trigger_overrides = None, project_trigger_overrides = None,
...@@ -278,6 +280,8 @@ def builder( ...@@ -278,6 +280,8 @@ def builder(
auto_builder_dimension = args.DEFAULT, auto_builder_dimension = args.DEFAULT,
cores = args.DEFAULT, cores = args.DEFAULT,
cpu = args.DEFAULT, cpu = args.DEFAULT,
builder_group = args.DEFAULT,
# TODO(https://crbug.com/1109276) Remove mastername
mastername = args.DEFAULT, mastername = args.DEFAULT,
pool = args.DEFAULT, pool = args.DEFAULT,
ssd = args.DEFAULT, ssd = args.DEFAULT,
...@@ -325,8 +329,12 @@ def builder( ...@@ -325,8 +329,12 @@ def builder(
machines devoted to the builder. If True, a dimension will be emitted of machines devoted to the builder. If True, a dimension will be emitted of
the form 'builder:<name>'. By default, considered True iff `builderless` the form 'builder:<name>'. By default, considered True iff `builderless`
is considered False. is considered False.
* mastername - a string with the mastername of the builder. Emits a property * builder_group - a string with the group of the builder. Emits a property
of the form 'builder_group:<builder_group>'. By default, considered None.
* mastername - a string with the group of the builder. Emits a property
of the form 'mastername:<mastername>'. By default, considered None. of the form 'mastername:<mastername>'. By default, considered None.
Other than the property emitted, should be treated the same as
builder_group. At most one of builder_group or mastername can be set.
* cores - an int indicating the number of cores the builder requires for the * cores - an int indicating the number of cores the builder requires for the
machines that run it. Emits a dimension of the form 'cores:<cores>' will machines that run it. Emits a dimension of the form 'cores:<cores>' will
be emitted. By default, considered None. be emitted. By default, considered None.
...@@ -435,7 +443,13 @@ def builder( ...@@ -435,7 +443,13 @@ def builder(
if cpu != None: if cpu != None:
dimensions["cpu"] = cpu dimensions["cpu"] = cpu
builder_group = defaults.get_value("builder_group", builder_group)
mastername = defaults.get_value("mastername", mastername) mastername = defaults.get_value("mastername", mastername)
if builder_group != None and mastername != None:
fail("builder_group and mastername cannot both be set")
if builder_group != None:
properties["builder_group"] = builder_group
if mastername != None: if mastername != None:
properties["mastername"] = mastername properties["mastername"] = mastername
......
...@@ -396,8 +396,7 @@ def console_view_entry(*, category = None, short_name = None): ...@@ -396,8 +396,7 @@ def console_view_entry(*, category = None, short_name = None):
Returns: Returns:
A struct that can be passed to the `console_view_entry` argument of A struct that can be passed to the `console_view_entry` argument of
`ci.builder` to add an entry to the console for the builder's `ci.builder` to add an entry to the console for the builder's group.
mastername.
""" """
return struct( return struct(
category = category, category = category,
...@@ -425,7 +424,7 @@ def ci_builder( ...@@ -425,7 +424,7 @@ def ci_builder(
False. False.
console_view - A string identifying the ID of the console view to console_view - A string identifying the ID of the console view to
add an entry to. Supports a module-level default that defaults to add an entry to. Supports a module-level default that defaults to
the mastername of the builder, if provided. An entry will be added the group of the builder, if provided. An entry will be added
only if `add_to_console_view` is True and `console_view_entry` is only if `add_to_console_view` is True and `console_view_entry` is
provided. provided.
main_console_view - A string identifying the ID of the main console main_console_view - A string identifying the ID of the main console
...@@ -466,7 +465,11 @@ def ci_builder( ...@@ -466,7 +465,11 @@ def ci_builder(
if console_view_entry: if console_view_entry:
console_view = defaults.get_value("console_view", console_view) console_view = defaults.get_value("console_view", console_view)
if console_view == args.COMPUTE: if console_view == args.COMPUTE:
console_view = defaults.get_value_from_kwargs("mastername", kwargs) # The builder function guarantees that at most one of builder_group
# or mastername is set
builder_group = defaults.get_value_from_kwargs("builder_group", kwargs)
mastername = defaults.get_value_from_kwargs("mastername", kwargs)
console_view = builder_group or mastername
if console_view: if console_view:
add_to_console_view = defaults.get_value( add_to_console_view = defaults.get_value(
...@@ -907,12 +910,18 @@ def swangle_windows_builder(*, name, **kwargs): ...@@ -907,12 +910,18 @@ def swangle_windows_builder(*, name, **kwargs):
def thin_tester( def thin_tester(
*, *,
name, name,
mastername,
triggered_by, triggered_by,
# TODO(https://crbug.com/1109276) Remove mastername and remove default
# for builder_group
builder_group = None,
mastername = None,
tree_closing = True, tree_closing = True,
**kwargs): **kwargs):
if builder_group == None and mastername == None:
fail("One of builder_group or mastername must be set")
return ci.builder( return ci.builder(
name = name, name = name,
builder_group = builder_group,
mastername = mastername, mastername = mastername,
triggered_by = triggered_by, triggered_by = triggered_by,
goma_backend = None, goma_backend = None,
......
...@@ -212,7 +212,7 @@ def try_builder( ...@@ -212,7 +212,7 @@ def try_builder(
be added as includable_only. be added as includable_only.
list_view - A string identifying the ID of the list view to list_view - A string identifying the ID of the list view to
add an entry to. Supports a module-level default that defaults to add an entry to. Supports a module-level default that defaults to
the mastername of the builder, if provided. An entry will be added the group of the builder, if provided. An entry will be added
only if `add_to_list_view` is True. only if `add_to_list_view` is True.
main_console_view - A string identifying the ID of the main list main_console_view - A string identifying the ID of the main list
view to add an entry to. Supports a module-level default that view to add an entry to. Supports a module-level default that
...@@ -257,7 +257,11 @@ def try_builder( ...@@ -257,7 +257,11 @@ def try_builder(
if add_to_list_view: if add_to_list_view:
list_view = defaults.get_value("list_view", list_view) list_view = defaults.get_value("list_view", list_view)
if list_view == args.COMPUTE: if list_view == args.COMPUTE:
list_view = defaults.get_value_from_kwargs("mastername", kwargs) # The builder function guarantees that at most one of builder_group
# or mastername is set
builder_group = defaults.get_value_from_kwargs("builder_group", kwargs)
mastername = defaults.get_value_from_kwargs("mastername", kwargs)
list_view = builder_group or mastername
if list_view: if list_view:
add_to_list_view = defaults.get_value( add_to_list_view = defaults.get_value(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment