Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: multiple ubuntu version #2036

Merged
merged 9 commits into from
Nov 30, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 29 additions & 5 deletions .github/workflows/runners.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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: |
Expand All @@ -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
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe it's not easy, but can we add another pipeline to keep publishing latest, that points to the latest ubuntu 20.04 image for a while and will eventually get updated to 22.04 in the near future?

Without that another pipeline, we end up immediately stopping updates to the latest image, which many folks seem to be using today, and those folks would end up seeing a lot of runner auto updates triggered before their runners within runner pods get up and running, which will trigger a storm of questions and bug reports...

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will eventually get updated to 22.04 in the near future?

Or maybe we can deprecate the latest tag soon and stop updating it e.g. 1 month before we stop publishing legacy 20.04 images.
The result might be the same. I think stopping updates on the latest tag immediately can be a source of confusion and breakage though.

Copy link
Collaborator Author

@toast-gear toast-gear Nov 29, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Having had a think I agree with all this. I think we should deprecate the latest tag entirely but yeh, we probably should do it after 22.04 has been out for some time.

Perhaps we can update the startup.sh to spit out some warnings too and pin an issue to give people the best chance of seeing it before we stop updating it? Should we look to delete the latest tag from DockerHub entirely too as it'll be very misleading if the tag left hanging around once we have stopped using it.

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 }}
83 changes: 63 additions & 20 deletions runner/Makefile
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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\
Expand All @@ -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.${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.dockerfile \
-t "${DIND_ROOTLESS_RUNNER_NAME}:${TAG}" \
-f actions-runner-dind-rootless.${OS_IMAGE}.dockerfile \
-t "${DIND_ROOTLESS_RUNNER_NAME}:${OS_IMAGE}" \
. ${PUSH_ARG}
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down
4 changes: 4 additions & 0 deletions runner/startup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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