diff --git a/utils/get-image-architectures b/utils/get-image-architectures index d0bcd71..0eb35a8 100755 --- a/utils/get-image-architectures +++ b/utils/get-image-architectures @@ -1,23 +1,29 @@ #!/bin/bash # # script: get-image-architectures -# +# # description: This script fetches all architectures and their digests for a passed image. # It will output each arch on its own line, as json. # -# example command: +# example command: # get-image-architectures IMAGE where IMAGE is quay.io/org/repo@sha256:abcde for example # IMAGE=$1 if [ -z "${IMAGE}" ] || [[ "${IMAGE}" == docker://* ]] ; then - echo -e "Please pass an image (without the docker:// prefix) to find the architectures for" + echo "Please pass an image (without the docker:// prefix) to find the architectures for" >&2 exit 1 fi RAW_OUTPUT=$(skopeo inspect --no-tags --raw docker://${IMAGE}) +if [ -z "$RAW_OUTPUT" ]; then + echo "Error: Unable to fetch image details with skopeo inspect" >&2 + exit 1 +fi + + ARTIFACT_TYPE=$(jq -r '.artifactType' <<< $RAW_OUTPUT) if [ "$ARTIFACT_TYPE" != "null" ] ; then # OCI artifact (not a normal image)