Commit cbacd85e authored by Garrett Beaty's avatar Garrett Beaty Committed by Commit Bot

Don't run most builders on infra/config changes.

Change-Id: Ib91c6c6d7876b2200d09f6e79a35d8a257375d4d
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2314164
Commit-Queue: Garrett Beaty <gbeaty@chromium.org>
Auto-Submit: Garrett Beaty <gbeaty@chromium.org>
Reviewed-by: default avatarStephen Martinis <martiniss@chromium.org>
Cr-Commit-Position: refs/heads/master@{#791297}
parent 291e4648
This diff is collapsed.
...@@ -5,13 +5,17 @@ ...@@ -5,13 +5,17 @@
[TOC] [TOC]
Changes that only modify files in //infra/config, which do not change any build
outputs, only require the chromium_presubmit builder to pass before landing.
Each builder name links to that builder on Milo. The "matching builders" links Each builder name links to that builder on Milo. The "matching builders" links
point to the file used to determine which configurations a builder should copy point to the file used to determine which configurations a builder should copy
when running. These links might 404 or error; they are hard-coded right now, when running. These links might 404 or error; they are hard-coded right now,
using common assumptions about how builders are configured. using common assumptions about how builders are configured.
## Required builders ## Required builders
These builders must pass before a CL may land. These builders must pass before a CL may land that affects files outside of
//infra/config.
* [android-binary-size](https://ci.chromium.org/p/chromium/builders/try/android-binary-size) ([definition](https://cs.chromium.org/search?q=package:%5Echromium$+file:/cq.star$+-file:/beta/+-file:/stable/+android-binary-size)) ([matching builders](https://cs.chromium.org/search?q=+file:trybots.py+android-binary-size)) * [android-binary-size](https://ci.chromium.org/p/chromium/builders/try/android-binary-size) ([definition](https://cs.chromium.org/search?q=package:%5Echromium$+file:/cq.star$+-file:/beta/+-file:/stable/+android-binary-size)) ([matching builders](https://cs.chromium.org/search?q=+file:trybots.py+android-binary-size))
......
...@@ -2,6 +2,9 @@ ...@@ -2,6 +2,9 @@
# Use of this source code is governed by a BSD-style license that can be # Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file. # found in the LICENSE file.
load('//lib/try.star', 'INFRA_CONFIG_LOCATION_REGEXP')
_MD_HEADER = """\ _MD_HEADER = """\
<!-- Auto-generated by lucicfg (via cq-builders-md.star). --> <!-- Auto-generated by lucicfg (via cq-builders-md.star). -->
<!-- Do not modify manually. --> <!-- Do not modify manually. -->
...@@ -10,6 +13,9 @@ _MD_HEADER = """\ ...@@ -10,6 +13,9 @@ _MD_HEADER = """\
[TOC] [TOC]
Changes that only modify files in //infra/config, which do not change any build
outputs, only require the chromium_presubmit builder to pass before landing.
Each builder name links to that builder on Milo. The "matching builders" links Each builder name links to that builder on Milo. The "matching builders" links
point to the file used to determine which configurations a builder should copy point to the file used to determine which configurations a builder should copy
when running. These links might 404 or error; they are hard-coded right now, when running. These links might 404 or error; they are hard-coded right now,
...@@ -17,7 +23,8 @@ using common assumptions about how builders are configured. ...@@ -17,7 +23,8 @@ using common assumptions about how builders are configured.
""" """
_REQUIRED_HEADER = """\ _REQUIRED_HEADER = """\
These builders must pass before a CL may land. These builders must pass before a CL may land that affects files outside of
//infra/config.
""" """
_OPTIONAL_HEADER = """\ _OPTIONAL_HEADER = """\
...@@ -62,12 +69,27 @@ def _get_main_config_group_builders(ctx): ...@@ -62,12 +69,27 @@ def _get_main_config_group_builders(ctx):
fail('Could not find the main CQ group') fail('Could not find the main CQ group')
def _normalize_builder(builder):
location_regexp_exclude = [r for r in builder.location_regexp_exclude
if r != INFRA_CONFIG_LOCATION_REGEXP]
location_regexp = builder.location_regexp
if list(location_regexp) == ['.*'] and not location_regexp_exclude:
location_regexp = None
return struct(
name = builder.name,
experiment_percentage = builder.experiment_percentage,
includable_only = builder.includable_only,
location_regexp = location_regexp,
location_regexp_exclude = location_regexp_exclude,
)
def _group_builders_by_section(builders): def _group_builders_by_section(builders):
required = [] required = []
experimental = [] experimental = []
optional = [] optional = []
for builder in builders: for builder in builders:
builder = _normalize_builder(builder)
if builder.experiment_percentage: if builder.experiment_percentage:
experimental.append(builder) experimental.append(builder)
elif builder.location_regexp or builder.location_regexp_exclude: elif builder.location_regexp or builder.location_regexp_exclude:
......
...@@ -23,6 +23,9 @@ load('./builders.star', 'builders') ...@@ -23,6 +23,9 @@ load('./builders.star', 'builders')
load('./args.star', 'args') load('./args.star', 'args')
INFRA_CONFIG_LOCATION_REGEXP = 'infra/config/.+'
defaults = args.defaults( defaults = args.defaults(
extends=builders.defaults, extends=builders.defaults,
add_to_list_view = False, add_to_list_view = False,
...@@ -165,17 +168,23 @@ def tryjob( ...@@ -165,17 +168,23 @@ def tryjob(
experiment_percentage=None, experiment_percentage=None,
location_regexp=None, location_regexp=None,
location_regexp_exclude=None, location_regexp_exclude=None,
cancel_stale=None): cancel_stale=None,
run_on_infra_config_changes=False):
"""Specifies the details of a tryjob verifier. """Specifies the details of a tryjob verifier.
See https://chromium.googlesource.com/infra/luci/luci-go/+/refs/heads/master/lucicfg/doc/README.md#luci.cq_tryjob_verifier See https://chromium.googlesource.com/infra/luci/luci-go/+/refs/heads/master/lucicfg/doc/README.md#luci.cq_tryjob_verifier
for details on the arguments. The cq_group parameter supports a module-level for details on the most of the arguments.
default that defaults to None.
Arguments:
run_on_infra_changes - A bool indicating whether the try job should be run
for changes against //infra/config.
Returns: Returns:
A struct that can be passed to the `tryjob` argument of `try_.builder` to A struct that can be passed to the `tryjob` argument of `try_.builder` to
enable the builder for CQ. enable the builder for CQ.
""" """
if not run_on_infra_config_changes:
location_regexp_exclude = [INFRA_CONFIG_LOCATION_REGEXP] + (location_regexp_exclude or [])
return struct( return struct(
disable_reuse = disable_reuse, disable_reuse = disable_reuse,
experiment_percentage = experiment_percentage, experiment_percentage = experiment_percentage,
......
...@@ -343,6 +343,7 @@ try_.chromium_linux_builder( ...@@ -343,6 +343,7 @@ try_.chromium_linux_builder(
}, },
tryjob = try_.job( tryjob = try_.job(
disable_reuse = True, disable_reuse = True,
run_on_infra_config_changes = True,
), ),
) )
......
...@@ -311,6 +311,7 @@ try_.chromium_linux_builder( ...@@ -311,6 +311,7 @@ try_.chromium_linux_builder(
}, },
tryjob = try_.job( tryjob = try_.job(
disable_reuse = True, disable_reuse = True,
run_on_infra_config_changes = True,
), ),
) )
......
...@@ -315,6 +315,7 @@ try_.chromium_linux_builder( ...@@ -315,6 +315,7 @@ try_.chromium_linux_builder(
}, },
tryjob = try_.job( tryjob = try_.job(
disable_reuse = True, disable_reuse = True,
run_on_infra_config_changes = True,
), ),
) )
......
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