From 7e9bad7b7fb8722e4bdcd2d23e086c787e8c2aec Mon Sep 17 00:00:00 2001 From: Federico Busetti <729029+febus982@users.noreply.github.com> Date: Thu, 6 Mar 2025 22:19:39 +0000 Subject: [PATCH 1/3] Handle non-lowercase repository names --- .github/workflows/ci-pipeline.yml | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci-pipeline.yml b/.github/workflows/ci-pipeline.yml index 2e5bddd7..d1c45b9b 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 @@ -114,9 +114,12 @@ jobs: # Transform os/arch to os-arch for suffix target - name: Set ENV variables run: | - echo "IMAGE_NAME=${GITHUB_REPOSITORY#$GITHUB_REPOSITORY_OWNER/}" >> $GITHUB_ENV + image_name=${GITHUB_REPOSITORY#$GITHUB_REPOSITORY_OWNER/} + echo "IMAGE_NAME=$image_name" >> $GITHUB_ENV platform=${{ matrix.arch.platform }} echo "PLATFORM_PAIR=${platform//\//-}" >> $GITHUB_ENV + image_without_tag=${{ env.REGISTRY }}/${{ env.REGISTRY_PATH }}/$image_name-${{ matrix.docker_target }} + echo "FULL_IMAGE_WITHOUT_TAG=$(echo $image_without_tag | tr '[A-Z]' '[a-z]')" >> $GITHUB_ENV - name: Checkout repository uses: actions/checkout@v4 @@ -168,7 +171,7 @@ jobs: target: ${{ matrix.docker_target }} platforms: ${{ matrix.arch.platform }} outputs: type=image,push-by-digest=true,name-canonical=true,push=true - tags: ${{ env.REGISTRY }}/${{ env.REGISTRY_PATH }}/${{ env.IMAGE_NAME }}-${{ matrix.docker_target }} + tags: ${{ env.FULL_IMAGE_WITHOUT_TAG }} labels: ${{ steps.meta.outputs.labels }} cache-from: type=registry,ref=${{ steps.meta-cache.outputs.tags }} cache-to: type=registry,ref=${{ steps.meta-cache.outputs.tags }},mode=max @@ -211,7 +214,10 @@ jobs: # Set IMAGE_NAME so we can push to // - name: Set ENV variables run: | - echo "IMAGE_NAME=${GITHUB_REPOSITORY#$GITHUB_REPOSITORY_OWNER/}" >> $GITHUB_ENV + image_name=${GITHUB_REPOSITORY#$GITHUB_REPOSITORY_OWNER/} + echo "IMAGE_NAME=$image_name" >> $GITHUB_ENV + image_without_tag=${{ env.REGISTRY }}/${{ env.REGISTRY_PATH }}/$image_name-${{ matrix.docker_target }} + echo "FULL_IMAGE_WITHOUT_TAG=$(echo $image_without_tag | tr '[A-Z]' '[a-z]')" >> $GITHUB_ENV - name: Download digests uses: actions/download-artifact@v4 @@ -257,11 +263,11 @@ jobs: working-directory: ${{ runner.temp }}/digests/${{ matrix.docker_target }} run: | docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \ - $(printf '${{ env.REGISTRY }}/${{ env.REGISTRY_PATH }}/${{ env.IMAGE_NAME }}-${{ matrix.docker_target }}@sha256:%s ' *) + $(printf '${{ env.FULL_IMAGE_WITHOUT_TAG }}@sha256:%s ' *) - name: Inspect image run: | - docker buildx imagetools inspect ${{ env.REGISTRY }}/${{ env.REGISTRY_PATH }}/${{ env.IMAGE_NAME }}-${{ matrix.docker_target }}:${{ steps.meta.outputs.version }} + docker buildx imagetools inspect ${{ env.FULL_IMAGE_WITHOUT_TAG }}:${{ steps.meta.outputs.version }} #TODO: Implement signature using generated key: https://docs.sigstore.dev/signing/quickstart/#signing-with-a-generated-key From 914513a1ddc6c78aa0d3bbc241f5717720c88078 Mon Sep 17 00:00:00 2001 From: Federico Busetti <729029+febus982@users.noreply.github.com> Date: Fri, 7 Mar 2025 13:55:47 +0000 Subject: [PATCH 2/3] Comment out branch tags --- .github/workflows/ci-pipeline.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci-pipeline.yml b/.github/workflows/ci-pipeline.yml index d1c45b9b..788facf6 100644 --- a/.github/workflows/ci-pipeline.yml +++ b/.github/workflows/ci-pipeline.yml @@ -256,8 +256,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 89044ce75cab2dcf44876872380c244172c1e536 Mon Sep 17 00:00:00 2001 From: Federico Busetti <729029+febus982@users.noreply.github.com> Date: Fri, 7 Mar 2025 14:00:07 +0000 Subject: [PATCH 3/3] Remove PR test code changes --- .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 788facf6..be36fe13 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 @@ -256,8 +256,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 }}