Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow real regexp patterns for tag matching in retention policy/immutability rules #19328

Open
Cobraeti opened this issue Sep 7, 2023 · 2 comments
Labels
kind/requirement New feature or idea on top of harbor

Comments

@Cobraeti
Copy link

Cobraeti commented Sep 7, 2023

Is your feature request related to a problem? Please describe.
Hello, I'm trying to create an immutability rule for all SemVer tags corresponding to "normal" release versions (refered as <version core> at https://semver.org/).
It seems even the tag matching is made using doublestar, wich is really limiting to describe widely-used SemVer tags, as [0-9].[0-9].[0-9] would only match versions with major/minor/patch up to 9, whereas *.*.* would match versions with major/minor/patch even over 9 but also any pre-release or build variants of the same version...

Describe the solution you'd like
I would have expected tag matching rules to use a less limiting regexp engine, like https://pkg.go.dev/regexp#Regexp.Match, as doublestar is really nice for repo paths matching, but really poor for SemVer or any more generic tags matching...

Describe the main design/architecture of your solution
Replace doublestar.Match by regexp.Match for tag rules (breaking API, maybe not desired) or allow kind: 'regexp' in addition to kind: 'doublestar' (by creating a regexp selector available at least for RetentionSelector and ImmutableSelector + maybe RetentionSelectorMetadata)

Describe the development plan you've considered
I could contribute directly for option 1, but option 2 might be a bit too high-level for my coding skills 😅
Unless option 2 is just adding regexp/selector.go and regexp/selector_test.go to /src/lib/selector/selectors ? but I bet I'm dreaming 🤣

Additional context
I'm currently stuck with Harbor version 2.5.6 because of my cloud provider offer, but able to start a higher version aside with a custom deployment if it could help testing 😉

@AzHicham
Copy link

AzHicham commented Jan 3, 2024

+1

Right now I can make tag like x.y.z immutable but this will also include dev tags like x.y.z-dev.N which is not the desired behavior

@sebhoss
Copy link

sebhoss commented Feb 4, 2024

I've opened bmatcuk/doublestar#91 to ask for quantifier support for character classes in doublestar which would at least allow [0-9]+.[0-9]+.[0-9]+ matching

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/requirement New feature or idea on top of harbor
Projects
None yet
Development

No branches or pull requests

4 participants