Checking the length of tags for verify-image (#121)

This commit is contained in:
Shiming Zhang 2022-04-27 13:44:58 +08:00 committed by GitHub
parent 5715ee47a5
commit 96382a8a94
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 21 additions and 1 deletions

View File

@ -10,7 +10,27 @@ git apply -R <(curl -fsSL "${patch_url}") || :
list=$(diff --unified "${file}" "${file}.bak" | grep '^+\w' | sed 's/^+//' || :) list=$(diff --unified "${file}" "${file}.bak" | grep '^+\w' | sed 's/^+//' || :)
failed=()
for image in ${list}; do for image in ${list}; do
echo "Checking image: ${image}" 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 done
if [[ ${#failed[@]} -ne 0 ]]; then
echo "Failed images:"
for image in "${failed[@]}"; do
echo " ${image}"
done
exit 1
fi