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 that
doesn'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.)
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 that doesn'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 https://github.com/opencontainers/image-spec/issues/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.