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

[Feat]: ZUI: Add ability to delete images and repositories from ZUI #364

Closed
bfreidank opened this issue Jul 18, 2023 · 12 comments · Fixed by #401
Closed

[Feat]: ZUI: Add ability to delete images and repositories from ZUI #364

bfreidank opened this issue Jul 18, 2023 · 12 comments · Fixed by #401
Assignees
Labels
rm-external External roadmap item ui ZOT web-based UI related tasks

Comments

@bfreidank
Copy link

Is your feature request related to a problem? Please describe.
Add ability to delete images and repositories from ZUI and cleanup data from backend data directory.

Describe the solution you'd like
Add ability in ZUI to remove images or repositories. Recommend adding validation step before removal and RBAC role to allow deletes for users.

Describe alternatives you've considered
N/A

@andaaron andaaron added the ui ZOT web-based UI related tasks label Jul 19, 2023
@raulkele
Copy link
Collaborator

Thanks for opening up a feature request @bfreidank , I'm not sure if this feature would fit for the current idea behind zui. Originally zui was designed as a way to browse a zot registry more easily, in a read-only manner. All the image data operations like adding/updating/deleting were not planned to be part of zui and are performed through a cli tool. Perhaps @rchincha can chime in, do we maybe want this for a future release?

@bfreidank
Copy link
Author

@raulkele Thank you for noting that this behavior/functionality is outside the current intended scope.

Would you be able to provide usage instructions for the cli tool for image data operations for adding/updating/deleting?

The reason I ask is looking at the zli and skopeo documentation it doesn't appear updating or deleting are part of those tools.

Thank you

@raulkele
Copy link
Collaborator

We do offer the cli commands to pull images in zui. Having an admin specific interface is one of the goals we currently have. Perhaps this would fit there. In the meantime maybe @rchincha and @mbshields can see if this scenario could be added to the documentation.

@rchincha
Copy link
Contributor

@bfreidank zli is mainly used as a view-only tool currently (similar to the UI).

Using skopeo to delete can be used but one has to be careful to only delete images with tags. We have had trouble with it since it is not careful about not deleting shared blobs, etc. Latest zot/main should handle most such scenarios though.

The safest option IMO is:

curl -X DELETE -u https://server-address:port/v2//manifests/

@bfreidank
Copy link
Author

@rchincha Thank you for confirming zli is meant as a view-only tool.

Ah that is good to know that skopeo can have unintended results if an image does not contain a tag. Will be a tool to tread lightly with.

Thank you for your preferred safest option to remove images.

@bfreidank
Copy link
Author

@rchincha
The only problem with the following method is that the ZUI and database are not cleaned up properly leaving references to the “removed” image:

curl -X DELETE -u https://server-address:port/v2//manifests/

@andaaron
Copy link
Contributor

andaaron commented Jul 24, 2023

@rchincha The only problem with the following method is that the ZUI and database are not cleaned up properly leaving references to the “removed” image:

curl -X DELETE -u https://server-address:port/v2//manifests/

If you are experiencing leftover images in the DB after deleting imaging using the manifests endpoint, it is a bug.
Can you provide more details about the scenario in which you are experiencing this?

Just to be sure, a more precise command example is:
curl --request DELETE http://127.0.0.1:5000/v2/centos/manifests/centos7.9.2009 -u 'user:password'
Where centos is the repo name and centos7.9.2009 is the tag.

@bfreidank
Copy link
Author

Hello @andaaron @rchincha,

Going through the following scenario:

Check tags available for alpine:

curl -X GET https://server-address:5000/v2/alpine/tags/list

output:
{"name":"alpine","tags":["latest"]}

Initiate delete of latest image:
curl -X DELETE -u 'user:password' https://server-address:5000/v2/alpine/manifests/latest

Check tags available for alpine:

curl -X GET https://server-address:5000/v2/alpine/tags/list

output:
{"name":"alpine","tags":[]}

The alpine repo with no tags shows in the following locations:

If you remove the entry manually in the file system it gets removed from /v2/_catalog however the entry in the ZUI with no tags stays in place indefinitely.

Expected behavior: When no image tags present repository with name would be cleaned up and removed from ZOT data directory and ZUI

@andaaron
Copy link
Contributor

OK, understood the request. It is not implemented at the moment, we will look into it.

@bfreidank
Copy link
Author

Sounds great! Thank you @andaaron for adding it to features to be considered.

@raulkele
Copy link
Collaborator

Should we open an issue in the zot repo and close this one?

@andaaron
Copy link
Contributor

We have project-zot/zot#1634, which does not have all these details, but I think it's the same request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
rm-external External roadmap item ui ZOT web-based UI related tasks
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants