Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(KFLUXBUGS-1846): fail get-image-architectures if skopeo failed #328

Merged
merged 1 commit into from
Nov 27, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions utils/get-image-architectures
Original file line number Diff line number Diff line change
@@ -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)
Expand Down