cmd/coordinator: run release branch subrepo trybots on corresponding Go branch
No tests because this part of the coordinator hasn't been refactored
for testability yet. (Working builders for the x/build repo are new
and this code hasn't been historically unit tested.) We're getting
there, but not in this CL.
Fixes golang/go#28891
Change-Id: Iad718a98e42fec7de09f5d77e6c957dca97fc0a3
Reviewed-on: https://go-review.googlesource.com/c/build/+/167382
Reviewed-by: Bryan C. Mills <bcmills@google.com>
diff --git a/cmd/coordinator/coordinator.go b/cmd/coordinator/coordinator.go
index 2f037bf..e950f80 100644
--- a/cmd/coordinator/coordinator.go
+++ b/cmd/coordinator/coordinator.go
@@ -1101,17 +1101,6 @@
},
}
- // GoCommit is non-empty for x/* repos (aka "subrepos"). It
- // is the Go revision to use to build & test the x/* repo
- // with. The first element is the master branch. We test the
- // master branch against all the normal builders configured to
- // do subrepos. Any GoCommit values past the first are for older
- // release branches, but we use a limited subset of builders for those.
- var goRev string
- if len(work.GoCommit) > 0 {
- goRev = work.GoCommit[0]
- }
-
// Defensive check that the input is well-formed.
// Each GoCommit should have a GoBranch and a GoVersion.
// There should always be at least one GoVersion.
@@ -1128,6 +1117,19 @@
work.GoVersion = []*apipb.MajorMinor{{}}
}
+ // GoCommit is non-empty for x/* repos (aka "subrepos"). It
+ // is the Go revision to use to build & test the x/* repo
+ // with. The first element is the master branch. We test the
+ // master branch against all the normal builders configured to
+ // do subrepos. Any GoCommit values past the first are for older
+ // release branches, but we use a limited subset of builders for those.
+ var goRev string
+ for i, branch := range work.GoBranch {
+ if branch == work.Branch {
+ goRev = work.GoCommit[i]
+ }
+ }
+
addBuilderToSet := func(bs *buildStatus, brev buildgo.BuilderRev) {
bs.trySet = ts
status[brev] = bs
@@ -1159,34 +1161,38 @@
addBuilderToSet(bs, brev)
}
- // linuxBuilder is the standard builder we run for when testing x/* repos against
- // the past two Go releases.
- linuxBuilder := dashboard.Builders["linux-amd64"]
+ // For subrepos on the "master" branch, test against prior releases of Go too.
+ if key.Project != "go" && key.Branch == "master" {
+ // linuxBuilder is the standard builder we run for when testing x/* repos against
+ // the past two Go releases.
+ linuxBuilder := dashboard.Builders["linux-amd64"]
- // If there's more than one GoCommit, that means this is an x/* repo
- // and we're testing against previous releases of Go.
- for i, goRev := range work.GoCommit {
- if i == 0 {
- // Skip the i==0 element, which is handled above.
- continue
+ // If there's more than one GoCommit, that means this is an x/* repo
+ // and we're testing against previous releases of Go.
+ for i, goRev := range work.GoCommit {
+ if i == 0 {
+ // Skip the i==0 element, which is handled above.
+ continue
+ }
+ branch := work.GoBranch[i]
+ if !linuxBuilder.BuildsRepoTryBot(key.Project, "master", branch) {
+ continue
+ }
+ goVersion := types.MajorMinor{int(work.GoVersion[i].Major), int(work.GoVersion[i].Minor)}
+ if goVersion.Less(linuxBuilder.MinimumGoVersion) {
+ continue
+ }
+ brev := tryKeyToBuilderRev(linuxBuilder.Name, key, goRev)
+ bs, err := newBuild(brev)
+ if err != nil {
+ log.Printf("can't create build for %q: %v", brev, err)
+ continue
+ }
+ bs.goBranch = branch
+ addBuilderToSet(bs, brev)
}
- branch := work.GoBranch[i]
- if !linuxBuilder.BuildsRepoTryBot(key.Project, "master", branch) {
- continue
- }
- goVersion := types.MajorMinor{int(work.GoVersion[i].Major), int(work.GoVersion[i].Minor)}
- if goVersion.Less(linuxBuilder.MinimumGoVersion) {
- continue
- }
- brev := tryKeyToBuilderRev(linuxBuilder.Name, key, goRev)
- bs, err := newBuild(brev)
- if err != nil {
- log.Printf("can't create build for %q: %v", brev, err)
- continue
- }
- bs.goBranch = branch
- addBuilderToSet(bs, brev)
}
+
return ts
}