From 96382a8a94b7974340c7e7a3c06ab698f4842a98 Mon Sep 17 00:00:00 2001 From: Shiming Zhang Date: Wed, 27 Apr 2022 13:44:58 +0800 Subject: [PATCH] Checking the length of tags for verify-image (#121) --- hack/verify-image.sh | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/hack/verify-image.sh b/hack/verify-image.sh index 270453c..15ec5d7 100755 --- a/hack/verify-image.sh +++ b/hack/verify-image.sh @@ -10,7 +10,27 @@ git apply -R <(curl -fsSL "${patch_url}") || : list=$(diff --unified "${file}" "${file}.bak" | grep '^+\w' | sed 's/^+//' || :) +failed=() for image in ${list}; do echo "Checking image: ${image}" - skopeo list-tags --retry-times 3 "docker://${image}" || { echo "Not Found ${image}" ; exit 1; } + raw=$(skopeo list-tags --no-creds --tls-verify=false --retry-times 3 "docker://${image}") + if [[ $? -ne 0 ]]; then + failed+=("not found ${image}") + echo "Not found ${image}" + continue + fi + if [[ $(echo "${raw}" | jq '.Tags | length') -eq 0 ]]; then + failed+=("found ${image} but no tags") + echo "Found ${image} but no tags" + echo "${raw}" + continue + fi done + +if [[ ${#failed[@]} -ne 0 ]]; then + echo "Failed images:" + for image in "${failed[@]}"; do + echo " ${image}" + done + exit 1 +fi