ci: multiple ubuntu version (#2036)

* ci: prepare ci for multiple runners

* chore: rename dockerfiles

* chore: sup multiple os in makefile

* chore: changes to support multiple versions

* chore: remove test for TARGETPLATFORM

* chore: fixes and add individual targets

* ci: add latest tag back in

* ci: remove latest suffix tag

Co-authored-by: toast-gear <toast-gear@users.noreply.github.com>
This commit is contained in:
Callum Tait
2022-11-30 15:00:16 +00:00
committed by GitHub
parent 18077a1e83
commit 63d2cbfdaa
6 changed files with 99 additions and 34 deletions

View File

@@ -1,9 +1,9 @@
DOCKER_USER ?= summerwind
DOCKER ?= docker
NAME ?= ${DOCKER_USER}/actions-runner
DEFAULT_RUNNER_NAME ?= ${DOCKER_USER}/actions-runner
DIND_RUNNER_NAME ?= ${DOCKER_USER}/actions-runner-dind
DIND_ROOTLESS_RUNNER_NAME ?= ${DOCKER_USER}/actions-runner-dind-rootless
TAG ?= latest
OS_IMAGE ?= ubuntu-20.04
TARGETPLATFORM ?= $(shell arch)
RUNNER_VERSION ?= 2.299.1
@@ -39,33 +39,33 @@ else
$(error Supported target platforms: linux/amd64 and linux/arm64)
endif
docker-build-ubuntu: check-target-platform
docker-build-set: check-target-platform
${DOCKER} build \
--build-arg TARGETPLATFORM=${TARGETPLATFORM} \
--build-arg RUNNER_VERSION=${RUNNER_VERSION} \
--build-arg RUNNER_CONTAINER_HOOKS_VERSION=${RUNNER_CONTAINER_HOOKS_VERSION} \
--build-arg DOCKER_VERSION=${DOCKER_VERSION} \
-f actions-runner.dockerfile \
-t ${NAME}:${TAG} .
-f actions-runner.${OS_IMAGE}.dockerfile \
-t ${DEFAULT_RUNNER_NAME}:${OS_IMAGE} .
${DOCKER} build \
--build-arg TARGETPLATFORM=${TARGETPLATFORM} \
--build-arg RUNNER_VERSION=${RUNNER_VERSION} \
--build-arg DOCKER_VERSION=${DOCKER_VERSION} \
-f actions-runner-dind.dockerfile \
-t ${DIND_RUNNER_NAME}:${TAG} .
-f actions-runner-dind.${OS_IMAGE}.dockerfile \
-t ${DIND_RUNNER_NAME}:${OS_IMAGE} .
${DOCKER} build \
--build-arg TARGETPLATFORM=${TARGETPLATFORM} \
--build-arg RUNNER_VERSION=${RUNNER_VERSION} \
--build-arg DOCKER_VERSION=${DOCKER_VERSION} \
-f actions-runner-dind-rootless.dockerfile \
-t ${DIND_ROOTLESS_RUNNER_NAME}:${TAG} .
-f actions-runner-dind-rootless.${OS_IMAGE}.dockerfile \
-t "${DIND_ROOTLESS_RUNNER_NAME}:${OS_IMAGE}" .
docker-push-ubuntu:
${DOCKER} push ${NAME}:${TAG}
${DOCKER} push ${DIND_RUNNER_NAME}:${TAG}
${DOCKER} push ${DIND_ROOTLESS_RUNNER_NAME}:${TAG}
docker-push-set:
${DOCKER} push "${DEFAULT_RUNNER_NAME}:${OS_IMAGE}"
${DOCKER} push "${DIND_RUNNER_NAME}:${OS_IMAGE}"
${DOCKER} push "${DIND_ROOTLESS_RUNNER_NAME}:${OS_IMAGE}"
docker-buildx-ubuntu:
docker-buildx-set:
export DOCKER_CLI_EXPERIMENTAL=enabled ;\
export DOCKER_BUILDKIT=1
@if ! docker buildx ls | grep -q container-builder; then\
@@ -75,19 +75,62 @@ docker-buildx-ubuntu:
--build-arg RUNNER_VERSION=${RUNNER_VERSION} \
--build-arg RUNNER_CONTAINER_HOOKS_VERSION=${RUNNER_CONTAINER_HOOKS_VERSION} \
--build-arg DOCKER_VERSION=${DOCKER_VERSION} \
-f actions-runner.dockerfile \
-t "${NAME}:${TAG}" \
-f actions-runner.${OS_IMAGE}.dockerfile \
-t "${DEFAULT_RUNNER_NAME}:${OS_IMAGE}" \
. ${PUSH_ARG}
${DOCKER} buildx build --platform ${PLATFORMS} \
--build-arg RUNNER_VERSION=${RUNNER_VERSION} \
--build-arg RUNNER_CONTAINER_HOOKS_VERSION=${RUNNER_CONTAINER_HOOKS_VERSION} \
--build-arg DOCKER_VERSION=${DOCKER_VERSION} \
-f actions-runner-dind.dockerfile \
-t "${DIND_RUNNER_NAME}:${TAG}" \
-f actions-runner-dind.${OS_IMAGE}.dockerfile \
-t "${DIND_RUNNER_NAME}:${OS_IMAGE}" \
. ${PUSH_ARG}
${DOCKER} buildx build --platform ${PLATFORMS} \
--build-arg RUNNER_VERSION=${RUNNER_VERSION} \
--build-arg RUNNER_CONTAINER_HOOKS_VERSION=${RUNNER_CONTAINER_HOOKS_VERSION} \
--build-arg DOCKER_VERSION=${DOCKER_VERSION} \
-f actions-runner-dind-rootless.dockerfile \
-t "${DIND_ROOTLESS_RUNNER_NAME}:${TAG}" \
-f actions-runner-dind-rootless.${OS_IMAGE}.dockerfile \
-t "${DIND_ROOTLESS_RUNNER_NAME}:${OS_IMAGE}" \
. ${PUSH_ARG}
docker-buildx-default:
export DOCKER_CLI_EXPERIMENTAL=enabled ;\
export DOCKER_BUILDKIT=1
@if ! docker buildx ls | grep -q container-builder; then\
docker buildx create --platform ${PLATFORMS} --name container-builder --use;\
fi
${DOCKER} buildx build --platform ${PLATFORMS} \
--build-arg RUNNER_VERSION=${RUNNER_VERSION} \
--build-arg RUNNER_CONTAINER_HOOKS_VERSION=${RUNNER_CONTAINER_HOOKS_VERSION} \
--build-arg DOCKER_VERSION=${DOCKER_VERSION} \
-f actions-runner.${OS_IMAGE}.dockerfile \
-t "${DEFAULT_RUNNER_NAME}:${OS_IMAGE}" \
. ${PUSH_ARG}
docker-buildx-dind:
export DOCKER_CLI_EXPERIMENTAL=enabled ;\
export DOCKER_BUILDKIT=1
@if ! docker buildx ls | grep -q container-builder; then\
docker buildx create --platform ${PLATFORMS} --name container-builder --use;\
fi
${DOCKER} buildx build --platform ${PLATFORMS} \
--build-arg RUNNER_VERSION=${RUNNER_VERSION} \
--build-arg RUNNER_CONTAINER_HOOKS_VERSION=${RUNNER_CONTAINER_HOOKS_VERSION} \
--build-arg DOCKER_VERSION=${DOCKER_VERSION} \
-f actions-runner-dind.${OS_IMAGE}.dockerfile \
-t "${DIND_RUNNER_NAME}:${OS_IMAGE}" \
. ${PUSH_ARG}
docker-buildx-dind-rootless:
export DOCKER_CLI_EXPERIMENTAL=enabled ;\
export DOCKER_BUILDKIT=1
@if ! docker buildx ls | grep -q container-builder; then\
docker buildx create --platform ${PLATFORMS} --name container-builder --use;\
fi
${DOCKER} buildx build --platform ${PLATFORMS} \
--build-arg RUNNER_VERSION=${RUNNER_VERSION} \
--build-arg RUNNER_CONTAINER_HOOKS_VERSION=${RUNNER_CONTAINER_HOOKS_VERSION} \
--build-arg DOCKER_VERSION=${DOCKER_VERSION} \
-f actions-runner-dind-rootless.${OS_IMAGE}.dockerfile \
-t "${DIND_ROOTLESS_RUNNER_NAME}:${OS_IMAGE}" \
. ${PUSH_ARG}

View File

@@ -11,10 +11,8 @@ ARG DUMB_INIT_VERSION=1.2.5
# Other arguments
ARG DEBUG=false
RUN test -n "$TARGETPLATFORM" || (echo "TARGETPLATFORM must be set" && false)
ENV DEBIAN_FRONTEND=noninteractive
RUN apt update -y \
RUN apt-get update -y \
&& apt-get install -y software-properties-common \
&& add-apt-repository -y ppa:git-core/ppa \
&& apt-get update -y \

View File

@@ -9,10 +9,8 @@ ARG DOCKER_VERSION=20.10.18
ARG DOCKER_COMPOSE_VERSION=v2.6.0
ARG DUMB_INIT_VERSION=1.2.5
RUN test -n "$TARGETPLATFORM" || (echo "TARGETPLATFORM must be set" && false)
ENV DEBIAN_FRONTEND=noninteractive
RUN apt update -y \
RUN apt-get update -y \
&& apt-get install -y software-properties-common \
&& add-apt-repository -y ppa:git-core/ppa \
&& apt-get update -y \

View File

@@ -9,10 +9,8 @@ ARG DOCKER_VERSION=20.10.18
ARG DOCKER_COMPOSE_VERSION=v2.6.0
ARG DUMB_INIT_VERSION=1.2.5
RUN test -n "$TARGETPLATFORM" || (echo "TARGETPLATFORM must be set" && false)
ENV DEBIAN_FRONTEND=noninteractive
RUN apt update -y \
RUN apt-get update -y \
&& apt-get install -y software-properties-common \
&& add-apt-repository -y ppa:git-core/ppa \
&& apt-get update -y \

View File

@@ -172,5 +172,9 @@ unset RUNNER_NAME RUNNER_REPO RUNNER_TOKEN STARTUP_DELAY_IN_SECONDS DISABLE_WAIT
if [ -z "${UNITTEST:-}" ]; then
mapfile -t env </etc/environment
fi
log.notice "WARNING LATEST TAG HAS BEEN DEPRECATED. SEE GITHUB ISSUE FOR DETAILS:"
log.notice "https://github.com/actions-runner-controller/actions-runner-controller/issues/2056"
update-status "Idle"
exec env -- "${env[@]}" ./run.sh