From 4e93879b8f08b98b816e9486907d4130db38e339 Mon Sep 17 00:00:00 2001 From: Erik Nobel Date: Wed, 25 Nov 2020 01:53:47 +0200 Subject: [PATCH] [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 --- controllers/runner_controller.go | 14 ++++++++++++++ runner/Dockerfile | 5 +++-- runner/Makefile | 2 +- runner/entrypoint.sh | 3 +++ 4 files changed, 21 insertions(+), 3 deletions(-) diff --git a/controllers/runner_controller.go b/controllers/runner_controller.go index 7cd4c1c3..586bb682 100644 --- a/controllers/runner_controller.go +++ b/controllers/runner_controller.go @@ -382,12 +382,22 @@ func (r *RunnerReconciler) newPod(runner v1alpha1.Runner) (corev1.Pod, error) { EmptyDir: &corev1.EmptyDirVolumeSource{}, }, }, + { + Name: "externals", + VolumeSource: corev1.VolumeSource{ + EmptyDir: &corev1.EmptyDirVolumeSource{}, + }, + }, } pod.Spec.Containers[0].VolumeMounts = []corev1.VolumeMount{ { Name: "work", MountPath: "/runner/_work", }, + { + Name: "externals", + MountPath: "/runner/externals", + }, } pod.Spec.Containers[0].Env = append(pod.Spec.Containers[0].Env, corev1.EnvVar{ Name: "DOCKER_HOST", @@ -401,6 +411,10 @@ func (r *RunnerReconciler) newPod(runner v1alpha1.Runner) (corev1.Pod, error) { Name: "work", MountPath: "/runner/_work", }, + { + Name: "externals", + MountPath: "/runner/externals", + }, }, Env: []corev1.EnvVar{ { diff --git a/runner/Dockerfile b/runner/Dockerfile index 4a98c9d2..94318ea1 100644 --- a/runner/Dockerfile +++ b/runner/Dockerfile @@ -1,7 +1,7 @@ FROM ubuntu:18.04 ARG TARGETPLATFORM -ARG RUNNER_VERSION=2.274.1 +ARG RUNNER_VERSION=2.274.2 ARG DOCKER_VERSION=19.03.12 ENV DEBIAN_FRONTEND=noninteractive @@ -55,7 +55,7 @@ RUN export ARCH=$(echo ${TARGETPLATFORM} | cut -d / -f2) \ && usermod -aG docker runner \ && 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) \ && if [ "$ARCH" = "amd64" ]; then export ARCH=x64 ; fi \ && mkdir -p /runner \ @@ -64,6 +64,7 @@ RUN export ARCH=$(echo ${TARGETPLATFORM} | cut -d / -f2) \ && tar xzf ./runner.tar.gz \ && rm runner.tar.gz \ && ./bin/installdependencies.sh \ + && mv ./externals ./externalstmp \ && rm -rf /var/lib/apt/lists/* COPY entrypoint.sh /runner diff --git a/runner/Makefile b/runner/Makefile index 10d3e2f9..f6532105 100644 --- a/runner/Makefile +++ b/runner/Makefile @@ -2,7 +2,7 @@ NAME ?= summerwind/actions-runner DIND_RUNNER_NAME ?= ${NAME}-dind TAG ?= latest -RUNNER_VERSION ?= 2.273.5 +RUNNER_VERSION ?= 2.274.2 DOCKER_VERSION ?= 19.03.12 # default list of platforms for which multiarch image is built diff --git a/runner/entrypoint.sh b/runner/entrypoint.sh index 40da4db1..740849f0 100755 --- a/runner/entrypoint.sh +++ b/runner/entrypoint.sh @@ -43,6 +43,9 @@ fi cd /runner ./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 diff {bin,patched}/${f} || : sudo mv bin/${f}{,.bak}