]> git.apps.os.sepia.ceph.com Git - ceph-build.git/commitdiff
prune-quay.py: rely on delete-all-with-same-digest
authorDan Mick <dan.mick@redhat.com>
Tue, 2 Jul 2024 06:28:58 +0000 (23:28 -0700)
committerDan Mick <dan.mick@redhat.com>
Tue, 2 Jul 2024 22:24:38 +0000 (15:24 -0700)
With the new "delete all tags with the same digest", there's no need to
keep the short_sha1 around to match against sha1 tags; they'll be
caught earlier by the 'same-digest' test.

Signed-off-by: Dan Mick <dan.mick@redhat.com>
quay-pruner/build/prune-quay.py

index 7c185b1bb452cc688ae2548e34ce79b19b5d15b8..f470706d06bb2f71103b748c474bc6c5279324a3 100755 (executable)
@@ -230,7 +230,6 @@ def main():
 
     # find all full tags to delete, put them and ref tag on list
     tags_to_delete = set()
-    short_sha1s_to_delete = list()
     for tag in quaytags:
         name = tag['name']
         if 'expiration' in tag or 'end_ts' in tag:
@@ -271,14 +270,8 @@ def main():
                 if args.verbose:
                     print(f'Also marking {digest_map[digest]}, same digest')
 
-        if short_sha1:
-            if args.verbose:
-                print('Marking %s for 2nd-pass deletion' % short_sha1)
-            short_sha1s_to_delete.append(short_sha1)
-
     # now find all the full-sha1 tags to delete by making a second
-    # pass and seeing if the tagname starts with a short_sha1 we
-    # know we want deleted, or if it matches SHA1_RE but is gone from
+    # pass and seeing if the tagname matches SHA1_RE but is gone from
     # shaman
     for tag in quaytags:
 
@@ -286,15 +279,6 @@ def main():
         if 'expiration' in tag or 'end_ts' in tag:
             continue
 
-        if name[0:7] in short_sha1s_to_delete:
-            if args.verbose:
-                print('Marking %s for deletion: matches short_sha1 %s' %
-                      (name, name[0:7]))
-
-            tags_to_delete.add(name)
-            # already selected a SHA1 tag; no point in checking for orphaned
-            continue
-
         match = SHA1_RE.match(name)
         if match:
             sha1 = match[1]