goharbor / harbor

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

Stop stripping curly braces from tag retention policies #20806

Open sebhoss opened 2 months ago

sebhoss commented 2 months ago

If you are reporting a problem, please make sure the following information are provided:

Expected behavior and actual behavior:

I'm trying to implement a somewhat semver compatible tag retention policy. I've tried the one from https://github.com/goharbor/harbor/issues/12877#issuecomment-2093283017 but removed the v in front since our versions do not use such a prefix. The Harbor UI then stripped the curly braces in front and end of the expression.

Steps to reproduce the problem:

  1. Paste {[0-9],[0-9][0-9],[0-9][0-9][0-9],[0-9][0-9][0-9][0-9]}.{[0-9],[0-9][0-9],[0-9][0-9][0-9],[0-9][0-9][0-9][0-9]}.{[0-9],[0-9][0-9],[0-9][0-9][0-9],[0-9][0-9][0-9][0-9]} into tag retention UI
  2. Observe that Harbor strips the first and last curly braces but leaves all others in there resulting in a wrong expression

Versions: Please specify the versions of following systems.

Additional context:

zyyw commented 2 months ago
Screenshot 2024-08-05 at 11 06 24 AM Screenshot 2024-08-05 at 11 06 47 AM

It seems that the Harbor UI does indeed remove the first and the last curly braces from the tag retention policy, while the http request payload sent to the backend API does contains a valid tag patten. And it does select the artifacts matching the tag patten. Please check the above attached images.

stonezdj commented 2 months ago

It is a by design behavior.

MinerYang commented 2 months ago

Hi @sebhoss ,

Thanks for reaching out to us and we are aware that this design would made some confusion at your side.

Since initially we are trying to simplify this {} pattern when creating rules on UI by auto stripping curly braces. However it is indeed cause some viewing trouble here when complex patterns like yours were showing. Since it is by design for a while and do not affect the filter function, we will not decide to change this behavior immediately, but will put in the backlog if there's more complaining from community hope this design get changed.

Let's keep collecting the feedback from community!

Best, Miner

github-actions[bot] commented 1 day ago

This issue is being marked stale due to a period of inactivity. If this issue is still relevant, please comment or remove the stale label. Otherwise, this issue will close in 30 days.