[BUG?]: Create mountpoint for /externals/ (#203)

* runner/controller: Add externals directory mount point

* Runner: Create hack for moving content of /runner/externals/ dir

* Externals dir Mount: mount examples for '__e/node12/bin/node' not found error
This commit is contained in:
Erik Nobel 2020-11-25 01:53:47 +02:00 committed by GitHub
parent 6ce6737f61
commit 4e93879b8f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 21 additions and 3 deletions

View File

@ -382,12 +382,22 @@ func (r *RunnerReconciler) newPod(runner v1alpha1.Runner) (corev1.Pod, error) {
EmptyDir: &corev1.EmptyDirVolumeSource{}, EmptyDir: &corev1.EmptyDirVolumeSource{},
}, },
}, },
{
Name: "externals",
VolumeSource: corev1.VolumeSource{
EmptyDir: &corev1.EmptyDirVolumeSource{},
},
},
} }
pod.Spec.Containers[0].VolumeMounts = []corev1.VolumeMount{ pod.Spec.Containers[0].VolumeMounts = []corev1.VolumeMount{
{ {
Name: "work", Name: "work",
MountPath: "/runner/_work", MountPath: "/runner/_work",
}, },
{
Name: "externals",
MountPath: "/runner/externals",
},
} }
pod.Spec.Containers[0].Env = append(pod.Spec.Containers[0].Env, corev1.EnvVar{ pod.Spec.Containers[0].Env = append(pod.Spec.Containers[0].Env, corev1.EnvVar{
Name: "DOCKER_HOST", Name: "DOCKER_HOST",
@ -401,6 +411,10 @@ func (r *RunnerReconciler) newPod(runner v1alpha1.Runner) (corev1.Pod, error) {
Name: "work", Name: "work",
MountPath: "/runner/_work", MountPath: "/runner/_work",
}, },
{
Name: "externals",
MountPath: "/runner/externals",
},
}, },
Env: []corev1.EnvVar{ Env: []corev1.EnvVar{
{ {

View File

@ -1,7 +1,7 @@
FROM ubuntu:18.04 FROM ubuntu:18.04
ARG TARGETPLATFORM ARG TARGETPLATFORM
ARG RUNNER_VERSION=2.274.1 ARG RUNNER_VERSION=2.274.2
ARG DOCKER_VERSION=19.03.12 ARG DOCKER_VERSION=19.03.12
ENV DEBIAN_FRONTEND=noninteractive ENV DEBIAN_FRONTEND=noninteractive
@ -55,7 +55,7 @@ RUN export ARCH=$(echo ${TARGETPLATFORM} | cut -d / -f2) \
&& usermod -aG docker runner \ && usermod -aG docker runner \
&& echo "%sudo ALL=(ALL:ALL) NOPASSWD:ALL" > /etc/sudoers && echo "%sudo ALL=(ALL:ALL) NOPASSWD:ALL" > /etc/sudoers
# Runner download supports amd64 as x64 # Runner download supports amd64 as x64. Externalstmp is needed for making mount points work inside DinD.
RUN export ARCH=$(echo ${TARGETPLATFORM} | cut -d / -f2) \ RUN export ARCH=$(echo ${TARGETPLATFORM} | cut -d / -f2) \
&& if [ "$ARCH" = "amd64" ]; then export ARCH=x64 ; fi \ && if [ "$ARCH" = "amd64" ]; then export ARCH=x64 ; fi \
&& mkdir -p /runner \ && mkdir -p /runner \
@ -64,6 +64,7 @@ RUN export ARCH=$(echo ${TARGETPLATFORM} | cut -d / -f2) \
&& tar xzf ./runner.tar.gz \ && tar xzf ./runner.tar.gz \
&& rm runner.tar.gz \ && rm runner.tar.gz \
&& ./bin/installdependencies.sh \ && ./bin/installdependencies.sh \
&& mv ./externals ./externalstmp \
&& rm -rf /var/lib/apt/lists/* && rm -rf /var/lib/apt/lists/*
COPY entrypoint.sh /runner COPY entrypoint.sh /runner

View File

@ -2,7 +2,7 @@ NAME ?= summerwind/actions-runner
DIND_RUNNER_NAME ?= ${NAME}-dind DIND_RUNNER_NAME ?= ${NAME}-dind
TAG ?= latest TAG ?= latest
RUNNER_VERSION ?= 2.273.5 RUNNER_VERSION ?= 2.274.2
DOCKER_VERSION ?= 19.03.12 DOCKER_VERSION ?= 19.03.12
# default list of platforms for which multiarch image is built # default list of platforms for which multiarch image is built

View File

@ -43,6 +43,9 @@ fi
cd /runner cd /runner
./config.sh --unattended --replace --name "${RUNNER_NAME}" --url "${GITHUB_URL}${ATTACH}" --token "${RUNNER_TOKEN}" ${RUNNER_GROUP_ARG} ${LABEL_ARG} ./config.sh --unattended --replace --name "${RUNNER_NAME}" --url "${GITHUB_URL}${ATTACH}" --token "${RUNNER_TOKEN}" ${RUNNER_GROUP_ARG} ${LABEL_ARG}
# Hack due to the DinD volumes
mv ./externalstmp/* ./externals/
for f in runsvc.sh RunnerService.js; do for f in runsvc.sh RunnerService.js; do
diff {bin,patched}/${f} || : diff {bin,patched}/${f} || :
sudo mv bin/${f}{,.bak} sudo mv bin/${f}{,.bak}