Skip to content

Commit cfe74c4

Browse files
committed
cmd/buildlet/stage0: enable GCP linux-arm64 builders
Stage0 has been configured to allow linux arm64 instances that are on GCP. The makefile that generates the instances was refactored to follow the model used by a the buildlet makefile refactor in CL 419992. Updates golang/go#53851 Change-Id: Iffe0829fc1ba1d863adcb3b73cde2c48d5d84c68 Reviewed-on: https://go-review.googlesource.com/c/build/+/447258 Run-TryBot: Carlos Amedee <[email protected]> TryBot-Result: Gopher Robot <[email protected]> Reviewed-by: Carlos Amedee <[email protected]> Reviewed-by: Heschi Kreinick <[email protected]>
1 parent db753b2 commit cfe74c4

File tree

2 files changed

+78
-54
lines changed

2 files changed

+78
-54
lines changed

cmd/buildlet/stage0/Makefile

Lines changed: 68 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -8,78 +8,92 @@
88
# the images actually do download the stage0 binary on start-up.
99
#
1010

11+
GO=go1.19
12+
13+
ALL=\
14+
buildlet-stage0.illumos-amd64 \
15+
buildlet-stage0.linux-arm \
16+
buildlet-stage0.linux-arm64 \
17+
buildlet-stage0.linux-loong64 \
18+
buildlet-stage0.linux-mips \
19+
buildlet-stage0.linux-mips64 \
20+
buildlet-stage0.linux-mips64le \
21+
buildlet-stage0.linux-mipsle \
22+
buildlet-stage0.linux-ppc64 \
23+
buildlet-stage0.linux-ppc64le \
24+
buildlet-stage0.linux-s390x \
25+
buildlet-stage0.solaris-amd64 \
26+
buildlet-stage0.windows-amd64 \
27+
buildlet-stage0.windows-arm64 \
28+
1129
usage: FORCE
12-
# See targets in Makefile
30+
@sed -E '/^$$/q; s/^# ?//' Makefile
1331
exit 1
1432

1533
FORCE:
1634

17-
docker: Dockerfile
18-
go install golang.org/x/build/cmd/xb
19-
xb docker build --force-rm -f Dockerfile --tag=golang/buildlet-stage0 ../../..
35+
# A convenience for people who are missing $(GO).
36+
install-go:
37+
go install golang.org/dl/$(GO)@latest
38+
$(GO) download
39+
40+
clean:
41+
rm -f buildlet-stage0.*-*
42+
43+
# Compile everything without uploading.
44+
compile: $(ALL)
2045

21-
buildlet-stage0.windows-amd64: FORCE
22-
go install golang.org/x/build/cmd/upload
23-
upload --verbose --osarch=$@ --file=go:golang.org/x/build/cmd/buildlet/stage0 --public --cacheable=false go-builder-data/$@
46+
GOFILES:=$(shell ls *.go)
2447

25-
buildlet-stage0.windows-arm64: FORCE
26-
go install golang.org/x/build/cmd/upload
27-
upload --verbose --osarch=$@ --file=go:golang.org/x/build/cmd/buildlet/stage0 --public --cacheable=false go-builder-data/$@
48+
BUILD=CGO_ENABLED=0 $(GO) build -o
2849

29-
buildlet-stage0.linux-arm: FORCE
30-
go install golang.org/x/build/cmd/upload
31-
upload --verbose --osarch=$@ --file=go:golang.org/x/build/cmd/buildlet/stage0 --public --cacheable=false go-builder-data/$@
50+
buildlet-stage0.%-arm: $(GOFILES)
51+
GOOS=$* GOARCH=arm GOARM=7 $(BUILD) $@
3252

33-
buildlet-stage0.linux-arm64: FORCE
34-
go install golang.org/x/build/cmd/upload
35-
upload --verbose --osarch=$@ --file=go:golang.org/x/build/cmd/buildlet/stage0 --public --cacheable=false go-builder-data/$@
53+
buildlet-stage0.%-arm64: $(GOFILES)
54+
GOOS=$* GOARCH=arm64 $(BUILD) $@
3655

37-
buildlet-stage0.linux-ppc64: FORCE
38-
go install golang.org/x/build/cmd/upload
39-
upload --verbose --osarch=$@ --file=go:golang.org/x/build/cmd/buildlet/stage0 --public --cacheable=false go-builder-data/$@
56+
buildlet-stage0.%-amd64: $(GOFILES)
57+
GOOS=$* GOARCH=amd64 $(BUILD) $@
4058

41-
buildlet-stage0.linux-ppc64le: FORCE
42-
go install golang.org/x/build/cmd/upload
43-
upload --verbose --osarch=$@ --file=go:golang.org/x/build/cmd/buildlet/stage0 --public --cacheable=false go-builder-data/$@
59+
buildlet-stage0.%-loong64: $(GOFILES)
60+
GOOS=$* GOARCH=loong64 $(BUILD) $@
4461

45-
buildlet-stage0.solaris-amd64: FORCE
46-
go install golang.org/x/build/cmd/upload
47-
upload --verbose --osarch=$@ --file=go:golang.org/x/build/cmd/buildlet/stage0 --public --cacheable=false go-builder-data/$@
62+
buildlet-stage0.%-mips: $(GOFILES)
63+
GOOS=$* GOARCH=mips $(BUILD) $@
4864

49-
buildlet-stage0.illumos-amd64: FORCE
50-
go install golang.org/x/build/cmd/upload
51-
upload --verbose --osarch=$@ --file=go:golang.org/x/build/cmd/buildlet/stage0 --public --cacheable=false go-builder-data/$@
65+
buildlet-stage0.%-mipsle: $(GOFILES)
66+
GOOS=$* GOARCH=mipsle $(BUILD) $@
5267

