devopshq/artifactory-cleanup

Possibility to use Regex

BlazeF35 opened this issue · 5 comments

It would be interesting if there was the possibility of using regex when configuring a rule in the artifactory-cleanup.yaml file, as in the example below:

 - rule: IncludeFilename
  masks: 
   - "*/production-[0-9]+"
   - "*.develop-[0-9]+"

That way I believe you would have more control over what you want to look for in a repository.

That would be super helpful for deleting draft PR docker images, for example:

- rule: IncludeFilename
  masks: 
    - ".*/pr-[0-9]+"

Doesn't it works for your cases? It includes [0-9]+ as well

- rule: IncludeFilename
  masks: 
   - "*production-*"
   - "*develop-*"

Feel free to create a PR for the feature if it doesn't!

Yes, but I would like a bit more control over what to exclude. In the example above I wanted it to match only pr-12, pr-134, but not pr-something. Similarly it would be nice to have control over uppercase and lowercase, and also quantity of characters, so I could write some regex like [a-z0-9]{40} (an artifact tagged with a git SHA1 for example.

I think that the removal of artifacts by regex will be possible after #118

The rule is available in 1.0.8. thanks to @Hardar3 🥇