diff --git a/CHANGELOG.md b/CHANGELOG.md index dde68f5d6..c03e4723d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ and **Merged pull requests**. Critical items to know are: The versions coincide with releases on pip. Only major versions will be released as tags on Github. ## [0.0.x](https://github.com/singularityhub/singularity-hpc/tree/main) (0.0.x) + - use quay.io api to list tags since does not conform to oci (0.1.28) - filter out vex and sbom tags (0.1.27) - unpin yaml dependency (0.1.26) - Change format of config command output to only show setting values, not keys, for parseability (0.1.25) diff --git a/shpc/main/container/update/docker.py b/shpc/main/container/update/docker.py index 06b3e1598..35bd98077 100644 --- a/shpc/main/container/update/docker.py +++ b/shpc/main/container/update/docker.py @@ -34,6 +34,10 @@ def tags(self): """ Get image tags. """ + # Quay does not follow the distribution spec, crane only returns 50 + if "quay.io" in self.container_name: + return self.tags_quay() + url = "%s/ls/%s" % (self.apiroot, self.container_name) response = self.get_request(url) tags = [x.strip() for x in response.text.split("\n") if x.strip()] @@ -41,6 +45,26 @@ def tags(self): tags = [x for x in tags if not re.search("[.](sbom|vex)$", x)] return tags + def tags_quay(self): + """ + Custom endpoint to handle quay and pagination. + """ + repository = self.container_name.replace("quay.io/", "", 1) + page = 1 + tags = [] + has_more = True + while has_more: + url = f"https://quay.io/api/v1/repository/{repository}/tag/?limit=100&page={page}" + response = self.get_request(url).json() + new_tags = [ + x.get("name") for x in response.get("tags", {}) if x.get("name") + ] + new_tags = [x for x in new_tags if not re.search("[.](sbom|vex)$", x)] + tags += new_tags + has_more = response.get("has_additional") is True + page += 1 + return tags + def manifest(self, tag): url = "%s/manifest/%s:%s" % (self.apiroot, self.container_name, tag) response = self.get_request(url) diff --git a/shpc/version.py b/shpc/version.py index a9174ac13..1fec20f9f 100644 --- a/shpc/version.py +++ b/shpc/version.py @@ -2,7 +2,7 @@ __copyright__ = "Copyright 2021-2024, Vanessa Sochat" __license__ = "MPL 2.0" -__version__ = "0.1.27" +__version__ = "0.1.28" AUTHOR = "Vanessa Sochat" EMAIL = "vsoch@users.noreply.github.com" NAME = "singularity-hpc"