Azure / Azure/acr-cli

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

Open
#256 0 comments 2 reactions 0 assignees View on GitHub
enhancement
Dominant language
Go
Stars
70
Forks
52
Avg merge
3d 2h
Merged PRs (30d)
12

Description

**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).

```csv
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.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.