Skip to content

Commit

Permalink
fix(runners): set SHOW_LATEST_TAG_WARN env var on latest images only
Browse files Browse the repository at this point in the history
This will enable us to show the corresponding warning in these images only.
  • Loading branch information
TPXP committed Jul 5, 2023
1 parent 588ad47 commit 4702ffd
Showing 1 changed file with 29 additions and 3 deletions.
32 changes: 29 additions & 3 deletions .github/workflows/release-runners.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -100,12 +100,13 @@ jobs:
echo "SHA_SHORT=$(git -C $GITHUB_WORKSPACE/arc rev-parse --short HEAD)" >> $GITHUB_ENV
echo "LATEST_TAG_DOCKER=${{ env.DOCKERHUB_USERNAME }}/${{ matrix.name }}:latest" >> $GITHUB_ENV
echo "LATEST_TAG_GHCR=ghcr.io/${{ env.TARGET_ORG }}/${{ env.TARGET_REPO }}/${{ matrix.name }}:latest" >> $GITHUB_ENV
echo "DOCKERFILE_PREFIX=./arc/runner/${{ matrix.name }}.${{matrix.os-name}}-${{ matrix.os-version }}" >> $GITHUB_ENV
- name: Build and Push Versioned Tags
uses: docker/build-push-action@v3
with:
context: ./arc/runner
file: ./arc/runner/${{ matrix.name }}.${{matrix.os-name}}-${{ matrix.os-version }}.dockerfile
file: ${{ env.DOCKERFILE_PREFIX }}.dockerfile
platforms: linux/amd64,linux/arm64
pull: true
push: ${{ inputs.push_to_registries }}
Expand All @@ -117,10 +118,35 @@ jobs:
${{ env.DOCKERHUB_USERNAME }}/${{ matrix.name }}:${{ matrix.os-name }}-${{ matrix.os-version }}
${{ env.DOCKERHUB_USERNAME }}/${{ matrix.name }}:v${{ inputs.runner_version }}-${{ matrix.os-name }}-${{ matrix.os-version }}
${{ env.DOCKERHUB_USERNAME }}/${{ matrix.name }}:v${{ inputs.runner_version }}-${{ matrix.os-name }}-${{ matrix.os-version }}-${{ env.SHA_SHORT }}
${{ matrix.latest == 'true' && env.LATEST_TAG_DOCKER || '' }}
ghcr.io/${{ env.TARGET_ORG }}/${{ env.TARGET_REPO }}/${{ matrix.name }}:${{ matrix.os-name }}-${{ matrix.os-version }}
ghcr.io/${{ env.TARGET_ORG }}/${{ env.TARGET_REPO }}/${{ matrix.name }}:v${{ inputs.runner_version }}-${{ matrix.os-name }}-${{ matrix.os-version }}
ghcr.io/${{ env.TARGET_ORG }}/${{ env.TARGET_REPO }}/${{ matrix.name }}:v${{ inputs.runner_version }}-${{ matrix.os-name }}-${{ matrix.os-version }}-${{ env.SHA_SHORT }}
${{ matrix.latest == 'true' && env.LATEST_TAG_GHCR || '' }}
cache-from: type=registry,ref=ghcr.io/${{ env.TARGET_ORG }}/${{ env.TARGET_REPO }}/${{ matrix.name }}:v${{ inputs.runner_version }}-${{ matrix.os-name }}-${{ matrix.os-version }}
cache-to: type=inline

- name: Generate Dockerfile for image with latest tag
if: ${{ matrix.latest == 'true' }}
run: |
cat <<EOF
FROM ${{ env.DOCKERHUB_USERNAME }}/${{ matrix.name }}:${{ matrix.os-name }}-${{ matrix.os-version }}
ENV SHOW_LATEST_TAG_WARN=1
EOF | tee ${{ env.DOCKERFILE_PREFIX }}.latest.dockerfile
- name: Build and Push Versioned Tags
if: ${{ matrix.latest == 'true' }}
uses: docker/build-push-action@v3
with:
context: ./arc/runner
file: ${{ env.DOCKERFILE_PREFIX }}.latest.dockerfile
platforms: linux/amd64,linux/arm64
pull: true
push: ${{ inputs.push_to_registries }}
build-args: |
RUNNER_VERSION=${{ inputs.runner_version }}
DOCKER_VERSION=${{ inputs.docker_version }}
RUNNER_CONTAINER_HOOKS_VERSION=${{ inputs.runner_container_hooks_version }}
tags: |
${{ env.LATEST_TAG_DOCKER }}
${{ env.LATEST_TAG_GHCR }}
cache-from: type=registry,ref=ghcr.io/${{ env.TARGET_ORG }}/${{ env.TARGET_REPO }}/${{ matrix.name }}:v${{ inputs.runner_version }}-${{ matrix.os-name }}-${{ matrix.os-version }}
cache-to: type=inline

0 comments on commit 4702ffd

Please sign in to comment.