-
Notifications
You must be signed in to change notification settings - Fork 49
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
Fix various with image pushes. #22
Conversation
Pushing images with multiple layers now works, because the client has an upload session per layer, rather than an upload session per blob. The push response simlarly doesn't return an image_url, as that doesn't make sense for images with multiple layers. Manifests are canonicalized per https://github.com/opencontainers/image-spec/blob/main/considerations.md?plain=1#L18 The ImageData struct no longer produces a digest from the contained layers as digests are applicable to content blobs, or manifests. Signed-off-by: Tom Fay <tomfay@microsoft.com>
Signed-off-by: Tom Fay <tomfay@microsoft.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me, I left some minor comments
Signed-off-by: Tom Fay <tomfay@microsoft.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for having addressed the feedback
Looking forward for release with this patch. I'm hitting similar issues. |
@cardil 👍 I personally would like to go through a bunch of open PR, so that we break the API fewer times :) |
Fix various with image pushes.
I've been trying to use this crate to pull images from one registry and push them to another - I've fixed a few issues I encountered, and added a test for roundtrip pull/pushing an image with multiple layers.
The existing push doesn't work for images with multiple layers because the code conflates chunks and layers. e.g it starts a push session for ImageData, then proceeds to push all the layers as chunks in a single blob.
I've updated this to have a push session per layer, per the spec.
The push response for
Client::push
similarly doesn't return an image_url, as thatdoesn't make sense for images with multiple layers.
The ImageData struct no longer produces a digest from the contained
layers as digests are applicable to content blobs, or manifests.
If the manifest being pushed has a media type, then use that instead of the OCI V1 media type. (If the manifest is not the OCI v1 media type then the registry will reject the manifest push.)
Manifests are canonicalized to canonical json per
https://github.com/opencontainers/image-spec/blob/main/considerations.md?plain=1#L18.
I've also updated the manifest structs to not serialize unspecified optional fields as null. That complies with the json schemas in the image-spec repo. The spec wasn't clear on the behaviour here, so I raised opencontainers/image-spec#894. I probably should have done that in a separate PR - happy to drop it from this and submit in a new one if that's contravertial.