You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
One UX can be: oras pull localhost:5000/json-artifact:v1 --output - | jq and oras returns error if there are multiple blobs associated with the target manifest.
Before upload any blob to a registry, the digest must be specified.
Unless you can get the digest before archiving is done, Otherwise it's not possible to do the streamed uploading.
In order to circumvent this oras could buffer the input stream in memory until for example 64MiB and if this threshold has been reached oras pauses reading new input and first writes the 64MiB into a temporary file with narrow access rights and then resumes reading from the input and directly pipe it into the file. After reaching the EOF oras could calculate the digest either from the in memory buffer or if the content was too large from the file, pack it, and upload the image.
The buffering in memory would only be for performance (and security) reasons, but would mostly be a nice to have feature.
It's not sth oras can circumvent, you cannot get the checksum of the blob before tar finishes writing
I know that is why I proposed the solution with buffering/writing to a temporary file. Thus the calculation of the digest can be done after tar finishes without the need of creating/deleting a temporary file by oneself and therefore support streaming.
Sorry for the late response. Maybe I do not know enough about how oras works, but wouldn't the proposed solution be equivalent to supplying files as arguments but instead of including the files from the arguments the only file to include is the buffer/temporary file?
Maybe the following pseudo script will help you understand my suggestion:
uint8[64MiB] buffer;
read(into=buffer, from=stdin);
Readable inputData;
if (peek(stdio) == EOF) {
inputData = buffer;
else {
File tmpFile = tmpFileCreate();
write(to=tmpFile, from=buffer);
readAll(into=tmpFile, from=stdin);
seek(origin=START, offset=0, file=tmpFile);
inputData = tmpFile;
}
call oras push registry.example:5000 inputData # Yes the CLI is not able to accept buffers, but I hope you get what I intend to say
The following script is a real world example where streaming could come in handy.
Background
We fully manage the life cycle of an OpenShift cluster via a GitLab Pipeline. When creating a cluster with the openshift-install tool some files like terraform state and kube-configs will be created. Those files are needed during the whole life cycle of the cluster (not only in the current pipeline), thus they need to be stored persistently. In our case we use the existing GitLab registry and oras to create an image.
Current way to pull the artifacts from the registry
This way there is no need to create a temporary directory and to know how the file is called within the image (not a problem for us since we named it within the same repo).
Something that might also be helpful in this context is allowing the user to specify the mediaType in the pull command so that oras can return a proper error instead of the application where the output is piped into returning hard to understand errors or just crashing.
Or should that be the job of the artifactType (via the +type suffix perhaps?)? To be honest, when thinking about it right now I never fully understood what artifactType should communicate and what should be handled by the mediaType in the layers list 🤔
@DerRockWolf Layer mediaType is the one you want. artifactType sits on the manifest and says what the artifact as a whole is for — it is the referrers filter key (oras discover --artifact-type) and says nothing about blob encoding. mediaType sits on each layers[] descriptor and says how those particular bytes are encoded, which is what the <file>[:<type>] suffix sets on oras push.
So "fail cleanly instead of feeding garbage into tar" is a layer-mediaType assertion, and oras manifest fetch --media-type is the precedent for the flag shape.
I have summarized this and the other open design questions from this thread, with a concrete approach, in #2197.
Closing in favor of #2197, which collects the open design questions from this thread and proposes a design for oras pull --output -. Please continue the discussion there. Streaming push from stdin is tracked in #1200.
Activity
SteveLasker commentedon Jan 14, 2022
Looks super interesting. Please open a PR for the proposal.
shizhMSFT commentedon May 7, 2022
This is an interesting one. How would you handle multiple files?
FeynmanZhou commentedon Aug 31, 2022
Hi @ndeloof ,
Could you pls elaborate more on your use case?
Actually, ORAS CLI v0.15 will provide
oras manifest fetchandoras blob fetchthat might meet your need. You can check out this doc for details.TerryHowe commentedon Dec 5, 2022
Seems like the output of this should be a tgz so multiple files can be supported
shizhMSFT commentedon Mar 15, 2023
One UX can be:
oras pull localhost:5000/json-artifact:v1 --output - | jqandorasreturns error if there are multiple blobs associated with the target manifest.15 remaining items
qweeah commentedon Nov 29, 2023
It's not sth oras can circumvent, you cannot get the checksum of the blob before
tarfinishes writingProbstDJakob commentedon Nov 29, 2023
I know that is why I proposed the solution with buffering/writing to a temporary file. Thus the calculation of the digest can be done after
tarfinishes without the need of creating/deleting a temporary file by oneself and therefore support streaming.qweeah commentedon Nov 29, 2023
Yes, the digest calculation can be done while packing and this optimization has already been applied in oras-go.
The question is after getting the digest, oras CLI still need to go through the archive file to upload it.
ProbstDJakob commentedon Dec 10, 2023
Sorry for the late response. Maybe I do not know enough about how oras works, but wouldn't the proposed solution be equivalent to supplying files as arguments but instead of including the files from the arguments the only file to include is the buffer/temporary file?
Maybe the following pseudo script will help you understand my suggestion:
uint8[64MiB] buffer; read(into=buffer, from=stdin); Readable inputData; if (peek(stdio) == EOF) { inputData = buffer; else { File tmpFile = tmpFileCreate(); write(to=tmpFile, from=buffer); readAll(into=tmpFile, from=stdin); seek(origin=START, offset=0, file=tmpFile); inputData = tmpFile; } call oras push registry.example:5000 inputData # Yes the CLI is not able to accept buffers, but I hope you get what I intend to sayqweeah commentedon Dec 11, 2023
@ProbstDJakob Besides from the seek operation, what you described is already implemented in here.
P.S. I think this discussion has gone too far from this issue and I have created #1200 so we can continue there.
ProbstDJakob commentedon Dec 11, 2023
The following script is a real world example where streaming could come in handy.
Background
We fully manage the life cycle of an OpenShift cluster via a GitLab Pipeline. When creating a cluster with the
openshift-installtool some files like terraform state and kube-configs will be created. Those files are needed during the whole life cycle of the cluster (not only in the current pipeline), thus they need to be stored persistently. In our case we use the existing GitLab registry and oras to create an image.Current way to pull the artifacts from the registry
Possible way to pull the artifacts from the registry with pipelining
This way there is no need to create a temporary directory and to know how the file is called within the image (not a problem for us since we named it within the same repo).
Counterpart
See #1200 (comment)
Horiodino commentedon Jan 21, 2025
Hi, if no one is working on it, I’d like to take it on. Is it still open?
TerryHowe commentedon Jan 22, 2025
It is assigned to @yizha1 and @shizhMSFT although I don't think either of them is working on this.
shizhMSFT commentedon Jan 22, 2025
@Horiodino Thanks for showing the interests. Please propose a design before heading to any implementations.
DerRockWolf commentedon Sep 26, 2026
Something that might also be helpful in this context is allowing the user to specify the
mediaTypein the pull command so that oras can return a proper error instead of the application where the output is piped into returning hard to understand errors or just crashing.Or should that be the job of the
artifactType(via the+typesuffix perhaps?)? To be honest, when thinking about it right now I never fully understood whatartifactTypeshould communicate and what should be handled by themediaTypein thelayerslist 🤔TerryHowe commentedon Sep 28, 2026
@DerRockWolf Layer
mediaTypeis the one you want.artifactTypesits on the manifest and says what the artifact as a whole is for — it is the referrers filter key (oras discover --artifact-type) and says nothing about blob encoding.mediaTypesits on eachlayers[]descriptor and says how those particular bytes are encoded, which is what the<file>[:<type>]suffix sets onoras push.So "fail cleanly instead of feeding garbage into
tar" is a layer-mediaTypeassertion, andoras manifest fetch --media-typeis the precedent for the flag shape.I have summarized this and the other open design questions from this thread, with a concrete approach, in #2197.
TerryHowe commentedon Oct 22, 2026
Closing in favor of #2197, which collects the open design questions from this thread and proposes a design for
oras pull --output -. Please continue the discussion there. Streaming push from stdin is tracked in #1200.oras pull --output -) #2197