sample win deployment and github actions runner container
This commit is contained in:
parent
2312598990
commit
e5aee86500
3 changed files with 196 additions and 0 deletions
85
containers/github-runner/Dockerfile
Normal file
85
containers/github-runner/Dockerfile
Normal file
|
@ -0,0 +1,85 @@
|
|||
FROM ubuntu:latest
|
||||
|
||||
RUN echo 'intall packages'; \
|
||||
apt-get update; \
|
||||
apt-get upgrade; \
|
||||
apt-get install -y --no-install-recommends \
|
||||
gosu \
|
||||
locales openssh-client gnupg ca-certificates \
|
||||
zip wget curl git \
|
||||
gdb build-essential \
|
||||
ninja-build \
|
||||
libelf-dev libffi-dev gcc-multilib libmpfr-dev libpfm4-dev \
|
||||
# for llvm-libc tests that build mpfr and gmp from source
|
||||
autoconf automake libtool \
|
||||
python3 python3-psutil python3-pip python3-setuptools \
|
||||
lsb-release software-properties-common \
|
||||
swig python3-dev libedit-dev libncurses5-dev libxml2-dev liblzma-dev golang rsync jq \
|
||||
# for llvm installation script
|
||||
sudo \
|
||||
# build scripts
|
||||
nodejs \
|
||||
# shell users
|
||||
less vim
|
||||
|
||||
# debian stable cmake is 3.18, we need to install a more recent version.
|
||||
RUN wget --no-verbose -O /cmake.sh https://github.com/Kitware/CMake/releases/download/v3.23.3/cmake-3.23.3-linux-x86_64.sh; \
|
||||
chmod +x /cmake.sh; \
|
||||
mkdir -p /etc/cmake; \
|
||||
/cmake.sh --prefix=/etc/cmake --skip-license; \
|
||||
ln -s /etc/cmake/bin/cmake /usr/bin/cmake; \
|
||||
cmake --version; \
|
||||
rm /cmake.sh
|
||||
|
||||
# LLVM must be installed after prerequsite packages.
|
||||
ENV LLVM_VERSION=16
|
||||
RUN echo 'install llvm ${LLVM_VERSION}' && \
|
||||
wget --no-verbose https://apt.llvm.org/llvm.sh && \
|
||||
chmod +x llvm.sh && \
|
||||
./llvm.sh ${LLVM_VERSION} && \
|
||||
apt-get update && \
|
||||
apt-get install -y clang-${LLVM_VERSION} clang-format-${LLVM_VERSION} clang-tidy-${LLVM_VERSION} lld-${LLVM_VERSION} && \
|
||||
ln -s /usr/bin/clang-${LLVM_VERSION} /usr/bin/clang && \
|
||||
ln -s /usr/bin/clang++-${LLVM_VERSION} /usr/bin/clang++ && \
|
||||
ln -s /usr/bin/clang-tidy-${LLVM_VERSION} /usr/bin/clang-tidy && \
|
||||
ln -s /usr/bin/clang-tidy-diff-${LLVM_VERSION}.py /usr/bin/clang-tidy-diff && \
|
||||
ln -s /usr/bin/clang-format-${LLVM_VERSION} /usr/bin/clang-format && \
|
||||
ln -s /usr/bin/clang-format-diff-${LLVM_VERSION} /usr/bin/clang-format-diff && \
|
||||
ln -s /usr/bin/lld-${LLVM_VERSION} /usr/bin/lld && \
|
||||
ln -s /usr/bin/lldb-${LLVM_VERSION} /usr/bin/lldb && \
|
||||
ln -s /usr/bin/ld.lld-${LLVM_VERSION} /usr/bin/ld.lld && \
|
||||
clang --version
|
||||
|
||||
RUN echo 'configure locale' && \
|
||||
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
|
||||
|
||||
RUN curl -o sccache-v0.5.4-x86_64-unknown-linux-musl.tar.gz -L https://github.com/mozilla/sccache/releases/download/v0.5.4/sccache-v0.5.4-x86_64-unknown-linux-musl.tar.gz \
|
||||
&& echo "4bf3ce366aa02599019093584a5cbad4df783f8d6e3610548c2044daa595d40b sccache-v0.5.4-x86_64-unknown-linux-musl.tar.gz" | shasum -a 256 -c \
|
||||
&& tar xzf ./sccache-v0.5.4-x86_64-unknown-linux-musl.tar.gz \
|
||||
&& mv sccache-v0.5.4-x86_64-unknown-linux-musl/sccache /usr/bin \
|
||||
&& chown root:root /usr/bin/sccache \
|
||||
&& ls -la /usr/bin/sccache \
|
||||
&& sccache --version
|
||||
|
||||
WORKDIR /actions-runner
|
||||
|
||||
RUN cd /actions-runner \
|
||||
&& curl -o actions-runner-linux-x64-2.308.0.tar.gz -L https://github.com/actions/runner/releases/download/v2.308.0/actions-runner-linux-x64-2.308.0.tar.gz \
|
||||
&& echo "9f994158d49c5af39f57a65bf1438cbae4968aec1e4fec132dd7992ad57c74fa actions-runner-linux-x64-2.308.0.tar.gz" | shasum -a 256 -c \
|
||||
&& tar xzf ./actions-runner-linux-x64-2.308.0.tar.gz
|
||||
|
||||
RUN groupadd -g 121 runner \
|
||||
&& useradd -mr -d /home/runner -u 1001 -g 121 runner \
|
||||
&& mkdir -p /_work \
|
||||
&& chown -R runner:runner /_work /actions-runner;
|
||||
|
||||
COPY entrypoint.sh /
|
||||
RUN chmod +x /entrypoint.sh
|
||||
# try: USER runner instead of gosu
|
||||
ENTRYPOINT ["/entrypoint.sh"]
|
||||
|
||||
CMD ["./bin/Runner.Listener", "run", "--startuptype", "service"]
|
45
containers/github-runner/entrypoint.sh
Executable file
45
containers/github-runner/entrypoint.sh
Executable file
|
@ -0,0 +1,45 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# 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.
|
||||
# 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.
|
||||
set -eo pipefail
|
||||
|
||||
export PATH=${PATH}:/actions-runner
|
||||
|
||||
USER=runner
|
||||
RUNNER_WORKDIR="/_work"
|
||||
set -u
|
||||
|
||||
export SCCACHE_DIR="${RUNNER_WORKDIR}/sccache"
|
||||
mkdir -p "${SCCACHE_DIR}"
|
||||
chown -R ${USER}:${USER} "${SCCACHE_DIR}"
|
||||
chmod oug+rw "${SCCACHE_DIR}"
|
||||
gosu runner bash -c 'SCCACHE_DIR="${SCCACHE_DIR}" SCCACHE_IDLE_TIMEOUT=0 SCCACHE_CACHE_SIZE=20G sccache --start-server'
|
||||
sccache --show-stats
|
||||
_RUNNER_NAME=${RUNNER_NAME:-${RUNNER_NAME_PREFIX:-github-runner}-$(head /dev/urandom | tr -dc A-Za-z0-9 | head -c 13 ; echo '')}
|
||||
echo "Configuring"
|
||||
echo "runner URL" "${ACTION_RUNNER_URL}"
|
||||
echo "runner token" "${ACTION_RUNNER_TOKEN}"
|
||||
echo "runner name" "${_RUNNER_NAME}"
|
||||
gosu runner ./config.sh \
|
||||
--url "${ACTION_RUNNER_URL}" \
|
||||
--token "${ACTION_RUNNER_TOKEN}" \
|
||||
--name "${_RUNNER_NAME}" \
|
||||
--work "${RUNNER_WORKDIR}" \
|
||||
--labels "${ACTION_RUNNER_LABEL}" \
|
||||
--unattended \
|
||||
--replace
|
||||
|
||||
# exec /usr/bin/tini -g -- $@
|
||||
gosu runner "$@"
|
66
kubernetes/buildkite/windows-agents.yaml
Normal file
66
kubernetes/buildkite/windows-agents.yaml
Normal file
|
@ -0,0 +1,66 @@
|
|||
# Copyright 2022 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: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: test-windows-buildkite
|
||||
namespace: buildkite
|
||||
spec:
|
||||
replicas: 1
|
||||
strategy:
|
||||
type: Recreate
|
||||
selector:
|
||||
matchLabels:
|
||||
app: test-windows-buildkite
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: test-windows-buildkite
|
||||
spec:
|
||||
containers:
|
||||
- name: buildkite-premerge-windows
|
||||
image: gcr.io/llvm-premerge-checks/buildkite-premerge-windows:latest
|
||||
resources:
|
||||
limits:
|
||||
cpu: 110
|
||||
memory: 420Gi
|
||||
requests:
|
||||
cpu: 110
|
||||
memory: 420Gi
|
||||
env:
|
||||
- name: buildkiteAgentToken
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: buildkite-agent-token
|
||||
key: token
|
||||
- name: POD_NAME
|
||||
valueFrom:
|
||||
fieldRef:
|
||||
fieldPath: metadata.name
|
||||
- name: BUILDKITE_AGENT_TAGS
|
||||
value: "queue=windows-test-pr,name=$(POD_NAME),cluster=google"
|
||||
- name: BUILDKITE_API_TOKEN
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: buildkite-api-token-readonly
|
||||
key: token
|
||||
nodeSelector:
|
||||
cloud.google.com/gke-nodepool: linux-big
|
||||
tolerations:
|
||||
- key: "node.kubernetes.io/os"
|
||||
operator: "Equal"
|
||||
value: "windows"
|
||||
effect: "NoSchedule"
|
||||
terminationGracePeriodSeconds: 60
|
Loading…
Reference in a new issue