From 1b603e884a9164d62926759af09c52ec65957c80 Mon Sep 17 00:00:00 2001 From: Mikhail Goncharov Date: Sat, 15 May 2021 10:58:23 +0200 Subject: [PATCH] migrage linux-agents to a new pool --- containers/buildkite-premerge-debian/Dockerfile | 4 ++-- .../buildkite-premerge-debian/entrypoint.sh | 9 +++++---- kubernetes/buildkite/linux-agents-test.yaml | 15 ++++----------- kubernetes/buildkite/linux-agents.yaml | 13 +++---------- 4 files changed, 14 insertions(+), 27 deletions(-) diff --git a/containers/buildkite-premerge-debian/Dockerfile b/containers/buildkite-premerge-debian/Dockerfile index f22134d..675a07b 100644 --- a/containers/buildkite-premerge-debian/Dockerfile +++ b/containers/buildkite-premerge-debian/Dockerfile @@ -5,11 +5,11 @@ RUN echo 'install buildkite' ;\ sh -c 'echo deb https://apt.buildkite.com/buildkite-agent stable main > /etc/apt/sources.list.d/buildkite-agent.list' ;\ apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 32A37959C2FA5C3C99EFBC32A79206696452D198 ;\ apt-get update ;\ - apt-get install -y buildkite-agent tini; \ + apt-get install -y buildkite-agent tini gosu; \ apt-get clean; COPY *.sh /usr/local/bin/ RUN chmod og+rx /usr/local/bin/*.sh COPY --chown=buildkite-agent:buildkite-agent pre-checkout /etc/buildkite-agent/hooks ENTRYPOINT ["entrypoint.sh"] -CMD ["buildkite-agent", "start", "--no-color"] \ No newline at end of file +CMD ["gosu", "buildkite-agent", "buildkite-agent", "start", "--no-color"] \ No newline at end of file diff --git a/containers/buildkite-premerge-debian/entrypoint.sh b/containers/buildkite-premerge-debian/entrypoint.sh index 9be6285..222c99d 100755 --- a/containers/buildkite-premerge-debian/entrypoint.sh +++ b/containers/buildkite-premerge-debian/entrypoint.sh @@ -25,8 +25,9 @@ mkdir -p "${CCACHE_DIR}" chown -R ${USER}:${USER} "${CCACHE_DIR}" # /mnt/ssh should contain known_hosts, id_rsa and id_rsa.pub . -mkdir -p ~/.ssh -chmod 700 ~/.ssh -cp /mnt/ssh/* ~/.ssh -chmod 600 ~/.ssh/* +mkdir -p /var/lib/buildkite-agent/.ssh +cp /mnt/ssh/* /var/lib/buildkite-agent/.ssh +chmod 700 /var/lib/buildkite-agent/.ssh +chmod 600 /var/lib/buildkite-agent/.ssh/* +chown -R buildkite-agent:buildkite-agent /var/lib/buildkite-agent/.ssh/ exec /usr/bin/tini -g -- $@ \ No newline at end of file diff --git a/kubernetes/buildkite/linux-agents-test.yaml b/kubernetes/buildkite/linux-agents-test.yaml index b382d00..30ac3e7 100644 --- a/kubernetes/buildkite/linux-agents-test.yaml +++ b/kubernetes/buildkite/linux-agents-test.yaml @@ -32,14 +32,12 @@ spec: image: gcr.io/llvm-premerge-checks/buildkite-premerge-debian:latest resources: limits: - cpu: 15 + cpu: 30 memory: 50Gi requests: - cpu: 15 + cpu: 30 memory: 50Gi volumeMounts: - - name: ssd - mountPath: /mnt/disks/ssd0 - name: github-ssh mountPath: /mnt/ssh env: @@ -55,7 +53,7 @@ spec: - name: BUILDKITE_AGENT_TAGS value: "queue=linux-test,name=$(POD_NAME)" - name: BUILDKITE_BUILD_PATH - value: "/mnt/disks/ssd0/agent" + value: "/var/lib/buildkite-agent/builds" - name: CONDUIT_TOKEN valueFrom: secretKeyRef: @@ -67,14 +65,9 @@ spec: name: buildkite-api-token-readonly key: token volumes: - - name: ssd - hostPath: - # directory location on host - path: /mnt/disks/ssd0 - type: Directory - name: github-ssh secret: secretName: github-ssh nodeSelector: - cloud.google.com/gke-nodepool: linux-agents + cloud.google.com/gke-nodepool: linux-agents-2 terminationGracePeriodSeconds: 3600 \ No newline at end of file diff --git a/kubernetes/buildkite/linux-agents.yaml b/kubernetes/buildkite/linux-agents.yaml index 9c42af3..07249c2 100644 --- a/kubernetes/buildkite/linux-agents.yaml +++ b/kubernetes/buildkite/linux-agents.yaml @@ -1,4 +1,4 @@ -# Copyright 2019 Google LLC +# Copyright 2021 Google LLC # # Licensed under the the Apache License v2.0 with LLVM Exceptions (the "License"); # you may not use this file except in compliance with the License. @@ -43,8 +43,6 @@ spec: cpu: 30 memory: 80Gi volumeMounts: - - name: ssd - mountPath: /mnt/disks/ssd0 - name: github-ssh mountPath: /mnt/ssh env: @@ -60,7 +58,7 @@ spec: - name: BUILDKITE_AGENT_TAGS value: "queue=linux,name=$(POD_NAME)" - name: BUILDKITE_BUILD_PATH - value: "/mnt/disks/ssd0/agent" + value: "/var/lib/buildkite-agent/builds" - name: CONDUIT_TOKEN valueFrom: secretKeyRef: @@ -72,14 +70,9 @@ spec: name: buildkite-api-token-readonly key: token volumes: - - name: ssd - hostPath: - # directory location on host - path: /mnt/disks/ssd0 - type: Directory - name: github-ssh secret: secretName: github-ssh nodeSelector: - cloud.google.com/gke-nodepool: linux-agents + cloud.google.com/gke-nodepool: linux-agents-2 terminationGracePeriodSeconds: 3600 \ No newline at end of file