You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I stumbled across an issue in regards of how I build and tag my docker images.
I first build and push them by digest (so without a tag/label) to build them in a GitHub matrix action for multiple architectures.
In a second step I join those images into one manifest using docker buildx imagetools create.
If artifactory-cleanup stumbles upon such images it crashes if there's a KeepLatestNVersionImagesByProperty rule.
def get_version(self, artifact) -> Tuple:
"""Parse property and get version from it"""
value = artifact["properties"][self.property]
+ if value.startswith("sha256:"):+ value = artifact["properties"].get("docker.label.org.opencontainers.image.version")
match = re.match(self.custom_regexp, value)
if not match:
raise ValueError(f"Can not find version in '{artifact}'")
version_str = match.group()
if version_str.startswith("v"):
version_str = version_str[1:]
return tuple(["v"] + list(map(int, version_str.split("."))))
version = tuple(map(int, version_str.split(".")))
return version
Unfortunately this still results in a crash if it's something completely unexpected like a branch name etc.
Is it possible to not raise an error in this case and simply log a warning to stdout? I would expect artifactory-cleanup to treat those images according to the remaining rules (e.g. DeleteNotUsedSince et al).
The text was updated successfully, but these errors were encountered:
Is it possible to not raise an error in this case and simply log a warning to stdout?
It's a solution.
We should either explicitly filter out not valid artifacts by using other rules before passing it to the KeepLatestNFilesInFolder.
KeepLatestNFilesInFolder was written when there was "docker buildx imagetools create" so feel free to adjust and contiribute the solution if anyone find it!
Hey there,
Thank you for maintaining this great project.
I stumbled across an issue in regards of how I build and tag my docker images.
I first build and push them by digest (so without a tag/label) to build them in a GitHub matrix action for multiple architectures.
In a second step I join those images into one manifest using
docker buildx imagetools create
.If artifactory-cleanup stumbles upon such images it crashes if there's a
KeepLatestNVersionImagesByProperty
rule.ValueError: Can not find version in [..]
Note: I did redact some values with
[..]
, also thedocker.label.version
property is manually defined in the Dockerfile and independent from tags etc.A quick and easy fix for this would be to add those two lines after
artifactory-cleanup/artifactory_cleanup/rules/docker.py
Line 216 in 7e5ba2a
Unfortunately this still results in a crash if it's something completely unexpected like a branch name etc.
Is it possible to not raise an error in this case and simply log a warning to stdout? I would expect artifactory-cleanup to treat those images according to the remaining rules (e.g.
DeleteNotUsedSince
et al).The text was updated successfully, but these errors were encountered: