Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add fetch command to get manifest of an artifact #449

Merged
merged 65 commits into from
Aug 15, 2022

Conversation

qweeah
Copy link
Contributor

@qweeah qweeah commented Jul 18, 2022

This PR adds an new command manifest and a subcommand fetch for displaying the manifest of an artifact reference with below changes:

  • Moves manifest related code into a new folder. Cobra related code should be put in the cmd.go and functional code should be put in the <sub-command-name>.go. This practice can be applied when we have more sub-commands in blob and repository in the future.

  • Adds a new mocking package to mock repository level operations (e.g. fetch, fetch reference, resolve), add used it for unit testing.

Resolves #301, #463

Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
@qweeah qweeah changed the title Get manifest for an artifact Fetch manifest for an artifact Jul 18, 2022
@qweeah qweeah marked this pull request as draft July 18, 2022 14:14
@qweeah
Copy link
Contributor Author

qweeah commented Jul 18, 2022

Convert to draft since we still need to support --platform and that need some work. It's done.

Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
@qweeah qweeah changed the title Fetch manifest for an artifact [WIP] Fetch manifest for an artifact Jul 19, 2022
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
@qweeah qweeah marked this pull request as ready for review July 20, 2022 03:04
@qweeah qweeah changed the title [WIP] Fetch manifest for an artifact Fetch manifest for an artifact Jul 20, 2022
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
cmd/oras/internal/option/platform.go Outdated Show resolved Hide resolved
cmd/oras/internal/option/platform.go Outdated Show resolved Hide resolved
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
@qweeah qweeah changed the title feat: add fetch command to get manifest conent of an artifact feat: add fetch command to get manifest of an artifact Aug 12, 2022
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
@qweeah qweeah marked this pull request as ready for review August 15, 2022 07:15
@shizhMSFT shizhMSFT added this to the v0.14.0 milestone Aug 15, 2022
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
"oras.land/oras/cmd/oras/internal/option"
)

func Cmd() *cobra.Command {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we call it Command()?

Use: "fetch [flags] <name:tag|name@digest>",
Short: "[Preview] Fetch manifest of the target artifact",
Long: `[Preview] Fetch manifest of the target artifact
** This command is in preview and under development. **
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

An example for --descriptor would be better.

Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Copy link
Contributor

@shizhMSFT shizhMSFT left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@shizhMSFT shizhMSFT merged commit 10f567b into oras-project:main Aug 15, 2022
@qweeah qweeah deleted the get-manifest branch August 15, 2022 14:06
TerryHowe pushed a commit to TerryHowe/oras that referenced this pull request Feb 2, 2023
…t#449)

Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ORAS get-manifest command
6 participants