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

How to keep tags with "keep-tags-like"?

Open Isegrimm opened this issue 3 years ago • 1 comments

Hi, we’re using registry-cli for automated housekeeping of our docker repository. To clean old images we daily run this command: registry-cli -r <URL> -i <image> --keep-tags-like "release" -–delete

The intent is to keep the 10 latest images (default) including any image that has a tag containing “release” in the name, and delete everything else. However, we think the result is that images with “release” tags will be deleted as well.

We tested this by pushing an image tagged 1.0.6479-4c40a8 to the repo, and added a tag “TestTagJenkins” to it. When querying the repository we saw the two seperate entries.

Then we ran the following: registry-cli -r <URL> -i <image> --tags-like "1.0.6479-4c40a8" --keep-tags "TestTagJenkins" --delete-all --dry-run The output showed that it would keep the image.

Then we ran the following command: registry-cli -r <URL> -i <image> --tags-like "1.0.6479-4c40a8" --keep-tags-like "TestTagJenkins" --delete-all --dry-run The output did not give a message that it would keep it, and after removing the –dry-run it indeed removed it.

According to the documentation the “keep-tags”-option overrides the “tags”-option and it does work as intended when we use “--keeps-tags” instead of “--keep-tags-like” and specify a specific release-tag, but our images typically have a version in the name that we cannot predict, like “release-1.10.3” or “release-2.29.13”, so we have to use "--keep-tags-like".

Assuming our test is correct, how can we filter those images and prevent them from being deleted?

Isegrimm avatar Sep 28 '21 13:09 Isegrimm

Browsing the older open issues it seems this is a known problem for a while already, but a fix is not merged: Duplicate of #92, #85 and #84

Is it clear why the fix is not merged yet? Is it another problem that has to be fixed first?

Isegrimm avatar Oct 07 '21 12:10 Isegrimm