Replies: 1 comment
-
A few updates:
|
Beta Was this translation helpful? Give feedback.
0 replies
# for free
to join this conversation on GitHub.
Already have an account?
# to comment
-
Question
Is the upload of an empty blob or layer supported -- or defined at all -- in the distribution spec?
Background/Context
I'm having trouble finding a definitive answer in the spec itself. I suppose the question usually wouldn't be relevant for 'classic' Docker/OCI images, as the client wouldn't create an empty layer locally to begin with. This would equate to no change to the file system and thus would be pointless to push.
However, my use case is to utilize OCI registries to host a different type of OCI object, one in which a layer may equate 1:1 to a file. A simple example would be a static site. Currently, my approach is to upload each static asset as its own individual layer. Which leads to the empty file (layer) scenarios: there happen to be use cases in this static site generator domain (and beyond) for empty files; think
.nojeckyll
,.gitkeep
and others.Implementation samples
The OCI client library I've been using, krustlet/oci-distribution, actually prevents uploading empty blobs/layers by default. Out of curiousity, I updated the code to indeed push empty blobs, sending an empty body on the request as well as header key/values of
Content-Length: 0
and, in the case of chunked uploads,Content-Range: 0-0
(spoiler, perhaps this latter header should not be set when the upload is a one-chunk, 0 byte blob; see below).It turns out, this leads to different behavior between a handful of distribution implementations surveyed:
Content-Length
andContent-Range
headers included). The object is succesfully pushed and I've confirmed that the expected empty files are present in the live application.Content-Range: 0-0
header/value (as it always performs a+1
as seen here)Content-Range
altogether, the one-chunk, 0 byte upload is accepted (and the application has the expected empty files)Beta Was this translation helpful? Give feedback.
All reactions