@@ -24,12 +24,20 @@ inputs:
2424 description : |
2525 Stackable Data Platform version (eg: `24.7.0`)
2626 default : 0.0.0-dev
27+ extra-tag-data :
28+ description : |
29+ Extra data to include in the final image manifest tag (eg: `pr321`)
2730outputs :
2831 image-manifest-tag :
2932 description : |
3033 Human-readable tag (usually the version) with architecture information,
3134 for example: `3.4.1-stackable0.0.0-dev-amd64`
3235 value : ${{ steps.image_info.outputs.IMAGE_MANIFEST_TAG }}
36+ suggested-image-index-manifest-tag :
37+ description : |
38+ Human-readable tag (usually the version) without architecture information,
39+ for example: `3.4.1-stackable0.0.0-dev`
40+ value : ${{ steps.image_info.outputs.IMAGE_INDEX_MANIFEST_TAG }}
3341runs :
3442 using : composite
3543 steps :
@@ -61,16 +69,30 @@ runs:
6169 BAKE_PRODUCT_VERSION : ${{ inputs.product-version }}
6270 BAKE_CONFIG_FILE : ${{ inputs.bake-config-file }}
6371 IMAGE_REPOSITORY : ${{ inputs.product-name }}
72+ EXTRA_TAG_DATA : ${{ inputs.extra-tag-data }}
6473 SDP_VERSION : ${{ inputs.sdp-version }}
6574 shell : bash
6675 run : |
6776 set -euo pipefail
6877 IMAGE_ARCH=$("$GITHUB_ACTION_PATH/../.scripts/get_architecture.sh")
6978
79+ # Will be either:
80+ # - 3.9.2-stackable0.0.0-dev-arm64 or
81+ # - 3.9.2-stackable0.0.0-dev-pr321-arm64
82+ IMAGE_INDEX_MANIFEST_TAG="${SDP_VERSION}${EXTRA_TAG_DATA:+-$EXTRA_TAG_DATA}-${IMAGE_ARCH}"
83+ echo "IMAGE_INDEX_MANIFEST_TAG=$IMAGE_INDEX_MANIFEST_TAG" | tee -a "$GITHUB_ENV"
84+
85+ # Validate that final tag is valid according to
86+ # https://github.com/distribution/reference/blob/8c942b0459dfdcc5b6685581dd0a5a470f615bff/regexp.go#L68
87+ if ! echo "$IMAGE_INDEX_MANIFEST_TAG" | grep --perl-regexp --quiet '^[\w][\w.-]{1,127}$'; then
88+ >&2 echo "Encountered invalid image manifest tag: $IMAGE_INDEX_MANIFEST_TAG"
89+ exit 1
90+ fi
91+
7092 echo "::group::bake"
7193 bake \
7294 --product "$IMAGE_REPOSITORY=$BAKE_PRODUCT_VERSION" \
73- --image-version "${SDP_VERSION}-${IMAGE_ARCH} " \
95+ --image-version "$IMAGE_INDEX_MANIFEST_TAG " \
7496 --architecture "linux/${IMAGE_ARCH}" \
7597 --export-tags-file bake-target-tags \
7698 --configuration "$BAKE_CONFIG_FILE" \
@@ -102,7 +124,9 @@ runs:
102124 # Extract the image manifest tag from the bake-target-tags file
103125 IMAGE_MANIFEST_TAG=$(cut -d : -f 2 < bake-target-tags)
104126 [[ -n "$IMAGE_MANIFEST_TAG" ]]
127+ [[ -n "$IMAGE_INDEX_MANIFEST_TAG" ]]
105128
106129 # Add the contents of the env variables to the GitHub output, so that it
107130 # can be used as action outputs
108131 echo "IMAGE_MANIFEST_TAG=$IMAGE_MANIFEST_TAG" | tee -a "$GITHUB_OUTPUT"
132+ echo "IMAGE_INDEX_MANIFEST_TAG=$IMAGE_INDEX_MANIFEST_TAG" | tee -a "$GITHUB_OUTPUT"
0 commit comments