From 07616e027ee364cbc5963fc45a8be8bef8eb9b1d Mon Sep 17 00:00:00 2001 From: Yutaka Kondo Date: Tue, 3 Dec 2024 10:22:44 +0900 Subject: [PATCH 1/2] not push manifest if eithor amd64 or arm64 is missing Signed-off-by: Yutaka Kondo --- .github/actions/combine-multi-arch-images/action.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/actions/combine-multi-arch-images/action.yaml b/.github/actions/combine-multi-arch-images/action.yaml index 8c446c5ff2c..43779450543 100644 --- a/.github/actions/combine-multi-arch-images/action.yaml +++ b/.github/actions/combine-multi-arch-images/action.yaml @@ -82,14 +82,14 @@ runs: amd64_image="${{ steps.set-image-name.outputs.image-name }}:$amd64_tag" else echo "No amd64 tag found for '$base_tag'." - amd64_image="" + continue fi if [ "$arm64_tag" != "" ]; then arm64_image="${{ steps.set-image-name.outputs.image-name }}:$arm64_tag" else echo "No arm64 tag found for '$base_tag'." - arm64_image="" + continue fi echo "amd64_image: $amd64_image" From 8b8036cadf64af30c2588f46a049ea2d786dfb23 Mon Sep 17 00:00:00 2001 From: Yutaka Kondo Date: Tue, 3 Dec 2024 10:37:03 +0900 Subject: [PATCH 2/2] delete -amd64 and -arm64 tags Signed-off-by: Yutaka Kondo --- .../actions/combine-multi-arch-images/action.yaml | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/.github/actions/combine-multi-arch-images/action.yaml b/.github/actions/combine-multi-arch-images/action.yaml index 43779450543..874054f4ed2 100644 --- a/.github/actions/combine-multi-arch-images/action.yaml +++ b/.github/actions/combine-multi-arch-images/action.yaml @@ -67,7 +67,7 @@ runs: ALL_TAGS: ${{ steps.get-all-tags.outputs.tags }} shell: bash - - name: Create Docker manifest + - name: Create Docker manifest and delete -amd64 and -arm64 tags run: | for base_tag in $BASE_TAGS; do echo -e "\nbase_tag: $base_tag" @@ -100,6 +100,16 @@ runs: $arm64_image; then docker manifest push ${{ steps.set-image-name.outputs.image-name }}:$base_tag + + # Delete amd64_image and arm64_image + curl -X DELETE \ + -H "Authorization: Bearer ${{ github.token }}" \ + -H "Accept: application/vnd.github.v3+json" \ + https://api.github.com/orgs/${{ github.repository_owner }}/packages/container/${{ inputs.package-name }}/versions/$amd64_tag + curl -X DELETE \ + -H "Authorization: Bearer ${{ github.token }}" \ + -H "Accept: application/vnd.github.v3+json" \ + https://api.github.com/orgs/${{ github.repository_owner }}/packages/container/${{ inputs.package-name }}/versions/$arm64_tag fi done env: