goharbor / harbor

An open source trusted cloud native registry project that stores, signs, and scans content.
https://goharbor.io
Apache License 2.0
24.06k stars 4.75k forks source link

Add more versatile replication filters #8614

Open cedvan opened 5 years ago

cedvan commented 5 years ago

Hi all,

Need

I want replicate images from a namespace. But only need replicate tags "stable" to save my storage

On docker hub :

Need get on my harbor :

So ignore pre release version and alpha version to save storage.

Problem

Try configure my replication rule with existing filters (cf. https://github.com/goharbor/harbor/blob/master/docs/user_guide.md#resource-filter)

Problem : It is necessary to update the filter regularly so that my replication rule works in the future

Proposal solutions

1 - Add a pattern to match only number, like \d with regex 2 - Add more versatile replication filter like composer *, ~, ^, <, =, > (cf. https://getcomposer.org/doc/articles/versions.md#versions-and-constraints) 3 - Simply use regex as pattern to configure filter

jcmartins commented 5 years ago

+1

xaleeks commented 5 years ago

we need a common consistent regex support for all features, not just limited to replication. Adding this to next release planning

dkulchinsky commented 4 years ago

@xaleeks was wondering if there's any tentative timeline for this work (this is still tagged for 1.11.0)? I totally agree that there need to be a consistent regex support throughout the different features, our immediate use case is with immutability rules.

HaveFun83 commented 3 years ago

as workaround we use this filter {?,??}.{?,??}.{?,??} for some kind of semver matching

cedvan commented 3 years ago

@HaveFun83 This solution not match versions "X" and "X.X"

HaveFun83 commented 3 years ago

@HaveFun83 This solution not match versions "X" and "X.X"

sure "X" and "X.X" is not a semver annotation so far as i know. https://semver.org/#spec-item-2

dkulchinsky commented 3 years ago

Hey @xaleeks, is there any update you can provide on this? would love to this get slotted for a future version 🙏🏼

badsmoke commented 3 years ago

this topic has also just come up in our company, it would be fabulous if this feature were to be implimented soon.

veyselsahin commented 3 years ago

We are waiting for this feature, too.

badsmoke commented 3 years ago

I have the feeling that this thread receives no attention :-(

cedvan commented 3 years ago

1.11.0 candidate, last version is 2.2.2...

niklasweimann commented 2 years ago

I would love to see this feature in the next release. It's super annoying without this feature

exight commented 2 years ago

This feature would be absolut awesome!

UrsusLvovich commented 2 years ago

My company would also love to have regex support in the tag filtering

wy65701436 commented 1 year ago

ping @qnetter for awareness

Aadeesh11 commented 1 year ago

I have applied for this project on LFX website. I have started learning GO, so can I get some pointers on how to get started with this project.

WilfredAlmeida commented 1 year ago

This issue seems like a great starting point for getting started with a contribution to Harbor. Landed here from the LFX Mentorship projects.

I'd like to get started with the issue regardless.

Can someone point out the file where the regex is written for the filters for me to take a look?

chlins commented 1 year ago

https://github.com/goharbor/harbor/blob/main/src/pkg/reg/filter/artifact.go

Vad1mo commented 1 year ago

I would opt for option 3. Paired with a fast regex lib like re2, it should be possible to filter a big chunk of repos at once

WilfredAlmeida commented 1 year ago

I would opt for option 3. Paired with a fast regex lib like re2, it should be possible to filter a big chunk of repos at once

So will the function IsSemanticVersion() be similar to the other functions in pattern.go do? It'll have regex-matching semantic versioning numbers.

Vad1mo commented 1 year ago

We should also, make sure that the new feature is backwards-compatible.

I see two options.

  1. migrate/convert existing rules into regex
  2. add an option for the user to select a simple option or regex. ( I, personally, think this many options would make the understanding too complex)

I would prefer option 1)

WilfredAlmeida commented 1 year ago

migrate/convert existing rules into regex

Agreed. This can be done. There are 2 approaches to doing this

  1. Migrate existing rules to regex, then add for this issue
  2. Implement current issue filters in regex and then migrate existing rules

I'd prefer option 2 since it'll give us more clarity into regex.

WilfredAlmeida commented 1 year ago

I've drafted a proposal for this issue formulating multiple approaches to solve the issue, please review and share your thoughts.

https://github.com/goharbor/community/pull/221