Skip to content

Commit f142e55

Browse files
dmitshurgopherbot
authored andcommitted
dashboard, cmd/genbootstrap: update for Go 1.21.0 and beyond
Thanks to Go 1.21.0 offering binaries for all ports at go.dev/dl/, we won't really need genbootstrap anymore. Update dashboard to use those binaries for GoBootstrap versions 1.21.0 and beyond, and update genbootstrap to refuse to generate bootstraps when they aren't necessary, in case we forget and try to use it anyway. Make an exception for Windows. Change-Id: I75927406e44c7499b3e8a265fd58102cf3918f6f Reviewed-on: https://go-review.googlesource.com/c/build/+/520901 Reviewed-by: Heschi Kreinick <[email protected]> Auto-Submit: Dmitri Shuralyov <[email protected]> Run-TryBot: Dmitri Shuralyov <[email protected]> Reviewed-by: Dmitri Shuralyov <[email protected]> Reviewed-by: Carlos Amedee <[email protected]> TryBot-Result: Gopher Robot <[email protected]>
1 parent a35aa62 commit f142e55

File tree

2 files changed

+38
-4
lines changed

2 files changed

+38
-4
lines changed

cmd/genbootstrap/genbootstrap.go

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,12 @@ Usage:
1414
1515
The argument list can be a single glob pattern (for example '*'),
1616
which expands to all known targets matching that pattern.
17+
18+
Deprecated: As of Go 1.21.0, genbootstrap is superseded
19+
by make.bash -distpack and doesn't need to be used anymore.
20+
The one exception are GOOS=windows targets, since their
21+
go.dev/dl downloads are in .zip format but the builders
22+
in x/build support pushing .tar.gz format only.
1723
*/
1824
package main
1925

@@ -35,6 +41,7 @@ import (
3541
"cloud.google.com/go/storage"
3642
"golang.org/x/build/dashboard"
3743
"golang.org/x/build/internal/envutil"
44+
"golang.org/x/build/maintner/maintnerd/maintapi/version"
3845
)
3946

4047
var skipBuild = flag.String("skip_build", "", "skip bootstrap.bash and reuse output in `dir` instead")
@@ -72,11 +79,21 @@ func main() {
7279
log.Printf("expanded %s: %v", pattern, list)
7380
}
7481

82+
var nonWindowsTargets []string
7583
for _, pair := range list {
7684
f := strings.Split(pair, "-")
7785
if len(f) != 2 && len(f) != 3 {
7886
log.Fatalf("invalid target: %q", pair)
7987
}
88+
if goos := f[0]; goos != "windows" {
89+
nonWindowsTargets = append(nonWindowsTargets, pair)
90+
}
91+
}
92+
93+
if x, _ := version.Go1PointX(*rev); x >= 21 && len(nonWindowsTargets) > 0 {
94+
log.Fatalf("genbootstrap isn't needed to build Go 1.21.0 and newer bootstrap toolchains for %v, "+
95+
"they're already built with make.bash -distpack and made available at go.dev/dl for all ports "+
96+
"(GOOS=windows targets are permitted; builders need .tar.gz format so go.dev/dl can't be used as is)", nonWindowsTargets)
8097
}
8198

8299
dir, err := os.MkdirTemp("", "genbootstrap-*")

dashboard/builders.go

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,9 @@ var slowBotAliases = map[string]string{
121121
var Builders = map[string]*BuildConfig{}
122122

123123
// GoBootstrap is the bootstrap Go version.
124-
// Bootstrap Go builds with this name must be in the bucket,
124+
//
125+
// For bootstrap versions prior to Go 1.21.0,
126+
// bootstrap Go builds with this name must be in the buildlet bucket,
125127
// usually uploaded by 'genbootstrap -upload all'.
126128
const GoBootstrap = "go1.20.6"
127129

@@ -699,13 +701,16 @@ type HostConfig struct {
699701
HostArch string
700702

701703
// GoBootstrap is the version of Go to use for bootstrap.
702-
// A bootstrap toolchain built with that version must be in the bucket.
703704
// If unset, it is set in func init to GoBootstrap (the global constant).
704705
//
705706
// If GoBootstrap is set to "none", it means this buildlet is not given a new bootstrap
706707
// toolchain for each build, typically because it cannot download from
707708
// storage.googleapis.com.
708709
//
710+
// For bootstrap versions prior to Go 1.21.0,
711+
// a bootstrap toolchain built with that version must be in the buildlet bucket,
712+
// usually uploaded by 'genbootstrap -upload all'.
713+
//
709714
// (See the GoBootstrapURL method.)
710715
GoBootstrap string
711716

@@ -1034,8 +1039,20 @@ func (c *BuildConfig) GoBootstrapURL(e *buildenv.Environment) string {
10341039
if hc.GoBootstrap == "none" {
10351040
return ""
10361041
}
1037-
return "https://storage.googleapis.com/" + e.BuildletBucket +
1038-
"/gobootstrap-" + hc.HostArch + "-" + hc.GoBootstrap + ".tar.gz"
1042+
if x, ok := version.Go1PointX(hc.GoBootstrap); ok && x < 21 {
1043+
return "https://storage.googleapis.com/" + e.BuildletBucket +
1044+
"/gobootstrap-" + hc.HostArch + "-" + hc.GoBootstrap + ".tar.gz"
1045+
}
1046+
if c.GOOS() == "windows" {
1047+
// Can't use Windows downloads from go.dev/dl, they're in .zip
1048+
// format but the buildlet API accepts only the .tar.gz format.
1049+
//
1050+
// Since all this will be replaced by LUCI fairly soon,
1051+
// keep using the bootstrap bucket for Windows for now.
1052+
return "https://storage.googleapis.com/" + e.BuildletBucket +
1053+
"/gobootstrap-" + hc.HostArch + "-" + hc.GoBootstrap + ".tar.gz"
1054+
}
1055+
return "https://go.dev/dl/" + hc.GoBootstrap + "." + hc.HostArch + ".tar.gz"
10391056
}
10401057

10411058
// BuildletBinaryURL returns the public URL of this builder's buildlet.

0 commit comments

Comments
 (0)