Skip to content

Commit

Permalink
fixup! Implement pinned tags (#41)
Browse files Browse the repository at this point in the history
Decide if pinned tags are prepended or appended to the tags found in the
image registry.
  • Loading branch information
DavidePrincipi committed Oct 1, 2024
1 parent b816c80 commit 884b927
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
17 changes: 13 additions & 4 deletions createrepo.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion pins.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 884b927

Please sign in to comment.