@@ -13,18 +13,28 @@ inputs:
1313 platform_arm64 :
1414 description : Target image platform for AMD64 architecture
1515 required : true
16+ outputs :
17+ short_image_name :
18+ description : " The image name without tag"
19+ value : ${{ steps.prepare-image.outputs.short_image_name }}
20+ image_tags :
21+ description : " List of computed image tags"
22+ value : ${{ steps.fetch-tags.outputs.image_tags }}
1623
1724runs :
1825 using : " composite"
1926 steps :
2027
2128 - name : Prepare image push 📦
29+ id : prepare-image
2230 run : |
23- # The short image name (without tag) is necessary to push to the registry
24- echo "SHORT_IMAGE_NAME=${{ inputs.image }}" | awk -F: '{print $1}' >> $GITHUB_ENV
31+ short_name=$(echo "${{ inputs.image }}" | awk -F: '{print $1}')
32+ echo "Short image name: $short_name"
33+ echo "short_image_name=$short_name" >> $GITHUB_OUTPUT
2534 shell : bash
2635
27- # Pull the images locally for the two platforms: amd64 and arm64
36+ # Pull the images locally for the two architectures: amd64 and arm64
37+ # These images are already built and pushed separately by the appropriate github runners (amd64 and arm64)
2838 - name : Pull ${{ inputs.image }} image for ${{ inputs.platform_amd64 }} platform ⬇️
2939 run : |
3040 docker pull --platform=linux/${{ inputs.platform_amd64 }} ${{ inputs.registry }}/$OWNER/${{ inputs.image }}-${{ inputs.platform_amd64 }}
3545 docker pull --platform=linux/${{ inputs.platform_arm64 }} ${{ inputs.registry }}/$OWNER/${{ inputs.image }}-${{ inputs.platform_arm64 }}
3646 shell : bash
3747
38- # Apply tags
48+ # Apply okdp tags to the AMD64 image.
3949 - name : Apply tags to ${{ inputs.image }} image and platform ${{ inputs.platform_amd64 }} 🏷
4050 run : |
4151 python3 -m okdp.extension.tagging.apply_tags --image-name ${{ inputs.image }} \
@@ -44,21 +54,33 @@ runs:
4454 --platform ${{ inputs.platform_amd64 }}
4555 shell : bash
4656
57+ # Extract the list of base image tags (without the architecture suffix) from the locally pulled AMD64 images.
4758 - name : Fetch all tags for ${{ inputs.image }} image and platform ${{ inputs.platform_amd64 }} 🏷
59+ id : fetch-tags
4860 run : |
49- tags=$(docker images ${{ inputs.registry }}/$OWNER/$SHORT_IMAGE_NAME \
61+ tags=$(docker images ${{ inputs.registry }}/$OWNER/${{ steps.prepare-image.outputs.short_image_name }} \
5062 --format "{{.Repository}}:{{.Tag}}" \
5163 | grep -v -- "-${{ inputs.platform_arm64 }}$" \
5264 | sed "s/-${{ inputs.platform_amd64 }}$//" \
5365 | tr '\n' ' ')
54- echo "IMAGE_TAGS=$tags" >> $GITHUB_ENV
66+ echo "Found image tags: $tags"
67+ echo "image_tags=$tags" >> $GITHUB_OUTPUT
5568 shell : bash
5669
70+ # Apply the previously extracted base tags to the ARM64 image by adding the correct architecture suffix.
71+ # This ensures that every ARM64 image receives the same tag set as the AMD64 images.
5772 - name : Apply tags to ${{ inputs.image }} image and platform ${{ inputs.platform_arm64 }} 🏷
5873 run : |
59- for tag in $IMAGE_TAGS
74+ for tag in ${{ steps.fetch-tags.outputs.image_tags }}
6075 do
6176 docker tag ${{ inputs.registry }}/$OWNER/${{ inputs.image }}-${{ inputs.platform_arm64 }} ${tag}-${{ inputs.platform_arm64 }}
6277 done
6378 shell : bash
6479
80+ # Display all tags for the image to verify uniform tagging across architectures.
81+ # Provide a final overview of every generated tag after the tagging process.
82+ - name : Show all the image tags for the two architectures (AMD64 and ARM64) 📋
83+ run : |
84+ docker images --all
85+ shell : bash
86+
0 commit comments