From eca78eb366ba68ee99ae11d8bd8abd69b1aef4f6 Mon Sep 17 00:00:00 2001 From: Mikhail Goncharov Date: Wed, 22 Apr 2020 10:38:16 +0200 Subject: [PATCH] Add new deployment for agent that will do premerge checks maybe we will later use same agents for everything but for now I don't want to modify working build much. But I have updated deployment of release agent to use correct docker image (there were renamed a while ago) and pass tags and agent token via env variables. Have not deployed new deployment for release yet. --- .../agent-debian-testing-buildkite/Dockerfile | 8 +-- .../start_agent.sh | 3 +- kubernetes/buildkite/agents.yaml | 19 ++++--- kubernetes/buildkite/agents_premerge.yaml | 55 +++++++++++++++++++ 4 files changed, 70 insertions(+), 15 deletions(-) create mode 100644 kubernetes/buildkite/agents_premerge.yaml diff --git a/containers/agent-debian-testing-buildkite/Dockerfile b/containers/agent-debian-testing-buildkite/Dockerfile index ca6d630..b0b2053 100644 --- a/containers/agent-debian-testing-buildkite/Dockerfile +++ b/containers/agent-debian-testing-buildkite/Dockerfile @@ -45,9 +45,9 @@ ENV CCACHE_PATH=/mnt/disks/ssd0/ccache # configure locale RUN sed --in-place '/en_US.UTF-8/s/^#//' /etc/locale.gen ;\ locale-gen -ENV LANG en_US.UTF-8 -ENV LANGUAGE en_US:en -ENV LC_ALL en_US.UTF-8 +ENV LANG en_US.UTF-8 +ENV LANGUAGE en_US:en +ENV LC_ALL en_US.UTF-8 # buildkite RUN apt-get install -y apt-transport-https gnupg;\ @@ -56,7 +56,5 @@ RUN apt-get install -y apt-transport-https gnupg;\ apt-get update ;\ apt-get install -y buildkite-agent -VOLUME /credentials - CMD ["/scripts/start_agent.sh"] diff --git a/containers/agent-debian-testing-buildkite/start_agent.sh b/containers/agent-debian-testing-buildkite/start_agent.sh index 0b8e6c9..4c6181b 100755 --- a/containers/agent-debian-testing-buildkite/start_agent.sh +++ b/containers/agent-debian-testing-buildkite/start_agent.sh @@ -28,5 +28,4 @@ chown -R ${USER}:${USER} "${CCACHE_PATH}" # TODO(kuhnel): wipe the disk(s) on startup # start the buildkite agent -su buildkite-agent -c "buildkite-agent start --tags \"os=linux\" --build-path=/mnt/disks/ssd0/agent \ - --token `cat /credentials/buildkite-token`" \ No newline at end of file +su buildkite-agent -c "buildkite-agent start --build-path=/mnt/disks/ssd0/agent" \ No newline at end of file diff --git a/kubernetes/buildkite/agents.yaml b/kubernetes/buildkite/agents.yaml index 0f39853..d9d3e94 100644 --- a/kubernetes/buildkite/agents.yaml +++ b/kubernetes/buildkite/agents.yaml @@ -25,8 +25,8 @@ spec: app: agent-debian-testing-clang8-buildkite spec: containers: - - name: agent-debian-testing-clang8-buildkite - image: gcr.io/llvm-premerge-checks/agent-debian-testing-clang8-buildkite + - name: agent-debian-testing-buildkite + image: gcr.io/llvm-premerge-checks/agent-debian-testing-buildkite ports: - containerPort: 22 resources: @@ -39,16 +39,19 @@ spec: volumeMounts: - name: ssd mountPath: /mnt/disks/ssd0 - - name: credentials - mountPath: /credentials + env: + - name: BUILDKITE_AGENT_TOKEN + valueFrom: + secretKeyRef: + name: agent-token + key: token + - name: BUILDKITE_AGENT_TAGS + value: "queue=release,os=linux" volumes: - name: ssd hostPath: # directory location on host path: /mnt/disks/ssd0 - type: Directory - - name: credentials - secret: - secretName: buildkite-token + type: Directory nodeSelector: cloud.google.com/gke-nodepool: jenkins-agents \ No newline at end of file diff --git a/kubernetes/buildkite/agents_premerge.yaml b/kubernetes/buildkite/agents_premerge.yaml new file mode 100644 index 0000000..daa1488 --- /dev/null +++ b/kubernetes/buildkite/agents_premerge.yaml @@ -0,0 +1,55 @@ +# Copyright 2019 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. +# You may obtain a copy of the License at +# +# https://llvm.org/LICENSE.txt +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +apiVersion: extensions/v1beta1 +kind: Deployment +metadata: + name: agent-premerge-debian + namespace: buildkite +spec: + replicas: 1 + template: + metadata: + labels: + app: agent-premerge-debian + spec: + containers: + - name: agent-debian-testing-buildkite + image: gcr.io/llvm-premerge-checks/agent-debian-testing-buildkite + resources: + limits: + cpu: 30 + memory: 45Gi + requests: + cpu: 30 + memory: 45Gi + volumeMounts: + - name: ssd + mountPath: /mnt/disks/ssd0 + env: + - name: BUILDKITE_AGENT_TOKEN + valueFrom: + secretKeyRef: + name: agent-token + key: token + - name: BUILDKITE_AGENT_TAGS + value: "queue=premerge,os=linux" + volumes: + - name: ssd + hostPath: + # directory location on host + path: /mnt/disks/ssd0 + type: Directory + nodeSelector: + cloud.google.com/gke-nodepool: jenkins-agents \ No newline at end of file