oras-project / rust-oci-client

A Rust crate to interact with OCI registries
Apache License 2.0
96 stars 53 forks source link

Fix chunked push of big layers #37

Closed flavio closed 2 years ago

flavio commented 2 years ago

The previous chunked push code wasn't really making multiple chunked uploads.

Given a layer with size 8Mb, the code began a chunked upload session, but the 1st chunked upload was done against the whole 8Mb of data.

That caused issues with registries as GitHub Container Registry, which have a limit of 4Mb per chunked upload.

This code is actually splitting the chunks into 4Mb blobs and sending each one of the individually.

This fixes the issue reported inside of https://github.com/krustlet/oci-distribution/issues/35

This change broke a unit test, but looking closer at it, the test wasn't testing a correct scenario. The unit test has been updated to reproduce a chunked upload made by several smaller chunks.