Skip to content

Commit

Permalink
fix: ensure docker image tags use include the build version (#33)
Browse files Browse the repository at this point in the history
Signed-off-by: Nathan Klick <[email protected]>
  • Loading branch information
nathanklick committed Aug 26, 2024
1 parent 407161c commit 77a252c
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 7 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/flow-pull-request-checks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ jobs:
build-dind-image: true
build-dind-rootless-image: false
base-os-image: ubuntu-22.04
tag-version: ${{ needs.versions.outputs.runner }}
runner-version: ${{ needs.versions.outputs.runner }}
runner-container-hooks-version: ${{ needs.versions.outputs.hooks }}
docker-version: 24.0.9
Expand All @@ -59,6 +60,7 @@ jobs:
- versions
with:
base-os-image: ubuntu-22.04
tag-version: ${{ needs.versions.outputs.runner }}
runner-version: ${{ needs.versions.outputs.runner }}
runner-container-hooks-version: ${{ needs.versions.outputs.hooks }}
docker-version: 25.0.5
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/flow-release-legacy-images.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ jobs:
with:
custom-job-label: "Release"
base-os-image: ${{ matrix.base-os-image }}
tag-version: ${{ needs.versions.outputs.tag }}
runner-version: ${{ needs.versions.outputs.runner }}
runner-container-hooks-version: ${{ needs.versions.outputs.hooks }}
docker-version: ${{ github.event.inputs.docker-version || '25.0.5' }}
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/flow-release-scaleset-images.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ jobs:
with:
custom-job-label: "Release"
base-os-image: ${{ matrix.base-os-image }}
tag-version: ${{ needs.versions.outputs.tag }}
runner-version: ${{ needs.versions.outputs.runner }}
runner-container-hooks-version: ${{ needs.versions.outputs.hooks }}
docker-version: ${{ github.event.inputs.docker-version || '25.0.5' }}
Expand Down
15 changes: 15 additions & 0 deletions .github/workflows/zxc-build-legacy-images.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@ on:
type: string
required: true

## The tag version to be used
tag-version:
description: "Tag Version:"
type: string
required: true

## Upstream Github Action Runner Version
runner-version:
description: "Runner Version:"
Expand Down Expand Up @@ -260,10 +266,17 @@ jobs:
echo "prefix=${DOCKER_REGISTRY_PREFIX}" >>"${GITHUB_OUTPUT}"
echo "operation=${IMG_RESULT}" >>"${GITHUB_OUTPUT}"
- name: Calculate Docker Tag
id: docker-tag
run: |
TAG_VERSION="${{ inputs.tag-version || inputs.runner-version }}"
echo "version=${TAG_VERSION//+/-}" >>"${GITHUB_OUTPUT}"
- name: Build Default Image
env:
DOCKER_USER: ${{ steps.registry.outputs.prefix }}
IMG_RESULT: ${{ steps.registry.outputs.operation }}
TAG_VERSION: ${{ steps.docker-tag.outputs.version }}
working-directory: legacy/runner
if: ${{ inputs.build-default-image }}
run: make docker-buildx-default
Expand All @@ -272,6 +285,7 @@ jobs:
env:
DOCKER_USER: ${{ steps.registry.outputs.prefix }}
IMG_RESULT: ${{ steps.registry.outputs.operation }}
TAG_VERSION: ${{ steps.docker-tag.outputs.version }}
working-directory: legacy/runner
if: ${{ inputs.build-dind-image }}
run: make docker-buildx-dind
Expand All @@ -280,6 +294,7 @@ jobs:
env:
DOCKER_USER: ${{ steps.registry.outputs.prefix }}
IMG_RESULT: ${{ steps.registry.outputs.operation }}
TAG_VERSION: ${{ steps.docker-tag.outputs.version }}
working-directory: legacy/runner
if: ${{ inputs.build-dind-rootless-image }}
run: make docker-buildx-dind-rootless
14 changes: 13 additions & 1 deletion .github/workflows/zxc-build-scaleset-images.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,12 @@ on:
type: string
required: true

## The tag version to be used
tag-version:
description: "Tag Version:"
type: string
required: true

## Upstream Github Action Runner Version
runner-version:
description: "Runner Version:"
Expand Down Expand Up @@ -259,6 +265,12 @@ jobs:
echo "prefix=${DOCKER_REGISTRY_PREFIX}" >>"${GITHUB_OUTPUT}"
echo "operation=${IMG_RESULT}" >>"${GITHUB_OUTPUT}"
- name: Calculate Docker Tag
id: docker-tag
run: |
TAG_VERSION="${{ inputs.tag-version || inputs.runner-version }}"
echo "version=${TAG_VERSION//+/-}" >>"${GITHUB_OUTPUT}"
- name: Build Image
uses: docker/build-push-action@5cd11c3a4ced054e52742c5fd54dca954e0edd85 # v6.7.0
with:
Expand All @@ -268,7 +280,7 @@ jobs:
load: ${{ steps.registry.outputs.operation == 'load' }}
tags: |
${{ steps.registry.outputs.prefix }}/scaleset-runner:${{ inputs.base-os-image }}
${{ steps.registry.outputs.prefix }}/scaleset-runner:v${{ inputs.runner-version }}-${{ inputs.base-os-image }}
${{ steps.registry.outputs.prefix }}/scaleset-runner:v${{ steps.docker-tag.outputs.version }}-${{ inputs.base-os-image }}
build-args: |
TARGETOS=linux
TARGETARCH=amd64
Expand Down
13 changes: 7 additions & 6 deletions legacy/runner/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ DIND_ROOTLESS_RUNNER_NAME ?= ${DOCKER_USER}/actions-runner-dind-rootless
OS_IMAGE ?= ubuntu-22.04
TARGETPLATFORM ?= $(shell arch)

TAG_VERSION ?= 2.318.0
RUNNER_VERSION ?= 2.318.0
RUNNER_CONTAINER_HOOKS_VERSION ?= 0.6.1
DOCKER_VERSION ?= 24.0.7
Expand Down Expand Up @@ -102,23 +103,23 @@ docker-buildx-set:
--build-arg DOCKER_VERSION=${DOCKER_VERSION} \
-f actions-runner.${OS_IMAGE}.dockerfile \
-t "${DEFAULT_RUNNER_NAME}:${OS_IMAGE}" \
-t "${DEFAULT_RUNNER_NAME}:v${RUNNER_VERSION}-${OS_IMAGE}" \
-t "${DEFAULT_RUNNER_NAME}:v${TAG_VERSION}-${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.${OS_IMAGE}.dockerfile \
-t "${DIND_RUNNER_NAME}:${OS_IMAGE}" \
-t "${DIND_RUNNER_NAME}:v${RUNNER_VERSION}-${OS_IMAGE}" \
-t "${DIND_RUNNER_NAME}:v${TAG_VERSION}-${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}" \
-t "${DIND_ROOTLESS_RUNNER_NAME}:v${RUNNER_VERSION}-${OS_IMAGE}" \
-t "${DIND_ROOTLESS_RUNNER_NAME}:v${TAG_VERSION}-${OS_IMAGE}" \
. ${PUSH_ARG}

docker-buildx-default:
Expand All @@ -133,7 +134,7 @@ docker-buildx-default:
--build-arg DOCKER_VERSION=${DOCKER_VERSION} \
-f actions-runner.${OS_IMAGE}.dockerfile \
-t "${DEFAULT_RUNNER_NAME}:${OS_IMAGE}" \
-t "${DEFAULT_RUNNER_NAME}:v${RUNNER_VERSION}-${OS_IMAGE}" \
-t "${DEFAULT_RUNNER_NAME}:v${TAG_VERSION}-${OS_IMAGE}" \
. ${PUSH_ARG}

docker-buildx-dind:
Expand All @@ -148,7 +149,7 @@ docker-buildx-dind:
--build-arg DOCKER_VERSION=${DOCKER_VERSION} \
-f actions-runner-dind.${OS_IMAGE}.dockerfile \
-t "${DIND_RUNNER_NAME}:${OS_IMAGE}" \
-t "${DIND_RUNNER_NAME}:v${RUNNER_VERSION}-${OS_IMAGE}" \
-t "${DIND_RUNNER_NAME}:v${TAG_VERSION}-${OS_IMAGE}" \
. ${PUSH_ARG}

docker-buildx-dind-rootless:
Expand All @@ -163,5 +164,5 @@ docker-buildx-dind-rootless:
--build-arg DOCKER_VERSION=${DOCKER_VERSION} \
-f actions-runner-dind-rootless.${OS_IMAGE}.dockerfile \
-t "${DIND_ROOTLESS_RUNNER_NAME}:${OS_IMAGE}" \
-t "${DIND_ROOTLESS_RUNNER_NAME}:v${RUNNER_VERSION}-${OS_IMAGE}" \
-t "${DIND_ROOTLESS_RUNNER_NAME}:v${TAG_VERSION}-${OS_IMAGE}" \
. ${PUSH_ARG}

0 comments on commit 77a252c

Please sign in to comment.