Skip to content

Instantly share code, notes, and snippets.

@e-minguez
Last active May 14, 2025 10:53
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.

Revisions

  1. e-minguez revised this gist May 14, 2025. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions which_tag_is_latest.sh
    Original file line number Diff line number Diff line change
    @@ -14,5 +14,6 @@ for tag in ${TAGS}; do
    DIGEST=$(crane digest ${IMAGE}:${tag} --platform ${PLATFORM} 2> /dev/null)
    if [[ ${DIGEST} == ${LATEST} ]]; then
    echo "latest=${tag}"
    exit 0
    fi
    done
  2. e-minguez revised this gist Oct 8, 2024. 1 changed file with 6 additions and 2 deletions.
    8 changes: 6 additions & 2 deletions which_tag_is_latest.sh
    Original file line number Diff line number Diff line change
    @@ -1,13 +1,17 @@
    #!/bin/bash

    IMAGE="registry.opensuse.org/opensuse/busybox"
    OS="linux"
    ARCH="amd64"

    LATEST=$(crane manifest ${IMAGE}:latest | jq -r '.manifests[] | select(.platform.architecture=="amd64") | .digest')
    PLATFORM="${OS}/${ARCH}"

    LATEST=$(crane digest ${IMAGE}:latest --platform ${PLATFORM})

    TAGS=$(crane ls ${IMAGE} | grep -v latest)

    for tag in ${TAGS}; do
    DIGEST=$(crane manifest ${IMAGE}:${tag} | jq -r '.manifests[] | select(.platform.architecture=="amd64") | .digest')
    DIGEST=$(crane digest ${IMAGE}:${tag} --platform ${PLATFORM} 2> /dev/null)
    if [[ ${DIGEST} == ${LATEST} ]]; then
    echo "latest=${tag}"
    fi
  3. e-minguez created this gist Oct 8, 2024.
    14 changes: 14 additions & 0 deletions which_tag_is_latest.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,14 @@
    #!/bin/bash

    IMAGE="registry.opensuse.org/opensuse/busybox"

    LATEST=$(crane manifest ${IMAGE}:latest | jq -r '.manifests[] | select(.platform.architecture=="amd64") | .digest')

    TAGS=$(crane ls ${IMAGE} | grep -v latest)

    for tag in ${TAGS}; do
    DIGEST=$(crane manifest ${IMAGE}:${tag} | jq -r '.manifests[] | select(.platform.architecture=="amd64") | .digest')
    if [[ ${DIGEST} == ${LATEST} ]]; then
    echo "latest=${tag}"
    fi
    done