argocd-image-updater icon indicating copy to clipboard operation
argocd-image-updater copied to clipboard

Parsing semantic versions from tags with prefixes

Open 0m1xa opened this issue 3 years ago • 4 comments

Is your feature request related to a problem? Please describe. It would be great to have a possibility to parse prefixes from tags with semantic versioning. There was a similar issue with semantic versioning with suffixes. But in my case the solution doesn't work. In my repo there are several tags with names like someenv-<semver>

m1xa/nginx:someenv-1.15
m1xa/nginx:someenv-1.15.2
m1xa/nginx:someenv-1.16

I run argocd-image-updater and it can't detect tag with semver. argocd-image-updater test --update-strategy semver --kubeconfig ~/.kube/config --registries-conf ~/argocd-image-updater.conf --semver-constraint 0-1.x.x --allow-tags 'regexp:^someenv-.*$' m1xa/nginx

DEBU[0000] Creating Kubernetes client from /home/m1xa/.kube/config 
INFO[0000] getting image                                 image_name=m1xa/nginx registry=
DEBU[0000] rate limiting is disabled                     prefix= registry="https://registry-1.docker.io"
DEBU[0000] rate limiting is disabled                     prefix=nexus-docker.local registry="https://nexus-docker.local"
INFO[0000] Loaded 2 registry configurations from /home/m1xa/argocd-image-updater.conf 
INFO[0000] Fetching available tags and metadata from registry  image_name=m1xa/nginx
INFO[0001] Found 3 tags in registry                      image_name=m1xa/nginx
DEBU[0001] could not parse input tag someenv-1.15 as semver: Invalid Semantic Version 
DEBU[0001] could not parse input tag someenv-1.15.2 as semver: Invalid Semantic Version 
DEBU[0001] could not parse input tag someenv-1.16 as semver: Invalid Semantic Version 
INFO[0001] no newer version of image found  

Describe the solution you'd like A way to configure image updater parser with prefixes in semantic versioning

Describe alternatives you've considered I can use the latest mechanism at that moment.

Additional context

argocd-image-updater: v0.11.3+f62b7d7
  BuildDate: 2022-02-15T10:33:30Z
  GitCommit: f62b7d7841a42030fe4c75de1951c46b0e7fca2e
  GoVersion: go1.16.13
  GoCompiler: gc
  Platform: linux/amd64

0m1xa avatar Feb 15 '22 10:02 0m1xa

The case with semantic versioning with certain suffixes is a different one: these strings are a valid semantic version. With prefixes, that's not the case, since the semver spec does not allow prefixes.

jannfis avatar Feb 16 '22 21:02 jannfis

Ok. Maybe it is possible to use substitution or substitution with regex in that case? And after substitution check the semver version.

0m1xa avatar Feb 16 '22 21:02 0m1xa

I came here to ask the same question.

I'm planning on namespacing my semver tags to make monorepo management easier. Prefixes are much more clear than postfixes for sorting releases

With prefixes, that's not the case, since the semver spec does not allow prefixes.

I hear you, but would argue that a prefix is effectively a namespace and not part of the semver, which is still valid

curtiscook avatar Mar 20 '22 17:03 curtiscook

There is a draft PR which supposedly will implement this: #413

jannfis avatar Apr 12 '22 08:04 jannfis