From 884b9272d0d8b4401264842022e0bfbe4a32984a Mon Sep 17 00:00:00 2001 From: Davide Principi Date: Tue, 1 Oct 2024 17:17:10 +0200 Subject: [PATCH] fixup! Implement pinned tags (#41) Decide if pinned tags are prepended or appended to the tags found in the image registry. --- createrepo.py | 17 +++++++++++++---- pins.yml | 2 +- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/createrepo.py b/createrepo.py index 42841e5..58c68c1 100644 --- a/createrepo.py +++ b/createrepo.py @@ -179,7 +179,13 @@ def is_pngfile(file_path): else: testing_found = True - for tag in pins.get(entry_name, []): + for opin in pins.get(entry_name, []): + if type(opin) is str: + tag = opin + prepend_pin = False + else: + tag = opin['tag'] + prepend_pin = opin['prepend'] semver_tag = semver.parse_version_info(tag) try: # Fetch the pinned image labels @@ -189,14 +195,17 @@ def is_pngfile(file_path): except Exception as ex: print(f'[ERROR] cannot inspect {metadata["source"]}:{tag}', ex, file=sys.stderr) continue - image_version = { "tag": tag, "testing": semver_tag.prerelease is not None, "labels": image_labels, } - print("* Add pinned version", tag, file=sys.stderr) - metadata["versions"].append(image_version) + if prepend_pin: + print("* Prepend pinned version", tag, file=sys.stderr) + metadata["versions"].insert(0, image_version) + else: + print("* Append pinned version", tag, file=sys.stderr) + metadata["versions"].append(image_version) if metadata["versions"]: index.append(metadata) diff --git a/pins.yml b/pins.yml index a0b043a..43edfb7 100644 --- a/pins.yml +++ b/pins.yml @@ -4,4 +4,4 @@ # to ensure they are always visible to clients, allowing for gradual # upgrades between breaking releases. core: - - 2.9.5 # See #7040 #7047 + - { tag: 2.9.6, prepend: True } # See #7040 #7047