From c7a1c1045407bb1e12f0c88bbda67be91693e2c4 Mon Sep 17 00:00:00 2001 From: Federico Busetti <729029+febus982@users.noreply.github.com> Date: Thu, 6 Mar 2025 21:50:16 +0000 Subject: [PATCH 1/2] Use metadata action to normalize image tags syntax --- .github/workflows/ci-pipeline.yml | 37 ++++++++++++++++++++++++------- 1 file changed, 29 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci-pipeline.yml b/.github/workflows/ci-pipeline.yml index 34c4b7f6..9c7809f8 100644 --- a/.github/workflows/ci-pipeline.yml +++ b/.github/workflows/ci-pipeline.yml @@ -11,8 +11,8 @@ on: ####### Uncomment this to test the CI pipeline in a PR ####### You'll also need to comment the rules containing {{branch}} ####### in the `Extract Docker metadata` step -# pull_request: -# branches: [ "main" ] + pull_request: + branches: [ "main" ] env: # Use docker.io for Docker Hub if empty @@ -53,6 +53,17 @@ jobs: - name: Setup Docker buildx uses: docker/setup-buildx-action@v3.10.0 + - name: Extract Docker cache metadata + id: meta-cache + uses: docker/metadata-action@v5.7.0 + with: + # list of Docker images to use as base name for tags + # //- + 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 @@ -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 @@ -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/metadata-action@v5.7.0 + with: + # list of Docker images to use as base name for tags + # //- + 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 @@ -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: | @@ -229,8 +250,8 @@ jobs: # generate Docker tags based on the following events/attributes tags: | type=sha - type=raw,value={{branch}}-latest - type=raw,value={{branch}}-{{date 'YYYYMMDDHHmmss'}} +# type=raw,value={{branch}}-latest +# type=raw,value={{branch}}-{{date 'YYYYMMDDHHmmss'}} - name: Create manifest list and push working-directory: ${{ runner.temp }}/digests/${{ matrix.docker_target }} From db2cf0ac0c0e9e64c512848ae58abd5cbb9fd4af Mon Sep 17 00:00:00 2001 From: Federico Busetti <729029+febus982@users.noreply.github.com> Date: Thu, 6 Mar 2025 21:52:32 +0000 Subject: [PATCH 2/2] Disable PR pipeline --- .github/workflows/ci-pipeline.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci-pipeline.yml b/.github/workflows/ci-pipeline.yml index 9c7809f8..2e5bddd7 100644 --- a/.github/workflows/ci-pipeline.yml +++ b/.github/workflows/ci-pipeline.yml @@ -11,8 +11,8 @@ on: ####### Uncomment this to test the CI pipeline in a PR ####### You'll also need to comment the rules containing {{branch}} ####### in the `Extract Docker metadata` step - pull_request: - branches: [ "main" ] +# pull_request: +# branches: [ "main" ] env: # Use docker.io for Docker Hub if empty @@ -250,8 +250,8 @@ jobs: # generate Docker tags based on the following events/attributes tags: | type=sha -# type=raw,value={{branch}}-latest -# type=raw,value={{branch}}-{{date 'YYYYMMDDHHmmss'}} + type=raw,value={{branch}}-latest + type=raw,value={{branch}}-{{date 'YYYYMMDDHHmmss'}} - name: Create manifest list and push working-directory: ${{ runner.temp }}/digests/${{ matrix.docker_target }}