Skip to content

Commit

Permalink
internal/migration: add a small package to hold migration knobs
Browse files Browse the repository at this point in the history
I'm looking to largely leave existing coordinator code alone as
it's being gradually shut down, before being eventually deleted.
This makes it easier to look up past behaviors.

Add a small internal package that can be imported both by dashboard and
coordinator. It'll hold some state that controls what's been turned off.

For golang/go#67761.

Change-Id: Iff3615418307fbd925590ccc98306374bb7891ac
Reviewed-on: https://go-review.googlesource.com/c/build/+/589657
Auto-Submit: Dmitri Shuralyov <[email protected]>
Reviewed-by: Dmitri Shuralyov <[email protected]>
LUCI-TryBot-Result: Go LUCI <[email protected]>
Reviewed-by: Michael Knyszek <[email protected]>
  • Loading branch information
dmitshur authored and gopherbot committed Jun 3, 2024
1 parent c327aad commit b70af65
Show file tree
Hide file tree
Showing 5 changed files with 114 additions and 96 deletions.
3 changes: 2 additions & 1 deletion cmd/coordinator/internal/dashboard/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import (
"cloud.google.com/go/datastore"
"golang.org/x/build/cmd/coordinator/internal/lucipoll"
"golang.org/x/build/dashboard"
"golang.org/x/build/internal/migration"
"golang.org/x/build/internal/releasetargets"
"golang.org/x/build/maintner/maintnerd/apipb"
"google.golang.org/grpc"
Expand Down Expand Up @@ -128,7 +129,7 @@ func (d *Handler) getBuilders(conf map[string]*dashboard.BuildConfig, luci lucip
if !b.BuildsRepoPostSubmit("go", "master", "master") {
continue
}
if dashboard.BuildersPortedToLUCI[b.Name] && len(luci.Builders) > 0 {
if migration.BuildersPortedToLUCI[b.Name] && len(luci.Builders) > 0 {
// Don't display old builders that have been ported
// to LUCI if willing to show LUCI builders as well.
continue
Expand Down
5 changes: 3 additions & 2 deletions cmd/coordinator/internal/legacydash/ui.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import (
bbpb "go.chromium.org/luci/buildbucket/proto"
"golang.org/x/build/cmd/coordinator/internal/lucipoll"
"golang.org/x/build/dashboard"
"golang.org/x/build/internal/migration"
"golang.org/x/build/internal/releasetargets"
"golang.org/x/build/maintner/maintnerd/apipb"
"golang.org/x/build/repos"
Expand Down Expand Up @@ -482,7 +483,7 @@ func (tb *uiTemplateDataBuilder) buildTemplateData(ctx context.Context, datastor
}
if len(luci.Builders) > 0 {
for name := range builders {
if dashboard.BuildersPortedToLUCI[name] {
if migration.BuildersPortedToLUCI[name] {
// Don't display old builders that have been ported
// to LUCI if willing to show LUCI builders as well.
delete(builders, name)
Expand Down Expand Up @@ -525,7 +526,7 @@ func (tb *uiTemplateDataBuilder) buildTemplateData(ctx context.Context, datastor
}
if len(luci.Builders) > 0 {
for name := range builders {
if dashboard.BuildersPortedToLUCI[name] {
if migration.BuildersPortedToLUCI[name] {
// Don't display old builders that have been ported
// to LUCI if willing to show LUCI builders as well.
delete(builders, name)
Expand Down
94 changes: 2 additions & 92 deletions dashboard/builders.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import (

"golang.org/x/build/buildenv"
"golang.org/x/build/internal/gophers"
"golang.org/x/build/internal/migration"
"golang.org/x/build/maintner/maintnerd/maintapi/version"
"golang.org/x/build/types"
)
Expand Down Expand Up @@ -2861,97 +2862,6 @@ func init() {
})
}

// BuildersPortedToLUCI lists coordinator builders that have been ported
// over to LUCI and don't need to continue to run. Their results will be
// hidden from the build.golang.org page and new builds won't be started
// if stopPortedBuilder (below) returns true.
//
// See go.dev/issue/65913
// and go.dev/issue/63471.
var BuildersPortedToLUCI = map[string]bool{
// macOS builders.
"darwin-amd64-10_15": true, // Available as https://ci.chromium.org/p/golang/builders/ci/gotip-darwin-amd64_10.15.
"darwin-amd64-11_0": true, // Available as https://ci.chromium.org/p/golang/builders/ci/gotip-darwin-amd64_11.
"darwin-amd64-12_0": true, // Available as https://ci.chromium.org/p/golang/builders/ci/gotip-darwin-amd64_12.
"darwin-amd64-13": true, // Available as https://ci.chromium.org/p/golang/builders/ci/gotip-darwin-amd64_13.
"darwin-amd64-longtest": true, // Available as https://ci.chromium.org/p/golang/builders/ci/gotip-darwin-amd64-longtest.
"darwin-amd64-nocgo": true, // Available as https://ci.chromium.org/p/golang/builders/ci/gotip-darwin-amd64-nocgo.
"darwin-arm64-11": true, // Available as https://ci.chromium.org/p/golang/builders/ci/gotip-darwin-arm64_11.
"darwin-arm64-12": true, // Available as https://ci.chromium.org/p/golang/builders/ci/gotip-darwin-arm64_12.

// Linux builders (just those covering first-class ports).
"linux-386": true, // Available as https://ci.chromium.org/p/golang/builders/ci/gotip-linux-386.
"linux-386-longtest": true, // Available as https://ci.chromium.org/p/golang/builders/ci/gotip-linux-386-longtest.
"linux-386-clang": true, // Available as https://ci.chromium.org/p/golang/builders/ci/gotip-linux-386-clang15 (a newer clang, but we won't be adding exactly -clang7 to LUCI by now).
"linux-386-softfloat": true, // Available as https://ci.chromium.org/p/golang/builders/ci/gotip-linux-386-softfloat.
"linux-arm-aws": true, // Available as https://ci.chromium.org/p/golang/builders/ci/gotip-linux-arm.
"linux-amd64": true, // Available as https://ci.chromium.org/p/golang/builders/ci/gotip-linux-amd64.
"linux-amd64-longtest": true, // Available as https://ci.chromium.org/p/golang/builders/ci/gotip-linux-amd64-longtest.
"linux-amd64-race": true, // Available as https://ci.chromium.org/p/golang/builders/ci/gotip-linux-amd64-race.
"linux-amd64-longtest-race": true, // Available as https://ci.chromium.org/p/golang/builders/ci/gotip-linux-amd64-longtest-race.
"linux-amd64-racecompile": true, // Available as https://ci.chromium.org/p/golang/builders/ci/gotip-linux-amd64-racecompile.
"linux-amd64-nocgo": true, // Available as https://ci.chromium.org/p/golang/builders/ci/gotip-linux-amd64-nocgo.
"linux-amd64-noopt": true, // Available as https://ci.chromium.org/p/golang/builders/ci/gotip-linux-amd64-noopt.
"linux-amd64-clang": true, // Available as https://ci.chromium.org/p/golang/builders/ci/gotip-linux-amd64-clang15 (a newer clang, but we won't be adding exactly -clang7 to LUCI by now).
"linux-amd64-goamd64v3": true, // Available as https://ci.chromium.org/p/golang/builders/ci/gotip-linux-amd64-goamd64v3.
"linux-amd64-boringcrypto": true, // Available as https://ci.chromium.org/p/golang/builders/ci/gotip-linux-amd64-boringcrypto.
"linux-amd64-ssacheck": true, // Available as https://ci.chromium.org/p/golang/builders/ci/gotip-linux-amd64-ssacheck.
"linux-amd64-staticlockranking": true, // Available as https://ci.chromium.org/p/golang/builders/ci/gotip-linux-amd64-staticlockranking.
"linux-amd64-newinliner": true, // Available as https://ci.chromium.org/p/golang/builders/ci/gotip-linux-amd64-newinliner.
"linux-arm64": true, // Available as https://ci.chromium.org/p/golang/builders/ci/gotip-linux-arm64.
"linux-arm64-longtest": true, // Available as https://ci.chromium.org/p/golang/builders/ci/gotip-linux-arm64-longtest.
"linux-arm64-race": true, // Available as https://ci.chromium.org/p/golang/builders/ci/gotip-linux-arm64-race.
"linux-arm64-boringcrypto": true, // Available as https://ci.chromium.org/p/golang/builders/ci/gotip-linux-arm64-boringcrypto.

// Windows builders.
"windows-386-2016": true, // Available as https://ci.chromium.org/p/golang/builders/ci/gotip-windows-386.
"windows-amd64-2016": true, // Available as https://ci.chromium.org/p/golang/builders/ci/gotip-windows-amd64.
"windows-amd64-longtest": true, // Available as https://ci.chromium.org/p/golang/builders/ci/gotip-windows-amd64-longtest.
"windows-amd64-race": true, // Available as https://ci.chromium.org/p/golang/builders/ci/gotip-windows-amd64-race.
"windows-arm64-11": true, // Available as https://ci.chromium.org/p/golang/builders/ci/gotip-windows-arm64.

"linux-riscv64-jsing": true, // Available as https://ci.chromium.org/p/golang/builders/ci/gotip-linux-riscv64.
"linux-riscv64-unmatched": true, // Available as https://ci.chromium.org/p/golang/builders/ci/gotip-linux-riscv64 (this builder is testing the same port as on the line above).

"linux-ppc64le-buildlet": true, // Available as https://ci.chromium.org/p/golang/builders/ci/gotip-linux-ppc64le_power8.
"linux-ppc64le-power9osu": true, // Available as https://ci.chromium.org/p/golang/builders/ci/gotip-linux-ppc64le_power9.
"linux-ppc64le-power10osu": true, // Available as https://ci.chromium.org/p/golang/builders/ci/gotip-linux-ppc64le_power10.
"linux-ppc64-sid-buildlet": true, // Available as https://ci.chromium.org/p/golang/builders/ci/gotip-linux-ppc64_power8.
"linux-ppc64-sid-power10": true, // Available as https://ci.chromium.org/p/golang/builders/ci/gotip-linux-ppc64_power10.
"linux-loong64-3a5000": true, // Available as https://ci.chromium.org/p/golang/builders/ci/gotip-linux-loong64.

"netbsd-arm64-bsiegert": true, // Available as https://ci.chromium.org/p/golang/builders/ci/gotip-netbsd-arm64.

"openbsd-amd64-72": true, // Available as https://ci.chromium.org/p/golang/builders/ci/gotip-openbsd-amd64.

"solaris-amd64-oraclerel": true, // Available as https://ci.chromium.org/p/golang/builders/ci/gotip-solaris-amd64.

// WebAssembly builders.
"js-wasm-node18": true, // Available as https://ci.chromium.org/p/golang/builders/ci/gotip-js-wasm.
"wasip1-wasm-wasmedge": true, // Would be 'wasip1-wasm_wasmedge' but put off until go.dev/issue/60097 picks up activity.
"wasip1-wasm-wasmer": true, // Would be 'wasip1-wasm_wasmer' but put off until go.dev/issue/59907 picks up activity.
"wasip1-wasm-wasmtime": true, // Available as https://ci.chromium.org/p/golang/builders/ci/gotip-wasip1-wasm_wasmtime.
"wasip1-wasm-wazero": true, // Available as https://ci.chromium.org/p/golang/builders/ci/gotip-wasip1-wasm_wazero.
}

// stopPortedBuilder reports whether the named ported builder should be stopped,
// instead of just made invisible in the web UI.
func stopPortedBuilder(builderName string) (stop bool) {
nameKeyList := []string{
"linux-loong64",
"linux-ppc64",
"-wasm-",
}

for _, key := range nameKeyList {
if strings.Contains(builderName, key) {
return true
}
}

return false
}

// addBuilder adds c to the Builders map after doing some checks.
func addBuilder(c BuildConfig) {
if c.Name == "" {
Expand Down Expand Up @@ -2988,7 +2898,7 @@ func addBuilder(c BuildConfig) {
panic(fmt.Sprintf("build config %q host type inconsistent (must be Reverse, Image, or VM)", c.Name))
}

if BuildersPortedToLUCI[c.Name] && stopPortedBuilder(c.Name) {
if migration.BuildersPortedToLUCI[c.Name] && migration.StopPortedBuilder(c.Name) {
c.buildsRepo = func(_, _, _ string) bool { return false }
c.Notes = "Unavailable in the coordinator. Use LUCI (https://go.dev/wiki/LUCI) instead."
}
Expand Down
4 changes: 3 additions & 1 deletion dashboard/builders_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ import (
"strings"
"testing"
"time"

"golang.org/x/build/internal/migration"
)

func TestOSARCHAccessors(t *testing.T) {
Expand Down Expand Up @@ -1239,7 +1241,7 @@ func TestHostsSort(t *testing.T) {
func TestBuildersPortedToLUCI(t *testing.T) {
// Check that map keys refer to builder names that exist,
// otherwise the entry is a no-op. Mostly to catch typos.
for name := range BuildersPortedToLUCI {
for name := range migration.BuildersPortedToLUCI {
if _, ok := Builders[name]; !ok {
t.Errorf("BuildersPortedToLUCI contains an unknown legacy builder name %v", name)
}
Expand Down
104 changes: 104 additions & 0 deletions internal/migration/migration.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
// Copyright 2024 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

// Package migration holds some knobs related to the migration from the
// now-legacy build infrastructure to the new LUCI build infrastructure.
package migration

import "strings"

const (
StopLegacyMiscCompileTryBots = false
)

// BuildersPortedToLUCI lists coordinator builders that have been ported
// over to LUCI and don't need to continue to run. Their results will be
// hidden from the build.golang.org page and new builds won't be started
// if StopPortedBuilder (below) returns true.
//
// See go.dev/issue/65913
// and go.dev/issue/63471.
var BuildersPortedToLUCI = map[string]bool{
// macOS builders.
"darwin-amd64-10_15": true, // Available as https://ci.chromium.org/p/golang/builders/ci/gotip-darwin-amd64_10.15.
"darwin-amd64-11_0": true, // Available as https://ci.chromium.org/p/golang/builders/ci/gotip-darwin-amd64_11.
"darwin-amd64-12_0": true, // Available as https://ci.chromium.org/p/golang/builders/ci/gotip-darwin-amd64_12.
"darwin-amd64-13": true, // Available as https://ci.chromium.org/p/golang/builders/ci/gotip-darwin-amd64_13.
"darwin-amd64-longtest": true, // Available as https://ci.chromium.org/p/golang/builders/ci/gotip-darwin-amd64-longtest.
"darwin-amd64-nocgo": true, // Available as https://ci.chromium.org/p/golang/builders/ci/gotip-darwin-amd64-nocgo.
"darwin-arm64-11": true, // Available as https://ci.chromium.org/p/golang/builders/ci/gotip-darwin-arm64_11.
"darwin-arm64-12": true, // Available as https://ci.chromium.org/p/golang/builders/ci/gotip-darwin-arm64_12.

// Linux builders (just those covering first-class ports).
"linux-386": true, // Available as https://ci.chromium.org/p/golang/builders/ci/gotip-linux-386.
"linux-386-longtest": true, // Available as https://ci.chromium.org/p/golang/builders/ci/gotip-linux-386-longtest.
"linux-386-clang": true, // Available as https://ci.chromium.org/p/golang/builders/ci/gotip-linux-386-clang15 (a newer clang, but we won't be adding exactly -clang7 to LUCI by now).
"linux-386-softfloat": true, // Available as https://ci.chromium.org/p/golang/builders/ci/gotip-linux-386-softfloat.
"linux-arm-aws": true, // Available as https://ci.chromium.org/p/golang/builders/ci/gotip-linux-arm.
"linux-amd64": true, // Available as https://ci.chromium.org/p/golang/builders/ci/gotip-linux-amd64.
"linux-amd64-longtest": true, // Available as https://ci.chromium.org/p/golang/builders/ci/gotip-linux-amd64-longtest.
"linux-amd64-race": true, // Available as https://ci.chromium.org/p/golang/builders/ci/gotip-linux-amd64-race.
"linux-amd64-longtest-race": true, // Available as https://ci.chromium.org/p/golang/builders/ci/gotip-linux-amd64-longtest-race.
"linux-amd64-racecompile": true, // Available as https://ci.chromium.org/p/golang/builders/ci/gotip-linux-amd64-racecompile.
"linux-amd64-nocgo": true, // Available as https://ci.chromium.org/p/golang/builders/ci/gotip-linux-amd64-nocgo.
"linux-amd64-noopt": true, // Available as https://ci.chromium.org/p/golang/builders/ci/gotip-linux-amd64-noopt.
"linux-amd64-clang": true, // Available as https://ci.chromium.org/p/golang/builders/ci/gotip-linux-amd64-clang15 (a newer clang, but we won't be adding exactly -clang7 to LUCI by now).
"linux-amd64-goamd64v3": true, // Available as https://ci.chromium.org/p/golang/builders/ci/gotip-linux-amd64-goamd64v3.
"linux-amd64-boringcrypto": true, // Available as https://ci.chromium.org/p/golang/builders/ci/gotip-linux-amd64-boringcrypto.
"linux-amd64-ssacheck": true, // Available as https://ci.chromium.org/p/golang/builders/ci/gotip-linux-amd64-ssacheck.
"linux-amd64-staticlockranking": true, // Available as https://ci.chromium.org/p/golang/builders/ci/gotip-linux-amd64-staticlockranking.
"linux-amd64-newinliner": true, // Available as https://ci.chromium.org/p/golang/builders/ci/gotip-linux-amd64-newinliner.
"linux-arm64": true, // Available as https://ci.chromium.org/p/golang/builders/ci/gotip-linux-arm64.
"linux-arm64-longtest": true, // Available as https://ci.chromium.org/p/golang/builders/ci/gotip-linux-arm64-longtest.
"linux-arm64-race": true, // Available as https://ci.chromium.org/p/golang/builders/ci/gotip-linux-arm64-race.
"linux-arm64-boringcrypto": true, // Available as https://ci.chromium.org/p/golang/builders/ci/gotip-linux-arm64-boringcrypto.

// Windows builders.
"windows-386-2016": true, // Available as https://ci.chromium.org/p/golang/builders/ci/gotip-windows-386.
"windows-amd64-2016": true, // Available as https://ci.chromium.org/p/golang/builders/ci/gotip-windows-amd64.
"windows-amd64-longtest": true, // Available as https://ci.chromium.org/p/golang/builders/ci/gotip-windows-amd64-longtest.
"windows-amd64-race": true, // Available as https://ci.chromium.org/p/golang/builders/ci/gotip-windows-amd64-race.
"windows-arm64-11": true, // Available as https://ci.chromium.org/p/golang/builders/ci/gotip-windows-arm64.

"linux-riscv64-jsing": true, // Available as https://ci.chromium.org/p/golang/builders/ci/gotip-linux-riscv64.
"linux-riscv64-unmatched": true, // Available as https://ci.chromium.org/p/golang/builders/ci/gotip-linux-riscv64 (this builder is testing the same port as on the line above).

"linux-ppc64le-buildlet": true, // Available as https://ci.chromium.org/p/golang/builders/ci/gotip-linux-ppc64le_power8.
"linux-ppc64le-power9osu": true, // Available as https://ci.chromium.org/p/golang/builders/ci/gotip-linux-ppc64le_power9.
"linux-ppc64le-power10osu": true, // Available as https://ci.chromium.org/p/golang/builders/ci/gotip-linux-ppc64le_power10.
"linux-ppc64-sid-buildlet": true, // Available as https://ci.chromium.org/p/golang/builders/ci/gotip-linux-ppc64_power8.
"linux-ppc64-sid-power10": true, // Available as https://ci.chromium.org/p/golang/builders/ci/gotip-linux-ppc64_power10.
"linux-loong64-3a5000": true, // Available as https://ci.chromium.org/p/golang/builders/ci/gotip-linux-loong64.

"netbsd-arm64-bsiegert": true, // Available as https://ci.chromium.org/p/golang/builders/ci/gotip-netbsd-arm64.

"openbsd-amd64-72": true, // Available as https://ci.chromium.org/p/golang/builders/ci/gotip-openbsd-amd64.

"solaris-amd64-oraclerel": true, // Available as https://ci.chromium.org/p/golang/builders/ci/gotip-solaris-amd64.

// WebAssembly builders.
"js-wasm-node18": true, // Available as https://ci.chromium.org/p/golang/builders/ci/gotip-js-wasm.
"wasip1-wasm-wasmedge": true, // Would be 'wasip1-wasm_wasmedge' but put off until go.dev/issue/60097 picks up activity.
"wasip1-wasm-wasmer": true, // Would be 'wasip1-wasm_wasmer' but put off until go.dev/issue/59907 picks up activity.
"wasip1-wasm-wasmtime": true, // Available as https://ci.chromium.org/p/golang/builders/ci/gotip-wasip1-wasm_wasmtime.
"wasip1-wasm-wazero": true, // Available as https://ci.chromium.org/p/golang/builders/ci/gotip-wasip1-wasm_wazero.
}

// StopPortedBuilder reports whether the named ported builder should be stopped,
// instead of just made invisible in the web UI.
func StopPortedBuilder(builderName string) (stop bool) {
nameKeyList := []string{
"linux-loong64",
"linux-ppc64",
"-wasm-",
}

for _, key := range nameKeyList {
if strings.Contains(builderName, key) {
return true
}
}

return false
}

0 comments on commit b70af65

Please sign in to comment.