Last active
October 8, 2024 16:51
-
-
Save e-minguez/5ceea342b8b8d7893a61ec2236a2227c to your computer and use it in GitHub Desktop.
Small script to find which tag is the real latest one
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
#!/bin/bash | |
IMAGE="registry.opensuse.org/opensuse/busybox" | |
OS="linux" | |
ARCH="amd64" | |
PLATFORM="${OS}/${ARCH}" | |
LATEST=$(crane digest ${IMAGE}:latest --platform ${PLATFORM}) | |
TAGS=$(crane ls ${IMAGE} | grep -v latest) | |
for tag in ${TAGS}; do | |
DIGEST=$(crane digest ${IMAGE}:${tag} --platform ${PLATFORM} 2> /dev/null) | |
if [[ ${DIGEST} == ${LATEST} ]]; then | |
echo "latest=${tag}" | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment