Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Isegrimm opened this issue Sep 28, 2021 · 1 comment
Open

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

Isegrimm opened this issue Sep 28, 2021 · 1 comment

Comments

@Isegrimm
Copy link

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
Copy link
Author

Isegrimm commented Oct 7, 2021

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant