Conversation
|
|
||
| // DeleteDockerImage deletes a Docker image from a remote registry. | ||
| // XXX: can we simplify this method signature? | ||
| func DeleteDockerImage(ctx context.Context, named reference.Named, remote remotes.Resolver, hosts docker.RegistryHosts, headers http.Header) error { |
There was a problem hiding this comment.
You're re-parsing the ref twice in this file, once to get the ctrd type and once to get a dist type, both times you are handling errors... the starting point is the output of remote.Resolve, which is guaranteed to be a valid ref?
There was a problem hiding this comment.
Agreed. But I think it's returning the error in both cases right?
The alternatives are to panic (bad, why should the caller crash because of an internal error like this), or to ignore it and potentially produce a malformed destructive request.
|
|
||
| func deleteDockerManifest(ctx context.Context, host docker.RegistryHost, headers http.Header, refHost string, repository string, dgst digest.Digest) error { | ||
| requestHeaders := http.Header{} | ||
| if headers != nil { |
There was a problem hiding this comment.
what are you going to use the additional headers for?
There was a problem hiding this comment.
See tools/imgtool/resolver.go, I'm using it to set the User-Agent. We can't get it out of the resolver, since it's stored privately and not exposed.
3dadf9c to
27d5539
Compare
Signed-off-by: Justin Chadwell <justin@unikraft.com>
27d5539 to
0cf6590
Compare
We use the OCI image distribution protocol to allow deleting images, so as to free up a user's quota.
Fixes https://linear.app/unikraft/issue/TOOL-599/implement-unikraft-image-remove.