53-
buildlet-stage0.linux-s390x: FORCE
54-
go install golang.org/x/build/cmd/upload
55-
upload --verbose --osarch=$@ --file=go:golang.org/x/build/cmd/buildlet/stage0 --public --cacheable=false go-builder-data/$@
68+
buildlet-stage0.%-mips64: $(GOFILES)
69+
GOOS=$* GOARCH=mips64 $(BUILD) $@
5670

57-
buildlet-stage0.linux-mipsle: FORCE
58-
go install golang.org/x/build/cmd/upload
59-
upload --verbose --osarch=$@ --file=go:golang.org/x/build/cmd/buildlet/stage0 --public --cacheable=false go-builder-data/$@
71+
buildlet-stage0.%-mips64le: $(GOFILES)
72+
GOOS=$* GOARCH=mips64le $(BUILD) $@
6073

61-
buildlet-stage0.linux-mips64le: FORCE
62-
go install golang.org/x/build/cmd/upload
63-
upload --verbose --osarch=$@ --file=go:golang.org/x/build/cmd/buildlet/stage0 --public --cacheable=false go-builder-data/$@
74+
buildlet-stage0.%-ppc64: $(GOFILES)
75+
GOOS=$* GOARCH=ppc64 $(BUILD) $@
76+
77+
buildlet-stage0.%-ppc64le: $(GOFILES)
78+
GOOS=$* GOARCH=ppc64le $(BUILD) $@
79+
80+
buildlet-stage0.%-s390x: $(GOFILES)
81+
GOOS=$* GOARCH=s390x $(BUILD) $@
82+
83+
docker: Dockerfile
84+
go install golang.org/x/build/cmd/xb
85+
xb docker build --force-rm -f Dockerfile --tag=golang/buildlet-stage0 ../../..
6486

65-
buildlet-stage0.linux-mips: FORCE
66-
go install golang.org/x/build/cmd/upload
67-
upload --verbose --osarch=$@ --file=go:golang.org/x/build/cmd/buildlet/stage0 --public --cacheable=false go-builder-data/$@
87+
# Upload everything.
88+
upload: $(ALL:buildlet-stage0.%=upload.%)
6889

69-
buildlet-stage0.linux-mips64: FORCE
70-
go install golang.org/x/build/cmd/upload
71-
upload --verbose --osarch=$@ --file=go:golang.org/x/build/cmd/buildlet/stage0 --public --cacheable=false go-builder-data/$@
90+
UPLOAD=$(GO) run golang.org/x/build/cmd/upload -verbose -public -cacheable=false
7291

73-
buildlet-stage0.linux-loong64: FORCE
74-
go install golang.org/x/build/cmd/upload
75-
upload --verbose --osarch=$@ --file=go:golang.org/x/build/cmd/buildlet/stage0 --public --cacheable=false go-builder-data/$@
92+
upload.%: buildlet-stage0.%
93+
$(UPLOAD) -file=$< go-builder-data/$<
7694

77-
# macstadium uploads all the darwin-amd64 stage0 binary as
78-
# different filenames, which is used by different Mac VM images.
79-
# See the env/darwin/macstadium/** files for details.
80-
macstadium: run-builder-darwin-10_11.gz
95+
# Upload everything to dev cluster.
96+
dev-upload: $(ALL:buildlet-stage0.%=upload.%)
8197

82-
# run-builder-darwin-10_11.gz is used by both our macOS 10.11 and 10.12 VM images.
83-
run-builder-darwin-10_11.gz: FORCE
84-
go install golang.org/x/build/cmd/upload
85-
upload --verbose --osarch=darwin-amd64 --file=go:golang.org/x/build/cmd/buildlet/stage0 --public --cacheable=false --gzip go-builder-data/$@
98+
dev-upload.%: buildlet-stage0.%
99+
$(UPLOAD) -file=$< dev-go-builder-data/$<

cmd/buildlet/stage0/stage0.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ func main() {
6666
log.SetPrefix("stage0: ")
6767
flag.Parse()
6868

69+
onGCE := metadata.OnGCE()
6970
if *untarFile != "" {
7071
log.Printf("running in untar mode, untarring %q to %q", *untarFile, *untarDestDir)
7172
untarMode()
@@ -77,13 +78,19 @@ func main() {
7778
var isMacStadiumVM bool
7879
switch osArch {
7980
case "linux/arm":
81+
if onGCE {
82+
break
83+
}
8084
switch env := os.Getenv("GO_BUILDER_ENV"); env {
8185
case "host-linux-arm-aws":
8286
// No setup currently.
8387
default:
8488
panic(fmt.Sprintf("unknown/unspecified $GO_BUILDER_ENV value %q", env))
8589
}
8690
case "linux/arm64":
91+
if onGCE {
92+
break
93+
}
8794
switch env := os.Getenv("GO_BUILDER_ENV"); env {
8895
case "host-linux-arm64-aws":
8996
// No special setup.
@@ -181,6 +188,9 @@ Download:
181188
cmd.Args = append(cmd.Args, "--workdir=/data/golang/workdir")
182189
cmd.Args = append(cmd.Args, reverseHostTypeArgs("host-linux-s390x")...)
183190
case "linux/arm64":
191+
if onGCE {
192+
break
193+
}
184194
switch buildEnv {
185195
case "host-linux-arm64-aws":
186196
// no special configuration

0 commit comments

Comments
 (0)