Skip to content

Commit 1327a79

Browse files
heschigopherbot
authored andcommitted
internal/task: use bootstrap Go to run releaselet
I have no idea how this ever worked. We know the ARM64 Windows machines can't run ARM32 binaries, which is why we don't have 32-bit builders on them. So how did building the releaselet with the ARM32 toolchain work until now? What changed? The mysteries of life. Change-Id: Ia8893047717ef9722727d0797fb351e0c314fb69 Reviewed-on: https://go-review.googlesource.com/c/build/+/531457 LUCI-TryBot-Result: Go LUCI <[email protected]> Auto-Submit: Heschi Kreinick <[email protected]> Reviewed-by: Robert Findley <[email protected]>
1 parent 69e47f4 commit 1327a79

File tree

2 files changed

+20
-8
lines changed

2 files changed

+20
-8
lines changed

internal/relui/buildrelease_test.go

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,20 @@ func TestSecurity(t *testing.T) {
6868
const fakeGo = `#!/bin/bash -eu
6969
7070
case "$1" in
71+
"run")
72+
case "$2" in
73+
"releaselet.go")
74+
# We're building an MSI. The command should be run in the gomote work dir.
75+
ls go/src/make.bash >/dev/null
76+
mkdir msi
77+
echo "I'm an MSI!" > msi/thisisanmsi.msi
78+
;;
79+
*)
80+
echo "unknown main file $2"
81+
exit 1
82+
;;
83+
esac
84+
;;
7185
"get")
7286
ls go.mod go.sum >/dev/null
7387
for i in "${@:2}"; do
@@ -507,12 +521,6 @@ mkdir -p $GO/bin
507521
cat <<'EOF' >$GO/bin/go
508522
#!/bin/bash -eu
509523
case "$@" in
510-
"run releaselet.go")
511-
# We're building an MSI. The command should be run in the gomote work dir.
512-
ls go/src/make.bash >/dev/null
513-
mkdir msi
514-
echo "I'm an MSI!" > msi/thisisanmsi.msi
515-
;;
516524
"install -race")
517525
# Installing the race mode stdlib. Doesn't matter where it's run.
518526
mkdir -p $(dirname $0)/../pkg/something_orother/
@@ -598,7 +606,7 @@ var goFiles = map[string]string{
598606

599607
func serveBootstrap(w http.ResponseWriter, r *http.Request) {
600608
task.ServeTarball("go-builder-data/go", map[string]string{
601-
"bin/go": "I'm a dummy bootstrap go command!",
609+
"bin/go": fakeGo,
602610
}, w, r)
603611
}
604612

internal/task/buildrelease.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -447,14 +447,18 @@ func (b *BuildletStep) ConvertPKGToTGZ(ctx *workflow.TaskContext, in io.Reader,
447447
var releaselet string
448448

449449
func (b *BuildletStep) BuildWindowsMSI(ctx *workflow.TaskContext, binaryArchive io.Reader, msi io.Writer) error {
450+
ctx.Printf("Installing bootstrap go")
451+
if err := b.Buildlet.PutTarFromURL(ctx, b.BuildConfig.GoBootstrapURL(buildenv.Production), "bootstrap_go"); err != nil {
452+
return err
453+
}
450454
if err := b.Buildlet.PutTar(ctx, binaryArchive, ""); err != nil {
451455
return err
452456
}
453457
ctx.Printf("Pushing and running releaselet.")
454458
if err := b.Buildlet.Put(ctx, strings.NewReader(releaselet), "releaselet.go", 0666); err != nil {
455459
return err
456460
}
457-
if err := b.runGo(ctx, []string{"run", "releaselet.go"}, buildlet.ExecOpts{
461+
if err := b.exec(ctx, "bootstrap_go/bin/go", []string{"run", "releaselet.go"}, buildlet.ExecOpts{
458462
Dir: ".", // root of buildlet work directory
459463
}); err != nil {
460464
ctx.Printf("releaselet failed: %v", err)

0 commit comments

Comments
 (0)