Add a semver-transformer annotation to assist in converting sloppy tags to semvers #413
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This allows argocd-image-updater to support finding the latest tag even when they don't really follow semver exactly. Some good examples of this:
1.25.7.5604-980a13e02(semver requires at most 3 numeric sections, i.e. 1.2.3, not 1.2.3.4)version-5.6.16(leading chars should bev, notversion-)This PR would let us set the
regexpto be (in pms-docker's case)^(\d+\.\d+\.\d+)\.\d+-.*$', or just(\d+\.\d+\.\d+). The code checks for groups, and if none are found, assumes that the full tag is the semver (same as current behavior). If a capture group is found, however, then it parses the capture group as a semver, rather than the full thing.A few other small things added:
testcommand now supports--semver-transformertestcan't parse--semver-transformeror--allow-tags, it exits with an error messageupdatecan't parse--semver-transformeror--allow-tags, it skips the image with an error message, making it more obvious that you've configured something poorlyMatchFuncRegexpnow creates a closure, removing the need for a separateMatchArgs interface{}on theVersionConstraintstructConstraintMatchMode and its associated consts inpkg/image/version.go`, as they were completely unused.pkg/registry/registry.goso it is more clear why an image is skipped when tracing.Let me know if any of that above list should be rolled back. Some of it was just to clean up what I was looking at, maybe a bad habit of mine 😳
(This supercedes #407)