fix(scripts): give a repository not pushed yet no tags
The registry answers tags/list for a repository that does not exist yet with 404 NAME_UNKNOWN (OCI distribution spec), which failed the Images version step for the first build of a new image such as molecule-controller. A 404 on the first tags/list page now reads as no tags, so the image gets <base>.0; a 404 on a manifest stays an error. Refs #477 Assisted-by: Claude Code
This commit is contained in:
1 parent
0fb4fd70ee
commit
c3a7cef195
2 files changed
+25
-2
No files matched your search
@@ -135,7 +135,13 @@ class Registry:
|
||||
def tags(self):
|
||||
tags, path = [], "tags/list"
|
||||
while path:
|
||||
body, headers = self._get(path)
|
||||
try:
|
||||
body, headers = self._get(path)
|
||||
except RegistryError as exc:
|
||||
# A repository not pushed yet is 404 NAME_UNKNOWN (OCI distribution spec): no tags.
|
||||
if exc.status == 404 and not tags:
|
||||
return []
|
||||
raise
|
||||
tags += body.get("tags") or []
|
||||
link = re.search(r"<[^>]*/tags/list(\?[^>]*)>", headers.get("Link", ""))
|
||||
path = f"tags/list{link[1]}" if link else None
|
||||
|
||||
Reference in new issue
Block a user