acr-cli icon indicating copy to clipboard operation
acr-cli copied to clipboard

--keep filter as inverse of the --filter to all purge images except those that match a pattern (i.e. white listed tags)

Open jan-dolejsi opened this issue 11 months ago • 0 comments

What is the problem you're trying to solve

I have a list (a .csv file) of image tags that should survive purging. Official releases, unofficial releases (being evaluated by a consumer), ... Note that it is a .csv, so I can keep track of the reason as well. One more reason for a .csv artifact for this is that ACR is not the only repository to which I am pushing (and purging).

tag, reason
latest, latest
1.1.0-pre-release-for-xyz, being evaluated by xyz
1.0.0, release

I want to delete images that are more than 7 days old and are not tagged by any of those tags on the keep-list .csv.

It presumably could be achieved by a --filter regular expression, but the expression will become nasty and unmaintainable over time. It presumably should be reflected in the meta data of the manifest. But I am just a simple being, who uses the out-of-the-box Azure DevOps docker build pipeline task.

Describe the solution you'd like A simpler --keep parameter, where I could list the tags that I could pull from the .csv before calling this utility.

... or a suggestion how could I achieve the same without bending over backwards. Thanks, maintainers!

Syntax

For the syntax, I do find filter bit confusing, because it does not indicate whether the result of the filter is to be preserved, or purged. It is not that bad here, because the command is purge, which indicates that what survives the filter shall be killed. But there again, there is the confusion.

jan-dolejsi avatar Mar 18 '24 10:03 jan-dolejsi