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

Deletes incorrect images #46

Open
dvazquez1027 opened this issue Aug 12, 2020 · 1 comment
Open

Deletes incorrect images #46

dvazquez1027 opened this issue Aug 12, 2020 · 1 comment

Comments

@dvazquez1027
Copy link

I'm cleaning up a nexus repo after a massive coding effort that generated many images, manifests and tags. Since I made the mistake of using a single docker-hosted repo for snapshots and releases, I have to be careful what I delete. Images destined for a test environment are tagged with 'stage' in addition to the commit SHA. I can't use nexus-cli's 'keep' feature because the image tagged with stage may not be the latest image pushed to the repository. I use this comment to delete the unwanted images:

nexus-cli image tags -n image-name | grep -Ev "stage|There" | xargs -I{} nexus-cli image delete -n image-name -t {}

The grep removes the stage tag and the summary line from the list of image tags. The first run of this command deletes most of the tags with some exceptions. The output has '404 not found' interleaved with the '...successful deleted' messages'. A second run deletes tags missed on the first run. Continuing to run the command until I see no 404's yields a nasty surprise. image-name, all of its manifests and tags (including stage) are gone.

@xmapst
Copy link

xmapst commented Jan 6, 2021

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

2 participants