Skip to content

Commit c8bbe9b

Browse files
marmijodustymabe
authored andcommitted
cmd-coreos-prune: handle expired or deleted tags in skopeo inspect
When a tag is expired or been garbage collected in Quay, skopeo inspect returns a "unknown" error with a message like: "Tag <tag> was deleted or has expired. To pull, revive via time machine" Check for this condition and skip raising the exception, instead just return since the tag has already been GC'd.
1 parent c0092f8 commit c8bbe9b

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/cmd-coreos-prune

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -520,6 +520,12 @@ def skopeo_inspect(repo, tag, auth):
520520
if exit_code == 2:
521521
print(f"\t\t\tSkipping deletion for {repo}:{tag} since the tag does not exist.")
522522
return False
523+
# Quay could return an "unknown" error code when a tag has expired or been GC’d.
524+
# Check for this error message specifically and avoid raising an exception in that
525+
# case, since the image is already gone.
526+
elif "Tag" in error_message and "was deleted or has expired" in error_message:
527+
print(f"\t\t\tSkipping deletion for {repo}:{tag} since the tag was deleted or has expired.")
528+
return False
523529
else:
524530
# Handle other types of errors
525531
raise Exception(f"Inspection failed for {repo}:{tag} with exit code {exit_code}: {error_message}")

0 commit comments

Comments
 (0)