oras icon indicating copy to clipboard operation
oras copied to clipboard

Support manifest/blob/repository/tag commands in ORAS

Open qweeah opened this issue 3 years ago • 2 comments

Repository / Tags

  • [ ] #470
  • [ ] #469
  • [ ] #471

Manifest

  • [ ] #472
  • [ ] #301
  • [ ] #473

Blob

  • [ ] #476
  • [ ] #475
  • [ ] #474

qweeah avatar Jul 25 '22 08:07 qweeah

I am highly interested in following tasks and want to start working on them. Please assign them to me.

  • [ ] oras repository list: List repository
  • [ ] oras repository show-tags: List tags of a repository

junczhu avatar Jul 25 '22 09:07 junczhu

These are awesome additions to ORAS and will make interacting with an OCI registry so much easier.

sajayantony avatar Jul 26 '22 19:07 sajayantony

Below is the UX design for ORAS manifest commands and ORAS blob commands from our discussion @shizhMSFT @qweeah @yuehaoliang-microsoft @lizMSFT

# Push
oras manifest push <name> - # read from stdin, return error if --password-stdin flag is used at the same time
oras manifest push <name> <path> # stdout human readable messages 
oras manifest push <name> <path> --media-type <mediaType>
oras manifest push <name> <path> --descriptor # stdout json descriptor

oras blob push <name> - # read from stdin, return error if --password-stdin flag is used at the same time
oras blob push <name> <path> # stdout human readable messages 
oras blob push <name> <path> --descriptor # stdout json descriptor


# Delete
oras manifest delete <name>
# warn users that other tags might also get deleted
# need add delete confirmation --yes or -y, ref: https://docs.microsoft.com/en-us/cli/azure/acr/manifest?view=azure-cli-latest#az-acr-manifest-delete
oras manifest delete <name> --yes --descriptor # stdout json descriptor

oras blob delete <name@digest>
# need add delete confirmation --yes or -y, ref: https://docs.microsoft.com/en-us/cli/azure/acr/manifest?view=azure-cli-latest#az-acr-manifest-delete
oras blob delete <name@digest> --yes --descriptor # stdout json descriptor 


# Fetch
# need pretty flag
oras manifest fetch <name> # default: stdout manifest content (output to stdout)
oras manifest fetch <name> --output <path>
# special case: oras manifest fetch <name> --output -
# fetch manifest to stdout
# --output - cannot be used with --descriptor at the same time
oras manifest fetch <name> --descriptor
oras manifest fetch <name> --output <path> --descriptor # stdout descriptor, save manifest content into file path

oras blob fetch <name@digest> # return error, either output or descriptor need to be provided, or provide both
oras blob fetch <name@digest> --output <path> # stdout progess status, save blob content into file path. should support pv to view progress of commands
# special case: oras blob fetch <name> --output -
# fetch blob to stdout, stdout NOT display progess status
# --output - cannot be used with --descriptor at the same time
oras blob fetch <name@digest> --descriptor # stdout descriptor (need pretty)
oras blob fetch <name@digest> --output <path> --descriptor # stdout descriptor, save blob content into file path

please let us know if you have any suggestions, thanks cc @sajayantony @FeynmanZhou @yizha1

lizMSFT avatar Aug 25 '22 07:08 lizMSFT

For manifest fetch, what is the scope of --pretty? Should below commands store prettified manifest to file?

oras manifest fetch <name> --output <path> --pretty
oras manifest fetch <name> --output <path> --pretty --descriptor # the descriptor will be prettified

Storing prettified manifest to file makes more sense to me, e.g. below commands should saves indentical file content to <path>

oras manifest fetch <name> --pretty > <path> 
oras manifest fetch <name> --output <path> --pretty 
oras manifest fetch <name> --output - --pretty > <path> # shouldn't but could
oras manifest fetch <name> --output <path> --pretty --descriptor

@shizhMSFT @FeynmanZhou @yizha1 Can you help confirm. /cc @yuehaoliang-microsoft @lizMSFT

qweeah avatar Aug 26 '22 04:08 qweeah

If user can redirect the pretty output to a file using >, then we don't need a --output flag, right?

yizha1 avatar Aug 26 '22 05:08 yizha1

If user can redirect the pretty output to a file using >, then we don't need a --output flag, right?

Yes, but the --output is designed for the scenario that 1) a user wants to save fetched manifest to a file somwhere and 2) gets the descriptor in stdout.

qweeah avatar Aug 26 '22 07:08 qweeah

For manifest fetch, what is the scope of --pretty? Should below commands store prettified manifest to file?

oras manifest fetch <name> --output <path> --pretty
oras manifest fetch <name> --output <path> --pretty --descriptor # the descriptor will be prettified

Storing prettified manifest to file makes more sense to me, e.g. below commands should saves indentical file content to <path>

oras manifest fetch <name> --pretty > <path> 
oras manifest fetch <name> --output <path> --pretty 
oras manifest fetch <name> --output - --pretty > <path> # shouldn't but could
oras manifest fetch <name> --output <path> --pretty --descriptor

@shizhMSFT @FeynmanZhou @yizha1 Can you help confirm. /cc @yuehaoliang-microsoft @lizMSFT

Good point. I'd suggest that --pretty only applies to data output to stdout.

In other words,

oras manifest fetch <name> --pretty > <path>                     # manifest prettified
oras manifest fetch <name> --output <path> --pretty              # nothing prettified
oras manifest fetch <name> --output - --pretty > <path>          # manifest prettified
oras manifest fetch <name> --output <path> --pretty --descriptor # descriptor prettified

or we drop the --pretty option for all commands.

shizhMSFT avatar Aug 26 '22 15:08 shizhMSFT

The top-level ORAS manifest and ORAS blob commands look good. But the description copywriting of some commands needs to be polished and more straightforward. For example, @nima expressed his confusion about the meaning of the flag --descriptor.

We can use this doc to summarize the final CLI UX for all commands in v0.15.0.

FeynmanZhou avatar Aug 31 '22 03:08 FeynmanZhou

or we drop the --pretty option for all commands.

If we want to show prettified manifest for every oras manifest fetch command, why not set it as default and drop this flag?

FeynmanZhou avatar Aug 31 '22 07:08 FeynmanZhou

why not set it as default and drop this flag?

@FeynmanZhou prettifying a manifest will change the content(by adding space and newlines), thus changing the digest of the fetched manifest, so returning raw content is a must and should be set to default.

qweeah avatar Sep 02 '22 10:09 qweeah

Closing as all sub tasks are finished.

shizhMSFT avatar Sep 15 '22 08:09 shizhMSFT