HylandSoftware/Harbor.Tagd

The rules match only one project

Closed this issue · 2 comments

Hey:
Need to clear only a project the image of the tag.
In the "defaultRule" and "Additional Rules to process", The specified project and repo. Will global match。

config.yml

# Projects, Repositories, and Tags to globally ignore. Must match exactly
ignoreGlobally:
  projects: []
  repos: []
  tags: ['latest']
# The default rule to process if no other rules match
defaultRule:
  project: 'test2'      # A regular expression matching a project
  repo: 'test2'         # A regular Expression matching a repository
  tag: '.*'          # A regular Expression matching a tag
  ignore: ['latest'] # Tags to always keep. Must match exactly
  keep: 1           # The number of tags matching this rule to keep, sorted by creation date
# Additional Rules to process
rules:
- project: 'test1'
  repo: 'test1'
  tag: 'dev.*'
  ignore: ['latest']
  keep: 1

In the "defaultRule" "tag" : Set a rule does not exist tag ,Can only match to a project. Only set up the project and repo not to take effect. But iterates through all project request.

config.yml

# Projects, Repositories, and Tags to globally ignore. Must match exactly
ignoreGlobally:
  projects: []
  repos: []
  tags: ['latest']
# The default rule to process if no other rules match
defaultRule:
  project: 'test2'      # A regular expression matching a project
  repo: 'test2'         # A regular Expression matching a repository
  tag: 'no.*'          # A regular Expression matching a tag
  ignore: ['latest'] # Tags to always keep. Must match exactly
  keep: 1           # The number of tags matching this rule to keep, sorted by creation date
# Additional Rules to process
rules:
- project: 'test1'
  repo: 'test1'
  tag: 'dev.*'
  ignore: ['latest']
  keep: 1

"Harbor.Tagd" for all projects match the request. This leads to the execution time is too long and the influence on the performance of harbor.Whether can according to the rule of the project only initiate the request.

How to match only one project, Match the request for only one project .Please help us to solve, thank you.

nlowe commented

tagd processes all projects and repositories in Harbor by design, there is no way to only process a subset of projects. I would consider accepting a pull request for this but I'm hesitant to add new features. Most of my time is being spent on goharbor/harbor#6654 which will be able to do what you're asking for. We're tentatively planning on slotting that in Harbor 1.9 (the next release) which will be available around August.

nlowe commented

I'm going to close this. As of 1.9 harbor now has a native tag retention feature that you can scope to a single project or repository.