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

feat: add support for regexp rules #14

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

martinohmann
Copy link
Member

This implements the nice-to-have mentioned in #1.

In addition to matching and replacing image prefixes, this adds support
for using regexp patterns in exclusion and replacement rules.

This should allow to do any possible image transformation. When using a
regexp replacement rule, the replacement pattern can reference
submatches via $N where N is a number or ${name} where name is
the name of a named capture group (e.g. (?P<tag>.+)).

@martinohmann martinohmann requested a review from a team as a code owner March 28, 2022 08:01
In addition to matching and replacing image prefixes, this adds support
for using regexp patterns in exclusion and replacement rules.

This should allow to do any possible image transformation. When using a
regexp replacement rule, the replacement pattern can reference
submatches via `$N` where `N` is a number or `${name}` where `name` is
the name of a named capture group (e.g. `(?P<tag>.+)`).
@pesarkhobeee
Copy link
Contributor

I couldn't agree 100% percent with the logic. If we are going to support regex so why we should have our own way of defining rules too?
What I mean is the below code is unnecessary and repetitive
config.Pattern{Prefix: "someregistry.org"}
when I can do this
config.Pattern{"^someregistry.org"}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants