Skip to content

Commit 9410491

Browse files
authored
Use metadata action to normalize image tags syntax (#271)
1 parent cf80ce9 commit 9410491

File tree

1 file changed

+25
-4
lines changed

1 file changed

+25
-4
lines changed

.github/workflows/ci-pipeline.yml

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,17 @@ jobs:
5353
- name: Setup Docker buildx
5454
uses: docker/[email protected]
5555

56+
- name: Extract Docker cache metadata
57+
id: meta-cache
58+
uses: docker/[email protected]
59+
with:
60+
# list of Docker images to use as base name for tags
61+
# <registry/<owner>/<repo_name>/<repo_name>-<target>
62+
images: |
63+
${{ env.REGISTRY }}/${{ env.REGISTRY_PATH }}/${{ env.IMAGE_NAME }}-cache
64+
tags: |
65+
type=raw,value=tests
66+
5667
# Build but don't push Docker image with Buildx
5768
# https://github.com/docker/build-push-action
5869
- name: Build test image
@@ -63,8 +74,8 @@ jobs:
6374
load: true
6475
target: dev
6576
tags: ${{ env.TEST_TAG }}
66-
cache-from: type=registry,ref=${{ env.REGISTRY }}/${{ env.REGISTRY_PATH }}/${{ env.IMAGE_NAME }}-cache:tests
67-
cache-to: type=registry,ref=${{ env.REGISTRY }}/${{ env.REGISTRY_PATH }}/${{ env.IMAGE_NAME }}-cache:tests,mode=max
77+
cache-from: type=registry,ref=${{ steps.meta-cache.outputs.tags }}
78+
cache-to: type=registry,ref=${{ steps.meta-cache.outputs.tags }},mode=max
6879

6980
# This is a barrier check to make sure we push a functional
7081
# docker image, we can avoid linting
@@ -137,6 +148,16 @@ jobs:
137148
images: |
138149
${{ env.REGISTRY }}/${{ env.REGISTRY_PATH }}/${{ env.IMAGE_NAME }}-${{ matrix.docker_target }}
139150
151+
- name: Extract Docker cache metadata
152+
id: meta-cache
153+
uses: docker/[email protected]
154+
with:
155+
# list of Docker images to use as base name for tags
156+
# <registry/<owner>/<repo_name>/<repo_name>-<target>
157+
images: |
158+
${{ env.REGISTRY }}/${{ env.REGISTRY_PATH }}/${{ env.IMAGE_NAME }}-cache
159+
tags: |
160+
type=raw,value=buildcache-${{ matrix.docker_target }}-${{ env.PLATFORM_PAIR }}
140161
141162
# This build an image WITHOUT tags and outputs the digests, so that we can aggragate them later
142163
- name: Build and push production image
@@ -149,8 +170,8 @@ jobs:
149170
outputs: type=image,push-by-digest=true,name-canonical=true,push=true
150171
tags: ${{ env.REGISTRY }}/${{ env.REGISTRY_PATH }}/${{ env.IMAGE_NAME }}-${{ matrix.docker_target }}
151172
labels: ${{ steps.meta.outputs.labels }}
152-
cache-from: type=registry,ref=${{ env.REGISTRY }}/${{ env.REGISTRY_PATH }}/${{ env.IMAGE_NAME }}-cache:buildcache-${{ matrix.docker_target }}-${{ env.PLATFORM_PAIR }}
153-
cache-to: type=registry,ref=${{ env.REGISTRY }}/${{ env.REGISTRY_PATH }}/${{ env.IMAGE_NAME }}-cache:buildcache-${{ matrix.docker_target }}-${{ env.PLATFORM_PAIR }},mode=max
173+
cache-from: type=registry,ref=${{ steps.meta-cache.outputs.tags }}
174+
cache-to: type=registry,ref=${{ steps.meta-cache.outputs.tags }},mode=max
154175

155176
- name: Export digest
156177
run: |

0 commit comments

Comments
 (0)