oras
oras copied to clipboard
Print out the digest and media type even when a unnamed content is skipped for pulling
Print out the digest and media type even when a unnamed content is skipped for pulling and verbose option is set.
-
unnamed: the to-be-pulled content doesn't have a title annotation(org.opencontainers.image.title).
-
skipped: the content won't be fetch during the pull.
-
For one digest, the skipped log should be only printed out once.
Originally posted by @shizhMSFT in https://github.com/oras-project/oras/pull/412#discussion_r903937191
@wangxiaoxuan273 Could you take a look?
@wangxiaoxuan273 Could you take a look?
Sure
We came up with an edge case and need to confirm the design: imagine a manifest A which has 2 successors, node B and C, both have empty content and thus the same digest. If both of them are unnamed, we will skip them and the current UI will print "skipped 44136fa35v" twice. How should we handle this? @shizhMSFT @qweeah Correct me if I have any mistake.
If both of them are unnamed, we will skip them and the current UI will print "skipped 44136fa35v" twice. How should we handle this?
Let's print twice as it is.
Let's print twice as it is.
I think this is already avoided by current implementation with the printed
map.
There is still an edge case pending for confirm: Should we print both skipped
and downloaded
for content with same digest?
Suppose we pull the below oras artifact:
+-----------------+ +----------------+
| ORAS Manifest +----> OCI Manifest |
+-----------------+ +----------------+
| | |
title:"test" +--config--+ +--v------+
| | |Layers...|+
+-v------v-+ +---------+|+
| {} | +---------+|
+-44136fa3++ +---------+
The config
blob is referred by blobs
in oras manifest with name "test", but used as an unamed config in OCI manifest.
Pulling the oras artifact, the log can be like:
Downloading 44136fa355b3 test
Skipped 44136fa355b3 application/vnd.unknown.config.v1+json
Downloading 181210f8f9c7 bar
Downloaded 44136fa355b3 test
Downloaded 181210f8f9c7 bar
Downloading 698937e06ee5 application/vnd.oci.image.manifest.v1+json
Downloaded 698937e06ee5 application/vnd.oci.image.manifest.v1+json
Downloading f495973f108a application/vnd.cncf.oras.artifact.manifest.v1+json
Downloaded f495973f108a application/vnd.cncf.oras.artifact.manifest.v1+json
Pulled test.somecr.io/oras@sha256:f495973f108a8cf006bf23dc4f690e6c7e0258c9e88444234fb90384d0272227
Digest: sha256:f495973f108a8cf006bf23dc4f690e6c7e0258c9e88444234fb90384d0272227
Should we avoid printing line1, line2 and line4 and the same time? @shizhMSFT @wwwSylvia
@wangxiaoxuan273 Synced offline with @shizhMSFT on the above case, it's acceptable.
As per discussion offline with @qweeah and @shizhMSFT, there are currently four small to-do items in this issue, the order matters:
- [x] docs: add a doc comment before the loop of successors, describing the 2 things done inside the loop. #508
- [x] fix: empty string should not be written to Annotations, and the unnamed check should use the variable
ok
. #509 - [x] feat: when unnamed content is skipped, print its digest and media type only once with
sync.Map.
#510 - [x] fix: the verbose flag should work properly when content is skipped. #511
Closed pr #479 as it went out of control.
Closed by #508, #509, #510, #511