Skip to content

Commit 7344bd8

Browse files
committed
main.star: run longtest builders in presubmit if vendor is modified
This change enables longtest builders in presubmit if files related to vendoring are modified. Having these enabled would've caught several issues in vendored repositories and in the main Go repository in the past. While we're here, let's also ignore location filters for security presubmit. Previously we applied them and this filtered down where the staticlockranking builder would run, but if we apply them now then we'll limit where longtest builders are run. However, we always want longtest builders to run for security presubmit. Ignoring location filters entirely is a reasonable decision here: we want to be as safe as possible with security presubmit, so we want to test as many configurations as possible. The extra builder runs are unlikely to cost much and will help to ensure stability when landing security CLs upstream. For golang/go#42661. Change-Id: Ic35216722ddca4c26cccbd96da045db5c100defb Reviewed-on: https://go-review.googlesource.com/c/build/+/547596 Reviewed-by: Dmitri Shuralyov <[email protected]> TryBot-Bypass: Michael Knyszek <[email protected]> Reviewed-by: Dmitri Shuralyov <[email protected]>
1 parent de06e77 commit 7344bd8

File tree

2 files changed

+83
-33
lines changed

2 files changed

+83
-33
lines changed

generated/commit-queue.cfg

Lines changed: 60 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -13136,11 +13136,6 @@ config_groups {
1313613136
builders {
1313713137
name: "golang/security-try/go1.20-linux-amd64-staticlockranking"
1313813138
disable_reuse: true
13139-
location_filters {
13140-
gerrit_host_regexp: "go-internal-review.googlesource.com"
13141-
gerrit_project_regexp: "^go$"
13142-
path_regexp: "src/runtime/.+"
13143-
}
1314413139
}
1314513140
builders {
1314613141
name: "golang/security-try/go1.20-linux-arm64"
@@ -13521,11 +13516,6 @@ config_groups {
1352113516
builders {
1352213517
name: "golang/security-try/go1.21-linux-amd64-staticlockranking"
1352313518
disable_reuse: true
13524-
location_filters {
13525-
gerrit_host_regexp: "go-internal-review.googlesource.com"
13526-
gerrit_project_regexp: "^go$"
13527-
path_regexp: "src/runtime/.+"
13528-
}
1352913519
}
1353013520
builders {
1353113521
name: "golang/security-try/go1.21-linux-arm64"
@@ -13918,11 +13908,6 @@ config_groups {
1391813908
builders {
1391913909
name: "golang/security-try/gotip-linux-amd64-staticlockranking"
1392013910
disable_reuse: true
13921-
location_filters {
13922-
gerrit_host_regexp: "go-internal-review.googlesource.com"
13923-
gerrit_project_regexp: "^go$"
13924-
path_regexp: "src/runtime/.+"
13925-
}
1392613911
}
1392713912
builders {
1392813913
name: "golang/security-try/gotip-linux-arm64"
@@ -15367,8 +15352,22 @@ config_groups {
1536715352
}
1536815353
builders {
1536915354
name: "golang/try/gotip-linux-386-longtest"
15370-
includable_only: true
1537115355
disable_reuse: true
15356+
location_filters {
15357+
gerrit_host_regexp: "go-review.googlesource.com"
15358+
gerrit_project_regexp: "^go$"
15359+
path_regexp: "src/{,cmd/}go[.]{mod,sum}"
15360+
}
15361+
location_filters {
15362+
gerrit_host_regexp: "go-review.googlesource.com"
15363+
gerrit_project_regexp: "^go$"
15364+
path_regexp: "src/{,cmd/}vendor/.+"
15365+
}
15366+
location_filters {
15367+
gerrit_host_regexp: "go-review.googlesource.com"
15368+
gerrit_project_regexp: "^go$"
15369+
path_regexp: "src/.+_bundle.go"
15370+
}
1537215371
}
1537315372
builders {
1537415373
name: "golang/try/gotip-linux-amd64"
@@ -15380,13 +15379,41 @@ config_groups {
1538015379
}
1538115380
builders {
1538215381
name: "golang/try/gotip-linux-amd64-longtest"
15383-
includable_only: true
1538415382
disable_reuse: true
15383+
location_filters {
15384+
gerrit_host_regexp: "go-review.googlesource.com"
15385+
gerrit_project_regexp: "^go$"
15386+
path_regexp: "src/{,cmd/}go[.]{mod,sum}"
15387+
}
15388+
location_filters {
15389+
gerrit_host_regexp: "go-review.googlesource.com"
15390+
gerrit_project_regexp: "^go$"
15391+
path_regexp: "src/{,cmd/}vendor/.+"
15392+
}
15393+
location_filters {
15394+
gerrit_host_regexp: "go-review.googlesource.com"
15395+
gerrit_project_regexp: "^go$"
15396+
path_regexp: "src/.+_bundle.go"
15397+
}
1538515398
}
1538615399
builders {
1538715400
name: "golang/try/gotip-linux-amd64-longtest-race"
15388-
includable_only: true
1538915401
disable_reuse: true
15402+
location_filters {
15403+
gerrit_host_regexp: "go-review.googlesource.com"
15404+
gerrit_project_regexp: "^go$"
15405+
path_regexp: "src/{,cmd/}go[.]{mod,sum}"
15406+
}
15407+
location_filters {
15408+
gerrit_host_regexp: "go-review.googlesource.com"
15409+
gerrit_project_regexp: "^go$"
15410+
path_regexp: "src/{,cmd/}vendor/.+"
15411+
}
15412+
location_filters {
15413+
gerrit_host_regexp: "go-review.googlesource.com"
15414+
gerrit_project_regexp: "^go$"
15415+
path_regexp: "src/.+_bundle.go"
15416+
}
1539015417
}
1539115418
builders {
1539215419
name: "golang/try/gotip-linux-amd64-misccompile"
@@ -15491,8 +15518,22 @@ config_groups {
1549115518
}
1549215519
builders {
1549315520
name: "golang/try/gotip-windows-amd64-longtest"
15494-
includable_only: true
1549515521
disable_reuse: true
15522+
location_filters {
15523+
gerrit_host_regexp: "go-review.googlesource.com"
15524+
gerrit_project_regexp: "^go$"
15525+
path_regexp: "src/{,cmd/}go[.]{mod,sum}"
15526+
}
15527+
location_filters {
15528+
gerrit_host_regexp: "go-review.googlesource.com"
15529+
gerrit_project_regexp: "^go$"
15530+
path_regexp: "src/{,cmd/}vendor/.+"
15531+
}
15532+
location_filters {
15533+
gerrit_host_regexp: "go-review.googlesource.com"
15534+
gerrit_project_regexp: "^go$"
15535+
path_regexp: "src/.+_bundle.go"
15536+
}
1549615537
}
1549715538
builders {
1549815539
name: "golang/try/gotip-windows-amd64-race"

main.star

Lines changed: 23 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -354,12 +354,21 @@ def make_run_mod(add_props = {}, add_env = {}, enabled = None):
354354
apply = apply_mod,
355355
)
356356

357-
# enable only if project matches one of the provided projects, or
358-
# for the release branches in the Go project.
357+
# enable only if project matches one of the provided projects and certain source
358+
# locations are modified by the CL, or always for the release branches of the go project.
359+
# projects is a dict mapping a project name to filters.
359360
def presubmit_only_for_projs_or_on_release_branches(projects):
360361
def f(port, project, go_branch_short):
361-
presubmit = project in projects or (project == "go" and go_branch_short != "gotip")
362-
return (True, presubmit, True, [])
362+
filters = []
363+
if project == "go":
364+
presubmit = project in projects or go_branch_short != "gotip"
365+
if project in projects and go_branch_short == "gotip":
366+
filters = projects[project]
367+
else:
368+
presubmit = project in projects
369+
if presubmit:
370+
filters = projects[project]
371+
return (True, presubmit, True, filters)
363372

364373
return f
365374

@@ -401,7 +410,15 @@ def define_for_go_postsubmit_or_presubmit_with_filters(filters):
401410
# RUN_MODS is a list of valid run-time modifications to the way we
402411
# build and test our various projects.
403412
RUN_MODS = dict(
404-
longtest = make_run_mod({"long_test": True}, {"GO_TEST_TIMEOUT_SCALE": "5"}, enabled = presubmit_only_for_projs_or_on_release_branches(["protobuf"])),
413+
longtest = make_run_mod({"long_test": True}, {"GO_TEST_TIMEOUT_SCALE": "5"}, enabled = presubmit_only_for_projs_or_on_release_branches({
414+
"protobuf": [],
415+
"go": [
416+
# Enable longtest builders on go against tip if files related to vendored code are modified.
417+
"src/{,cmd/}go[.]{mod,sum}",
418+
"src/{,cmd/}vendor/.+",
419+
"src/.+_bundle.go",
420+
],
421+
})),
405422
race = make_run_mod({"race_mode": True}, enabled = presubmit_only_for_ports_or_on_release_branches(["linux-amd64"])),
406423
boringcrypto = make_run_mod(add_env = {"GOEXPERIMENT": "boringcrypto"}),
407424
# The misccompile mod indicates that the builder should act as a "misc-compile" builder,
@@ -1364,7 +1381,7 @@ def _define_go_internal_ci():
13641381
)
13651382

13661383
for builder_type in BUILDER_TYPES:
1367-
exists, _, _, presubmit_filters = enabled(LOW_CAPACITY_HOSTS, "go", go_branch_short, builder_type)
1384+
exists, _, _, _ = enabled(LOW_CAPACITY_HOSTS, "go", go_branch_short, builder_type)
13681385

13691386
# The internal host only has access to some machines. As of
13701387
# writing, that means all the GCE-hosted (high-capacity) builders
@@ -1380,14 +1397,6 @@ def _define_go_internal_ci():
13801397
builder = name,
13811398
cq_group = cq_group_name,
13821399
disable_reuse = True,
1383-
location_filters = [
1384-
cq.location_filter(
1385-
gerrit_host_regexp = "go-internal-review.googlesource.com",
1386-
gerrit_project_regexp = "^go$",
1387-
path_regexp = filter,
1388-
)
1389-
for filter in presubmit_filters
1390-
],
13911400
)
13921401

13931402
_define_go_ci()

0 commit comments

Comments
 (0)