0

Codify presubmit builders.

Add a builder function and a console for presubmit builders. Presubmit
builders are try builders that run quickly because they don't perform
compiles. Because they run quickly and because they tend to guard
against errors that would cause issues in the development process rather
than the chrome binaries, presubmit builders have the following

* Results from presubmit builders are not reused so that submitted code
  will have them pass against somewhat recent code.
* Presubmit builders are run against all paths by default.
* Presubmit builders are run at a higher priority than most builders so
  that //infra/config changes can be landed quickly to address outages.

properties: 
Change-Id: I4b012e74dbd1d2fda9798b430efdae65c05d60d7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2966613
Commit-Queue: Garrett Beaty <gbeaty@chromium.org>
Auto-Submit: Garrett Beaty <gbeaty@chromium.org>
Reviewed-by: Gary Tong <gatong@chromium.org>
Cr-Commit-Position: refs/heads/master@{#893063}
This commit is contained in:
Garrett Beaty
2021-06-16 18:13:37 +00:00
committed by Chromium LUCI CQ
parent 7d18c4fd31
commit d657353f32
4 changed files with 101 additions and 69 deletions
infra/config

@ -41666,6 +41666,7 @@ buckets {
cmd: "luciexe"
}
properties: "{\"$kitchen\":{\"devshell\":true,\"git_auth\":true},\"$recipe_engine/isolated\":{\"server\":\"https://isolateserver.appspot.com\"},\"$recipe_engine/resultdb/test_presentation\":{\"column_keys\":[],\"grouping_keys\":[\"status\",\"v.test_suite\"]},\"branch_configs\":[{\"branch_types\":[\"standard\"],\"name\":\"standard\"},{\"branch_types\":[\"lts\"],\"name\":\"lts\"}],\"branch_script\":\"infra/config/scripts/branch.py\",\"recipe\":\"branch_configuration/tester\",\"verification_scripts\":[\"infra/config/main.star\",\"infra/config/dev.star\"]}"
priority: 25
execution_timeout_secs: 14400
expiration_secs: 7200
grace_period {
@ -42815,7 +42816,6 @@ buckets {
properties_j: "$kitchen:{\"devshell\":true,\"git_auth\":true}"
properties_j: "$recipe_engine/isolated:{\"server\":\"https://isolateserver.appspot.com\"}"
properties_j: "$recipe_engine/resultdb/test_presentation:{\"column_keys\":[],\"grouping_keys\":[\"status\",\"v.test_suite\"]}"
properties_j: "builder_group:\"tryserver.chromium.linux\""
properties_j: "repo_name:\"chromium\""
}
priority: 25

@ -1616,6 +1616,17 @@ consoles {
tree_status_host: "chromium-status.appspot.com"
}
}
consoles {
id: "presubmit"
name: "presubmit builders"
builders {
name: "buildbucket/luci.chromium.try/branch-config-verifier"
}
builders {
name: "buildbucket/luci.chromium.try/chromium_presubmit"
}
builder_view_only: true
}
consoles {
id: "sheriff.fuchsia"
name: "Fuchsia Sheriff Console"
@ -14796,9 +14807,6 @@ consoles {
builders {
name: "buildbucket/luci.chromium.try/cast_shell_linux_dbg"
}
builders {
name: "buildbucket/luci.chromium.try/chromium_presubmit"
}
builders {
name: "buildbucket/luci.chromium.try/fuchsia-arm64-cast"
}

@ -55,23 +55,21 @@ def tryjob(
for certain directories that would have no impact when building chromium
with the patch applied (docs, config files that don't take effect until
landing, etc., see DEFAULT_EXCLUDE_REGEXPS).
enable_for_quick_run - A bool indicating whether to enable the builder for
cq.MODE_QUICK_DRY_RUN.
Returns:
A struct that can be passed to the `tryjob` argument of `try_.builder` to
enable the builder for CQ.
"""
if add_default_excludes:
location_regexp_exclude = DEFAULT_EXCLUDE_REGEXPS + (location_regexp_exclude or [])
mode_allowlist = [cq.MODE_FULL_RUN, cq.MODE_DRY_RUN]
if enable_for_quick_run:
mode_allowlist.append(cq.MODE_QUICK_DRY_RUN)
return struct(
disable_reuse = disable_reuse,
experiment_percentage = experiment_percentage,
add_default_excludes = add_default_excludes,
location_regexp = location_regexp,
location_regexp_exclude = location_regexp_exclude,
cancel_stale = cancel_stale,
mode_allowlist = mode_allowlist,
enable_for_quick_run = enable_for_quick_run,
)
def try_builder(
@ -187,15 +185,23 @@ def try_builder(
builder = "{}/{}".format(bucket, name)
cq_group = defaults.get_value("cq_group", cq_group)
if tryjob != None:
location_regexp_exclude = tryjob.location_regexp_exclude
if tryjob.add_default_excludes:
location_regexp_exclude = DEFAULT_EXCLUDE_REGEXPS + (location_regexp_exclude or [])
mode_allowlist = [cq.MODE_FULL_RUN, cq.MODE_DRY_RUN]
if tryjob.enable_for_quick_run:
mode_allowlist.append(cq.MODE_QUICK_DRY_RUN)
luci.cq_tryjob_verifier(
builder = builder,
cq_group = cq_group,
disable_reuse = tryjob.disable_reuse,
experiment_percentage = tryjob.experiment_percentage,
location_regexp = tryjob.location_regexp,
location_regexp_exclude = tryjob.location_regexp_exclude,
location_regexp_exclude = location_regexp_exclude,
cancel_stale = tryjob.cancel_stale,
mode_allowlist = tryjob.mode_allowlist,
mode_allowlist = mode_allowlist,
)
else:
# Allow CQ to trigger this builder if user opts in via CQ-Include-Trybots.
@ -504,6 +510,33 @@ def gpu_chromium_win_builder(*, name, os = builders.os.WINDOWS_ANY, **kwargs):
**kwargs
)
def presubmit_builder(*, name, tryjob, os = builders.os.LINUX_BIONIC_SWITCH_TO_DEFAULT, **kwargs):
"""Define a presubmit builder.
Presubmit builders are builders that run fast checks that don't require
building. Their results aren't re-used because they tend to provide guards
against generated files being out of date, so they MUST run quickly so that
the submit after a CQ dry run doesn't take long.
"""
tryjob_args = {a: getattr(tryjob, a) for a in dir(tryjob)}
tryjob_args["disable_reuse"] = True
tryjob_args["add_default_excludes"] = False
tryjob = try_.job(**tryjob_args)
return try_builder(
name = name,
list_view = "presubmit",
main_list_view = "try",
os = os,
# Default priority for buildbucket is 30, see
# https://chromium.googlesource.com/infra/infra/+/bb68e62b4380ede486f65cd32d9ff3f1bbe288e4/appengine/cr-buildbucket/creation.py#42
# This will improve our turnaround time for landing infra/config changes
# when addressing outages
priority = 25,
tryjob = tryjob,
**kwargs
)
try_ = struct(
# Module-level defaults for try functions
defaults = defaults,
@ -537,4 +570,5 @@ try_ = struct(
gpu_chromium_linux_builder = gpu_chromium_linux_builder,
gpu_chromium_mac_builder = gpu_chromium_mac_builder,
gpu_chromium_win_builder = gpu_chromium_win_builder,
presubmit_builder = presubmit_builder,
)

@ -101,6 +101,12 @@ luci.cq_group(
# Automatically maintained consoles
consoles.list_view(
name = "presubmit",
branch_selector = branches.ALL_BRANCHES,
title = "presubmit builders",
)
consoles.list_view(
name = "try",
branch_selector = branches.ALL_BRANCHES,
@ -171,38 +177,6 @@ consoles.list_view(
# Builders are sorted first lexicographically by the function used to define
# them, then lexicographically by their name
try_.builder(
name = "branch-config-verifier",
executable = "recipe:branch_configuration/tester",
main_list_view = "try",
os = os.LINUX_BIONIC_REMOVE,
properties = {
"branch_script": "infra/config/scripts/branch.py",
"branch_configs": [
{
"name": "standard",
"branch_types": ["standard"],
},
{
"name": "lts",
"branch_types": ["lts"],
},
],
"verification_scripts": ["infra/config/main.star", "infra/config/dev.star"],
},
tryjob = try_.job(
# Errors that this builder would catch would go unnoticed until a
# project is set up on a branch day or even worse when a branch was
# turned into an LTS branch, long after the change has been made, so
# disable reuse to ensure it's checked with current code. The builder
# runs in a few minutes and only for infra/config changes, so it won't
# impose a heavy burden on our capacity.
disable_reuse = True,
add_default_excludes = False,
location_regexp = [r".+/[+]/infra/config/.+"],
),
)
try_.blink_builder(
name = "linux-blink-optional-highdpi-rel",
goma_backend = goma.backend.RBE_PROD,
@ -1056,31 +1030,6 @@ try_.chromium_linux_builder(
},
)
try_.chromium_linux_builder(
name = "chromium_presubmit",
branch_selector = branches.ALL_BRANCHES,
executable = "recipe:presubmit",
goma_backend = None,
main_list_view = "try",
# Default priority for buildbucket is 30, see
# https://chromium.googlesource.com/infra/infra/+/bb68e62b4380ede486f65cd32d9ff3f1bbe288e4/appengine/cr-buildbucket/creation.py#42
# This will improve our turnaround time for landing infra/config changes
# when addressing outages
priority = 25,
properties = {
"$depot_tools/presubmit": {
"runhooks": True,
"timeout_s": 480,
},
"repo_name": "chromium",
},
tryjob = try_.job(
disable_reuse = True,
add_default_excludes = False,
),
os = os.LINUX_BIONIC_REMOVE,
)
try_.chromium_linux_builder(
name = "fuchsia-arm64-cast",
branch_selector = branches.STANDARD_MILESTONE,
@ -2147,6 +2096,47 @@ try_.chromium_mac_ios_builder(
),
)
# Errors that this builder would catch would go unnoticed until a project is set
# up on a branch day or even worse when a branch was turned into an LTS branch,
# long after the change has been made, so make it a presubmit builder to ensure
# it's checked with current code. The builder runs in a few minutes and only for
# infra/config changes, so it won't impose a heavy burden on our capacity.
try_.presubmit_builder(
name = "branch-config-verifier",
executable = "recipe:branch_configuration/tester",
properties = {
"branch_script": "infra/config/scripts/branch.py",
"branch_configs": [
{
"name": "standard",
"branch_types": ["standard"],
},
{
"name": "lts",
"branch_types": ["lts"],
},
],
"verification_scripts": ["infra/config/main.star", "infra/config/dev.star"],
},
tryjob = try_.job(
location_regexp = [r".+/[+]/infra/config/.+"],
),
)
try_.presubmit_builder(
name = "chromium_presubmit",
branch_selector = branches.ALL_BRANCHES,
executable = "recipe:presubmit",
properties = {
"$depot_tools/presubmit": {
"runhooks": True,
"timeout_s": 480,
},
"repo_name": "chromium",
},
tryjob = try_.job(),
)
# Used for listing chrome trybots in chromium's commit-queue.cfg without also
# adding them to chromium's cr-buildbucket.cfg. Note that the recipe these
# builders run allow only known roller accounts when triggered via the CQ.