oras icon indicating copy to clipboard operation
oras copied to clipboard

feat: Support pulling arbitrary manifest config

Open lizMSFT opened this issue 2 years ago • 7 comments

#274 enables the CLI to pull manifest config. However, the user must provide the desired media type of the config or use the default. This PR allows pulling arbitrary manifest config.

If the user does not specify the desired media type, the code will get the 0th indexed node as the manifest config if its parent node is a manifest. Note: For a manifest, the 0th indexed element is always a manifest config. ref: https://github.com/oras-project/oras-go/blob/6a09a65fcc0b96c3448e988c1727ed154c2388ea/content/graph.go#L58

Examples:

$ oras pull --manifest-config config.json localhost:5000/hello:latest
Downloaded  3ad08644ab5a artifact.txt
Downloaded  98df5c495df6 config.json
Pulled localhost:5000/hello:latest
Digest: sha256:8627dfe823698a566e105d961045eafcaa9115b6faf1f625edd85df558421bd5

Resolves: #275 Signed-off-by: Zoey Li [email protected]

lizMSFT avatar Aug 04 '22 03:08 lizMSFT

@shizhMSFT Do we need to print warning if: no config media type is specified and there is already a name(title annotation) in the config descriptor?

qweeah avatar Aug 05 '22 03:08 qweeah

Recommend simplifying this to to just oras pull --config. I don't believe there is any other object in OCI that is called config.

sajayantony avatar Aug 10 '22 18:08 sajayantony

Codecov Report

Merging #480 (e098299) into main (7c6fbdb) will not change coverage. The diff coverage is n/a.

@@           Coverage Diff           @@
##             main     #480   +/-   ##
=======================================
  Coverage   55.69%   55.69%           
=======================================
  Files           6        6           
  Lines         237      237           
=======================================
  Hits          132      132           
  Misses         90       90           
  Partials       15       15           

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

codecov-commenter avatar Aug 10 '22 18:08 codecov-commenter

--config is already reserved for auth config.

See

  -c, --config stringArray       auth config path

shizhMSFT avatar Aug 12 '22 07:08 shizhMSFT

@lizMSFT @sajayantony @qweeah There is another option that we can rename --config to --auth-config and use --config for --manifest-config.

shizhMSFT avatar Aug 12 '22 12:08 shizhMSFT

@lizMSFT @sajayantony @qweeah There is another option that we can rename --config to --auth-config and use --config for --manifest-config.

How about --cred-file? Previously we used --config to align with the naming of docker config but it's not easy to understand out of the docker context.

We can still use -c for short.

qweeah avatar Aug 12 '22 14:08 qweeah

This is tricky. If you have a config file that’s for auth and config file for manifest. Im ok with manifest config or auth config. since —config /auth-config is a global flag and if it was there before then we might not want to break previous non alpha - releases. Basically you folks decide. 😁

sajayantony avatar Aug 12 '22 15:08 sajayantony

Yes, I am feeling the same. It would be better not change the name for now since it will bring breaking changes and it currently doesn't bring additional value. Besides, consumers will need to adjust accordingly, which might make them confused.

lizMSFT avatar Aug 14 '22 14:08 lizMSFT

Create a new issue for rename --manifest-config: https://github.com/oras-project/oras/issues/495 cc @shizhMSFT @qweeah @sajayantony

lizMSFT avatar Aug 15 '22 08:08 lizMSFT

@sajayantony Let's continue the discussion in #495.

shizhMSFT avatar Aug 15 '22 08:08 shizhMSFT

@shizhMSFT Do we need to print warning if: no config media type is specified and there is already a name(title annotation) in the config descriptor?

No, we don't.

shizhMSFT avatar Aug 15 '22 08:08 shizhMSFT