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:
parent
18077a1e83
commit
63d2cbfdaa
|
|
@ -44,12 +44,15 @@ jobs:
|
|||
- name: actions-runner
|
||||
os-name: ubuntu
|
||||
os-version: 20.04
|
||||
latest: "true"
|
||||
- name: actions-runner-dind
|
||||
os-name: ubuntu
|
||||
os-version: 20.04
|
||||
latest: "true"
|
||||
- name: actions-runner-dind-rootless
|
||||
os-name: ubuntu
|
||||
os-version: 20.04
|
||||
latest: "true"
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
|
|
@ -67,7 +70,7 @@ jobs:
|
|||
uses: docker/build-push-action@v3
|
||||
with:
|
||||
context: ./runner
|
||||
file: ./runner/${{ matrix.name }}.dockerfile
|
||||
file: ./runner/${{ matrix.name }}.${{ matrix.os-name }}-${{ matrix.os-version }}.dockerfile
|
||||
platforms: linux/amd64,linux/arm64
|
||||
push: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
|
||||
build-args: |
|
||||
|
|
@ -77,9 +80,30 @@ jobs:
|
|||
tags: |
|
||||
${{ env.DOCKERHUB_USERNAME }}/${{ matrix.name }}:v${{ env.RUNNER_VERSION }}-${{ matrix.os-name }}-${{ matrix.os-version }}
|
||||
${{ env.DOCKERHUB_USERNAME }}/${{ matrix.name }}:v${{ env.RUNNER_VERSION }}-${{ matrix.os-name }}-${{ matrix.os-version }}-${{ env.sha_short }}
|
||||
${{ env.DOCKERHUB_USERNAME }}/${{ matrix.name }}:latest
|
||||
ghcr.io/${{ github.repository }}/${{ matrix.name }}:latest
|
||||
${{ env.DOCKERHUB_USERNAME }}/${{ matrix.name }}:${{ matrix.os-name }}-${{ matrix.os-version }}
|
||||
ghcr.io/${{ github.repository }}/${{ matrix.name }}:v${{ env.RUNNER_VERSION }}-${{ matrix.os-name }}-${{ matrix.os-version }}
|
||||
ghcr.io/${{ github.repository }}/${{ matrix.name }}:v${{ env.RUNNER_VERSION }}-${{ matrix.os-name }}-${{ matrix.os-version }}-${{ env.sha_short }}
|
||||
cache-from: type=gha,scope=build-${{ matrix.name }}
|
||||
cache-to: type=gha,mode=max,scope=build-${{ matrix.name }}
|
||||
ghcr.io/${{ github.repository }}/${{ matrix.name }}:${{ matrix.os-name }}-${{ matrix.os-version }}
|
||||
cache-from: type=gha,scope=build-${{ matrix.name }}-${{ matrix.os-name }}-${{ matrix.os-version }}
|
||||
cache-to: type=gha,mode=max,scope=build-${{ matrix.name }}-${{ matrix.os-name }}-${{ matrix.os-version }}
|
||||
|
||||
# NOTE : Only to be used on the 20.04 image until we remove the latest tag entirely
|
||||
# at which point this step needs to be deleted
|
||||
# https://github.com/actions-runner-controller/actions-runner-controller/issues/2056
|
||||
- name: Build and Push Latest Tags
|
||||
id: ${{ matrix.latest == "true" }}
|
||||
uses: docker/build-push-action@v3
|
||||
with:
|
||||
context: ./runner
|
||||
file: ./runner/${{ matrix.name }}.${{ matrix.os-name }}-${{ matrix.os-version }}.dockerfile
|
||||
platforms: linux/amd64,linux/arm64
|
||||
push: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
|
||||
build-args: |
|
||||
RUNNER_VERSION=${{ env.RUNNER_VERSION }}
|
||||
DOCKER_VERSION=${{ env.DOCKER_VERSION }}
|
||||
RUNNER_CONTAINER_HOOKS_VERSION=${{ env.RUNNER_CONTAINER_HOOKS_VERSION }}
|
||||
tags: |
|
||||
${{ env.DOCKERHUB_USERNAME }}/${{ matrix.name }}:latest
|
||||
ghcr.io/${{ github.repository }}/${{ matrix.name }}:latest
|
||||
cache-from: type=gha,scope=build-${{ matrix.name }}-${{ matrix.os-name }}-${{ matrix.os-version }}
|
||||
cache-to: type=gha,mode=max,scope=build-${{ matrix.name }}-${{ matrix.os-name }}-${{ matrix.os-version }}
|
||||
|
|
|
|||
|
|
@ -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}
|
||||
|
|
|
|||
|
|
@ -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 \
|
||||
|
|
@ -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 \
|
||||
|
|
@ -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 \
|
||||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in New Issue