Skip to content

Use metadata action to normalize image tags syntax #271

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

Merged
merged 2 commits into from
Mar 6, 2025
Merged
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
29 changes: 25 additions & 4 deletions .github/workflows/ci-pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,17 @@ jobs:
- name: Setup Docker buildx
uses: docker/[email protected]

- name: Extract Docker cache metadata
id: meta-cache
uses: docker/[email protected]
with:
# list of Docker images to use as base name for tags
# <registry/<owner>/<repo_name>/<repo_name>-<target>
images: |
${{ env.REGISTRY }}/${{ env.REGISTRY_PATH }}/${{ env.IMAGE_NAME }}-cache
tags: |
type=raw,value=tests

# Build but don't push Docker image with Buildx
# https://github.com/docker/build-push-action
- name: Build test image
Expand All @@ -63,8 +74,8 @@ jobs:
load: true
target: dev
tags: ${{ env.TEST_TAG }}
cache-from: type=registry,ref=${{ env.REGISTRY }}/${{ env.REGISTRY_PATH }}/${{ env.IMAGE_NAME }}-cache:tests
cache-to: type=registry,ref=${{ env.REGISTRY }}/${{ env.REGISTRY_PATH }}/${{ env.IMAGE_NAME }}-cache:tests,mode=max
cache-from: type=registry,ref=${{ steps.meta-cache.outputs.tags }}
cache-to: type=registry,ref=${{ steps.meta-cache.outputs.tags }},mode=max

# This is a barrier check to make sure we push a functional
# docker image, we can avoid linting
Expand Down Expand Up @@ -137,6 +148,16 @@ jobs:
images: |
${{ env.REGISTRY }}/${{ env.REGISTRY_PATH }}/${{ env.IMAGE_NAME }}-${{ matrix.docker_target }}

- name: Extract Docker cache metadata
id: meta-cache
uses: docker/[email protected]
with:
# list of Docker images to use as base name for tags
# <registry/<owner>/<repo_name>/<repo_name>-<target>
images: |
${{ env.REGISTRY }}/${{ env.REGISTRY_PATH }}/${{ env.IMAGE_NAME }}-cache
tags: |
type=raw,value=buildcache-${{ matrix.docker_target }}-${{ env.PLATFORM_PAIR }}

# This build an image WITHOUT tags and outputs the digests, so that we can aggragate them later
- name: Build and push production image
Expand All @@ -149,8 +170,8 @@ jobs:
outputs: type=image,push-by-digest=true,name-canonical=true,push=true
tags: ${{ env.REGISTRY }}/${{ env.REGISTRY_PATH }}/${{ env.IMAGE_NAME }}-${{ matrix.docker_target }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=registry,ref=${{ env.REGISTRY }}/${{ env.REGISTRY_PATH }}/${{ env.IMAGE_NAME }}-cache:buildcache-${{ matrix.docker_target }}-${{ env.PLATFORM_PAIR }}
cache-to: type=registry,ref=${{ env.REGISTRY }}/${{ env.REGISTRY_PATH }}/${{ env.IMAGE_NAME }}-cache:buildcache-${{ matrix.docker_target }}-${{ env.PLATFORM_PAIR }},mode=max
cache-from: type=registry,ref=${{ steps.meta-cache.outputs.tags }}
cache-to: type=registry,ref=${{ steps.meta-cache.outputs.tags }},mode=max

- name: Export digest
run: |
Expand Down