-
Notifications
You must be signed in to change notification settings - Fork 367
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Tools: New Docker release tagging script (#2989)
* Tools: New Docker release tagging script * Fix typo
- Loading branch information
1 parent
bcb683d
commit d4bfc52
Showing
2 changed files
with
49 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,6 @@ name: Docker Container Builds | |
on: | ||
push: | ||
tags: | ||
- "stable" | ||
- "v*.*.*" | ||
|
||
workflow_dispatch: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
#!/bin/bash | ||
|
||
# Ensure the script exits on errors | ||
set -e | ||
|
||
# Check for input arguments | ||
if [ "$#" -ne 1 ]; then | ||
echo "Usage: ./move_up_stable_tag.sh <target-tag-without-v>" | ||
exit 1 | ||
fi | ||
|
||
SOURCE_TAG="$1" | ||
ALIAS_TAG="stable" | ||
|
||
# List of images to retag | ||
IMAGES=( | ||
"pglombardo/pwpush" | ||
"pglombardo/pwpush-worker" | ||
"pglombardo/pwpush-public-gateway" | ||
) | ||
|
||
for IMAGE in "${IMAGES[@]}"; do | ||
echo "Retrieving digests for ${IMAGE}:${SOURCE_TAG}..." | ||
|
||
# Use docker manifest inspect to parse platform-specific digests | ||
MANIFEST_JSON=$(docker manifest inspect "${IMAGE}:${SOURCE_TAG}") | ||
|
||
AMD64_DIGEST=$(echo "${MANIFEST_JSON}" | jq -r '.manifests[] | select(.platform.architecture == "amd64") | .digest') | ||
ARM64_DIGEST=$(echo "${MANIFEST_JSON}" | jq -r '.manifests[] | select(.platform.architecture == "arm64") | .digest') | ||
|
||
if [ -z "${AMD64_DIGEST}" ] || [ -z "${ARM64_DIGEST}" ]; then | ||
echo "Error: Could not retrieve digests for ${IMAGE}:${SOURCE_TAG}" | ||
exit 1 | ||
fi | ||
|
||
echo "Creating manifest for ${IMAGE}:${ALIAS_TAG}..." | ||
docker manifest create "${IMAGE}:${ALIAS_TAG}" \ | ||
--amend "${IMAGE}@${AMD64_DIGEST}" \ | ||
--amend "${IMAGE}@${ARM64_DIGEST}" | ||
|
||
echo "Annotating platforms for ${IMAGE}:${ALIAS_TAG}..." | ||
docker manifest annotate "${IMAGE}:${ALIAS_TAG}" "${IMAGE}@${AMD64_DIGEST}" --arch amd64 | ||
docker manifest annotate "${IMAGE}:${ALIAS_TAG}" "${IMAGE}@${ARM64_DIGEST}" --arch arm64 | ||
|
||
echo "Pushing manifest for ${IMAGE}:${ALIAS_TAG}..." | ||
docker manifest push "${IMAGE}:${ALIAS_TAG}" | ||
done | ||
|
||
echo "All images have been tagged as '${ALIAS_TAG}' successfully." |