зеркало из https://github.com/golang/build.git
env,cmd/buildlet/stage0: add bootstrapswarm to stage0 layer
We want to move our Docker-based builders over to LUCI. Rather than building a second set of images, add the LUCI bootstrap command to the stage0 layer, along with a script that selects which to run based on the GCE project ID. It's sort of silly to put this in cmd/buildlet, but I didn't want to make another image and then have to teach xb about it, or undertake a big yak shave to get rid of xb. Since the image is built from the root of the module it doesn't matter much. This doesn't do any of the necessary steps to make LUCI work once the bootstrap command runs. That'll come later. Change-Id: Iaa911cf86a9f52efd688836cfaa6f0e4a11ed884 Reviewed-on: https://go-review.googlesource.com/c/build/+/506876 Run-TryBot: Heschi Kreinick <heschi@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org> Reviewed-by: Carlos Amedee <carlos@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org> Auto-Submit: Heschi Kreinick <heschi@google.com>
This commit is contained in:
Родитель
269bac7eb2
Коммит
d91711000a
|
@ -20,9 +20,10 @@ RUN go install cloud.google.com/go/compute/metadata
|
|||
COPY . /go/src/golang.org/x/build/
|
||||
|
||||
# Install binary to /go/bin/stage0
|
||||
ENV CGO_ENABLED=0
|
||||
RUN go install golang.org/x/build/cmd/buildlet/stage0
|
||||
RUN CGO_ENABLED=0 go build -o /go/bin/stage0.static golang.org/x/build/cmd/buildlet/stage0
|
||||
RUN go install golang.org/x/build/cmd/bootstrapswarm
|
||||
|
||||
FROM golang:1.19
|
||||
COPY --from=build /go/bin/stage0 /go/bin/stage0
|
||||
COPY --from=build /go/bin/stage0.static /go/bin/stage0.static
|
||||
COPY --from=build /go/bin/* /go/bin/
|
||||
COPY cmd/buildlet/stage0/run-worker.sh /go/bin
|
|
@ -0,0 +1,13 @@
|
|||
#!/bin/bash -eux
|
||||
# Copyright 2023 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.
|
||||
|
||||
set -o pipefail
|
||||
project=$(curl -s -H "Metadata-Flavor: Google" http://metadata.google.internal/computeMetadata/v1/project/project-id)
|
||||
|
||||
worker=stage0
|
||||
if [[ $project =~ "luci" ]]; then
|
||||
worker=bootstrapswarm
|
||||
fi
|
||||
exec $(dirname $0)/$worker
|
|
@ -87,6 +87,6 @@ RUN echo no | /android/sdk/tools/bin/avdmanager create avd --force --name androi
|
|||
RUN mkdir /android/openal-headers
|
||||
RUN cp -a /usr/include/AL /android/openal-headers/
|
||||
|
||||
COPY --from=stage0 /go/bin/stage0 /usr/local/bin/stage0
|
||||
COPY --from=stage0 /go/bin/* /usr/local/bin/
|
||||
|
||||
CMD ["/usr/local/bin/stage0"]
|
||||
CMD ["/usr/local/bin/run-worker.sh"]
|
||||
|
|
|
@ -49,8 +49,8 @@ RUN mkdir -p /go1.4-amd64 \
|
|||
/go1.4/test \
|
||||
&& find /go1.4 -type d -name testdata | xargs rm -rf
|
||||
|
||||
COPY --from=stage0 /go/bin/stage0 /usr/local/bin/stage0
|
||||
COPY --from=stage0 /go/bin/* /usr/local/bin/
|
||||
|
||||
ENV GOROOT_BOOTSTRAP=/go1.4 GOOS=linux GOARCH=arm CC_FOR_TARGET=arm-linux-gnueabi-gcc
|
||||
|
||||
CMD ["/usr/local/bin/stage0"]
|
||||
CMD ["/usr/local/bin/run-worker.sh"]
|
||||
|
|
|
@ -47,8 +47,8 @@ RUN mkdir -p /go1.4-amd64 \
|
|||
/go1.4/test \
|
||||
&& find /go1.4 -type d -name testdata | xargs rm -rf
|
||||
|
||||
COPY --from=stage0 /go/bin/stage0 /usr/local/bin/stage0
|
||||
COPY --from=stage0 /go/bin/* /usr/local/bin/
|
||||
|
||||
ENV GOROOT_BOOTSTRAP=/go1.4 GOOS=linux GOARCH=arm CC_FOR_TARGET=arm-linux-gnueabihf-gcc
|
||||
|
||||
CMD ["/usr/local/bin/stage0"]
|
||||
CMD ["/usr/local/bin/run-worker.sh"]
|
||||
|
|
|
@ -46,8 +46,8 @@ RUN mkdir -p /go1.4-amd64 \
|
|||
/go1.4/test \
|
||||
&& find /go1.4 -type d -name testdata | xargs rm -rf
|
||||
|
||||
COPY --from=stage0 /go/bin/stage0 /usr/local/bin/stage0
|
||||
COPY --from=stage0 /go/bin/* /usr/local/bin/
|
||||
|
||||
ENV GOROOT_BOOTSTRAP=/go1.4 GOOS=linux GOARCH=s390x CC_FOR_TARGET=s390x-linux-gnu-gcc
|
||||
|
||||
CMD ["/usr/local/bin/stage0"]
|
||||
CMD ["/usr/local/bin/run-worker.sh"]
|
||||
|
|
|
@ -34,8 +34,8 @@ RUN ssh-keygen -A
|
|||
RUN bash -c "(echo ChallengeResponseAuthentication no; echo PasswordAuthentication no; echo PermitRootLogin yes) > /etc/ssh/sshd_config"
|
||||
RUN bash -c "passwd -u root || true" # might already be unlocked
|
||||
|
||||
COPY --from=stage0 /go/bin/stage0.static /usr/local/bin/stage0
|
||||
COPY --from=stage0 /go/bin/* /usr/local/bin/
|
||||
|
||||
ENV GOROOT_BOOTSTRAP=/usr/lib/go
|
||||
|
||||
CMD ["/usr/local/bin/stage0"]
|
||||
CMD ["/usr/local/bin/run-worker.sh"]
|
||||
|
|
|
@ -60,6 +60,6 @@ RUN apt-get update && apt-get install -y \
|
|||
swig \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
COPY --from=stage0 /go/bin/stage0 /usr/local/bin/stage0
|
||||
COPY --from=stage0 /go/bin/* /usr/local/bin/
|
||||
|
||||
CMD ["/usr/local/bin/stage0"]
|
||||
CMD ["/usr/local/bin/run-worker.sh"]
|
||||
|
|
|
@ -74,6 +74,6 @@ RUN mkdir -p /go1.4-amd64 \
|
|||
/go1.4/test \
|
||||
&& find /go1.4 -type d -name testdata | xargs rm -rf
|
||||
|
||||
COPY --from=stage0 /go/bin/stage0 /usr/local/bin/stage0
|
||||
COPY --from=stage0 /go/bin/* /usr/local/bin/
|
||||
|
||||
CMD ["/usr/local/bin/stage0"]
|
||||
CMD ["/usr/local/bin/run-worker.sh"]
|
||||
|
|
|
@ -55,6 +55,6 @@ RUN mkdir -p /go1.4-amd64 \
|
|||
/go1.4/test \
|
||||
&& find /go1.4 -type d -name testdata | xargs rm -rf
|
||||
|
||||
COPY --from=stage0 /go/bin/stage0 /usr/local/bin/stage0
|
||||
COPY --from=stage0 /go/bin/* /usr/local/bin/
|
||||
|
||||
CMD ["/usr/local/bin/stage0"]
|
||||
CMD ["/usr/local/bin/run-worker.sh"]
|
||||
|
|
|
@ -48,6 +48,6 @@ RUN mkdir -p /go1.4-amd64 \
|
|||
/go1.4/test \
|
||||
&& find /go1.4 -type d -name testdata | xargs rm -rf
|
||||
|
||||
COPY --from=stage0 /go/bin/stage0 /usr/local/bin/stage0
|
||||
COPY --from=stage0 /go/bin/* /usr/local/bin/
|
||||
|
||||
CMD ["/usr/local/bin/stage0"]
|
||||
CMD ["/usr/local/bin/run-worker.sh"]
|
||||
|
|
|
@ -35,6 +35,6 @@ RUN mkdir -p /goboot-amd64 \
|
|||
/goboot/test \
|
||||
&& find /goboot -type d -name testdata | xargs rm -rf
|
||||
|
||||
COPY --from=stage0 /go/bin/stage0 /usr/local/bin/stage0
|
||||
COPY --from=stage0 /go/bin/* /usr/local/bin/
|
||||
|
||||
CMD ["/usr/local/bin/stage0"]
|
||||
CMD ["/usr/local/bin/run-worker.sh"]
|
||||
|
|
|
@ -61,6 +61,6 @@ RUN mkdir -p /go1.4-amd64 \
|
|||
/go1.4/test \
|
||||
&& find /go1.4 -type d -name testdata | xargs rm -rf
|
||||
|
||||
COPY --from=stage0 /go/bin/stage0 /usr/local/bin/stage0
|
||||
COPY --from=stage0 /go/bin/* /usr/local/bin/
|
||||
|
||||
CMD ["/usr/local/bin/stage0"]
|
||||
CMD ["/usr/local/bin/run-worker.sh"]
|
||||
|
|
|
@ -62,7 +62,7 @@ RUN mkdir -p /go1.4-amd64 \
|
|||
/go1.4/test \
|
||||
&& find /go1.4 -type d -name testdata | xargs rm -rf
|
||||
|
||||
COPY --from=stage0 /go/bin/stage0 /usr/local/bin/stage0
|
||||
COPY --from=stage0 /go/bin/* /usr/local/bin/
|
||||
COPY --from=delvebuild /go/bin/dlv /usr/local/bin/dlv
|
||||
|
||||
CMD ["/usr/local/bin/stage0"]
|
||||
CMD ["/usr/local/bin/run-worker.sh"]
|
||||
|
|
Загрузка…
Ссылка в новой задаче