From 9ee22a88c9e738d302346b2eddcfcf201ad1dab8 Mon Sep 17 00:00:00 2001 From: Mikhail Goncharov Date: Wed, 4 Oct 2023 13:35:05 +0200 Subject: [PATCH] buildbot agents --- containers/buildbot-linux/Dockerfile | 7 +++--- containers/buildbot-linux/entrypoint.sh | 8 ++++++ containers/buildbot-windows/Dockerfile | 3 ++- containers/buildbot-windows/entrypoint.sh | 5 ++++ containers/buildbot-windows/start_agent.ps1 | 2 +- .../buildbot/{linux-test.yaml => linux.yaml} | 25 +++++++++++++------ .../{windows-test.yaml => windows.yaml} | 0 7 files changed, 36 insertions(+), 14 deletions(-) create mode 100644 containers/buildbot-windows/entrypoint.sh rename kubernetes/buildbot/{linux-test.yaml => linux.yaml} (70%) rename kubernetes/buildbot/{windows-test.yaml => windows.yaml} (100%) diff --git a/containers/buildbot-linux/Dockerfile b/containers/buildbot-linux/Dockerfile index a016f94..64ebae3 100644 --- a/containers/buildbot-linux/Dockerfile +++ b/containers/buildbot-linux/Dockerfile @@ -83,8 +83,7 @@ RUN groupadd -g 121 runner \ && mkdir -p /build \ && chown -R runner:runner /build; - - ENTRYPOINT ["entrypoint.sh"] -CMD ["gosu", "runner", "sleep", "infinity"] - +# Buildbot worker was started in the background by entrypoint, here we simply +# wait to keep pod running. +CMD ["sleep", "infinity"] diff --git a/containers/buildbot-linux/entrypoint.sh b/containers/buildbot-linux/entrypoint.sh index 33f9b7e..dc9598e 100755 --- a/containers/buildbot-linux/entrypoint.sh +++ b/containers/buildbot-linux/entrypoint.sh @@ -33,5 +33,13 @@ chown -R ${USER}:${USER} "${SCCACHE_DIR}" chmod oug+rw "${SCCACHE_DIR}" gosu "$USER" bash -c 'SCCACHE_DIR="${SCCACHE_DIR}" SCCACHE_IDLE_TIMEOUT=0 SCCACHE_CACHE_SIZE=20G sccache --start-server' +# configure buildbot +mkdir -p /build/buildbot +buildbot-worker create-worker /build/buildbot $BUILDBOT_ADDRESS $BUILDBOT_NAME $BUILDBOT_PASSWORD +# TODO: update buildbot information. +chown -R ${USER}:${USER} /build/buildbot + +gosu "$USER" bash -c 'CC=clang CXX=clang++ LD=LLD buildbot-worker start /build/buildbot' + # Run with tini to correctly pass exit codes. exec /usr/bin/tini -g -- $@ diff --git a/containers/buildbot-windows/Dockerfile b/containers/buildbot-windows/Dockerfile index b4d5d64..5e6c919 100644 --- a/containers/buildbot-windows/Dockerfile +++ b/containers/buildbot-windows/Dockerfile @@ -114,6 +114,7 @@ RUN choco install -y handle RUN pip3 install buildbot-worker==2.8.4 -COPY start_agent.ps1 c:\scripts\ +# COPY start_agent.ps1 c:\scripts\ COPY start.sh c:\scripts\ +ENTRYPOINT ["bash", "entrypoint.sh"] CMD ["bash", "C:\\scripts\\start.sh"] \ No newline at end of file diff --git a/containers/buildbot-windows/entrypoint.sh b/containers/buildbot-windows/entrypoint.sh new file mode 100644 index 0000000..7f3a402 --- /dev/null +++ b/containers/buildbot-windows/entrypoint.sh @@ -0,0 +1,5 @@ +echo "buildbot windows entrypoint" + +mkdir -p /c/ws/buildbbot + +$@ \ No newline at end of file diff --git a/containers/buildbot-windows/start_agent.ps1 b/containers/buildbot-windows/start_agent.ps1 index 95bbe0f..1b6bbe9 100644 --- a/containers/buildbot-windows/start_agent.ps1 +++ b/containers/buildbot-windows/start_agent.ps1 @@ -7,4 +7,4 @@ $env:SCCACHE_IDLE_TIMEOUT="0" Remove-Item -Recurse -Force -ErrorAction Ignore $env:SCCACHE_DIR sccache --start-server -bash -c 'whoami && tail -f' \ No newline at end of file +bash -c 'whoami && sheep infinity' \ No newline at end of file diff --git a/kubernetes/buildbot/linux-test.yaml b/kubernetes/buildbot/linux.yaml similarity index 70% rename from kubernetes/buildbot/linux-test.yaml rename to kubernetes/buildbot/linux.yaml index 778912f..54aac5a 100644 --- a/kubernetes/buildbot/linux-test.yaml +++ b/kubernetes/buildbot/linux.yaml @@ -15,7 +15,7 @@ apiVersion: apps/v1 kind: Deployment metadata: - name: buildbot-linux-test + name: buildbot-linux spec: replicas: 1 strategy: @@ -25,22 +25,22 @@ spec: type: RollingUpdate selector: matchLabels: - app: buildbot-linux-test + app: buildbot-linux template: metadata: labels: - app: buildbot-linux-test + app: buildbot-linux spec: containers: - name: runner image: gcr.io/llvm-premerge-checks/buildbot-linux:latest resources: limits: - cpu: 31 - memory: 80Gi + cpu: 55 + memory: 200Gi requests: - cpu: 31 - memory: 80Gi + cpu: 55 + memory: 200Gi volumeMounts: - name: workdir mountPath: /build @@ -49,9 +49,18 @@ spec: valueFrom: fieldRef: fieldPath: metadata.name + - name: BUILDBOT_PASSWORD + valueFrom: + secretKeyRef: + name: buildbot-premerge-linux-1 + key: password + - name: BUILDBOT_NAME + value: premerge-linux-1 + - name: BUILDBOT_ADDRESS + value: lab.llvm.org:9994 volumes: - name: workdir emptyDir: {} nodeSelector: - cloud.google.com/gke-nodepool: linux-agents-2 + cloud.google.com/gke-nodepool: linux-56 terminationGracePeriodSeconds: 30 diff --git a/kubernetes/buildbot/windows-test.yaml b/kubernetes/buildbot/windows.yaml similarity index 100% rename from kubernetes/buildbot/windows-test.yaml rename to kubernetes/buildbot/windows.yaml