Skip to content

Instantly share code, notes, and snippets.

@e-minguez
Last active October 8, 2024 16:51
Show Gist options
  • Save e-minguez/5ceea342b8b8d7893a61ec2236a2227c to your computer and use it in GitHub Desktop.
Save e-minguez/5ceea342b8b8d7893a61ec2236a2227c to your computer and use it in GitHub Desktop.
Small script to find which tag is the real latest one
#!/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