Skip to content

Commit c31a5bb

Browse files
heschigopherbot
authored andcommitted
cmd/buildlet/stage0: add LUCI environment setup
Improve run-worker to successfully start up LUCI. It depends on sudo, so add it to all of our images. The resulting image is up and running as a LUCI worker, and debugnewvm on it also works fine. Change-Id: Ibcac4acf5f9849e5847ae926e333002108c08a0d Reviewed-on: https://go-review.googlesource.com/c/build/+/508866 Run-TryBot: Heschi Kreinick <[email protected]> Auto-Submit: Heschi Kreinick <[email protected]> Reviewed-by: Carlos Amedee <[email protected]> TryBot-Result: Gopher Robot <[email protected]>
1 parent e36eae9 commit c31a5bb

File tree

13 files changed

+34
-5
lines changed

13 files changed

+34
-5
lines changed

cmd/buildlet/stage0/run-worker.sh

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,27 @@
44
# license that can be found in the LICENSE file.
55

66
set -o pipefail
7+
8+
trap "exit 10" SIGUSR1
9+
710
project=$(curl -s -H "Metadata-Flavor: Google" http://metadata.google.internal/computeMetadata/v1/project/project-id)
811

9-
worker=stage0
10-
if [[ $project =~ "luci" ]]; then
11-
worker=bootstrapswarm
12+
if [[ ! $project =~ "luci" ]]; then
13+
exec $(dirname $0)/stage0
14+
fi
15+
16+
if ! id swarming >& /dev/null; then
17+
useradd -m swarming
1218
fi
13-
exec $(dirname $0)/$worker
19+
20+
echo "%swarming ALL = NOPASSWD: /sbin/shutdown" > /etc/sudoers.d/swarming
21+
echo -e '#!/bin/bash\nkill -SIGUSR1 1' > /sbin/shutdown
22+
chmod 0755 /sbin/shutdown
23+
24+
SWARM_DIR=/b/swarming
25+
mkdir -p $SWARM_DIR
26+
chown swarming:swarming $SWARM_DIR
27+
28+
su -c "$(dirname $0)/bootstrapswarm" swarming &
29+
wait %1
30+
exit $?

env/android-amd64-emu/Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ RUN apt-get update && apt-get install -y \
5050
openjdk-8-jdk \
5151
python \
5252
lib32z1 \
53+
sudo \
5354
&& rm -rf /var/lib/apt/lists/*
5455

5556
RUN mkdir -p /go1.4-amd64 \

env/crosscompile/linux-armel-cross/Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ RUN dpkg --add-architecture armel \
3232
procps \
3333
lsof \
3434
psmisc \
35+
sudo \
3536
--no-install-recommends \
3637
&& rm -rf /var/lib/apt/lists/*
3738

env/crosscompile/linux-armhf-cross/Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ RUN dpkg --add-architecture armhf \
3030
procps \
3131
lsof \
3232
psmisc \
33+
sudo \
3334
--no-install-recommends \
3435
&& rm -rf /var/lib/apt/lists/*
3536

env/crosscompile/linux-s390x-cross/Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ RUN apt-get update && apt-get install -y \
2929
procps \
3030
lsof \
3131
psmisc \
32+
sudo \
3233
--no-install-recommends \
3334
&& rm -rf /var/lib/apt/lists/*
3435

env/linux-x86-alpine/Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ RUN apk add --no-cache \
2828
make \
2929
openssh \
3030
procps \
31-
strace
31+
strace \
32+
sudo
3233

3334
RUN ssh-keygen -A
3435
RUN bash -c "(echo ChallengeResponseAuthentication no; echo PasswordAuthentication no; echo PermitRootLogin yes) > /etc/ssh/sshd_config"

env/linux-x86-bookworm/Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ RUN apt-get update && apt-get install -y \
5757
psmisc \
5858
strace \
5959
subversion \
60+
sudo \
6061
swig \
6162
&& rm -rf /var/lib/apt/lists/*
6263

env/linux-x86-bullseye/Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ RUN apt-get update && apt-get install -y \
5757
psmisc \
5858
strace \
5959
subversion \
60+
sudo \
6061
swig \
6162
&& rm -rf /var/lib/apt/lists/*
6263

env/linux-x86-buster/Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ RUN apt-get update && apt-get install -y \
3939
openssh-server \
4040
iptables \
4141
make \
42+
sudo \
4243
&& rm -rf /var/lib/apt/lists/*
4344

4445
RUN mkdir -p /go1.4-amd64 \

env/linux-x86-clang/Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ RUN apt-get update && apt-get install -y \
2929
openssh-server \
3030
netbase \
3131
make \
32+
sudo \
3233
&& rm -rf /var/lib/apt/lists/* \
3334
&& rm -f /usr/bin/gcc
3435

0 commit comments

Comments
 (0)