oras icon indicating copy to clipboard operation
oras copied to clipboard

feat: add `fetch` command to get manifest of an artifact

Open qweeah opened this issue 3 years ago • 3 comments

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

qweeah avatar Jul 18 '22 13:07 qweeah

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

qweeah avatar Jul 18 '22 14:07 qweeah

Codecov Report

Merging #449 (2ac5fce) into main (e9810a8) will increase coverage by 3.92%. The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main     #449      +/-   ##
==========================================
+ Coverage   67.58%   71.50%   +3.92%     
==========================================
  Files           7        9       +2     
  Lines         327      372      +45     
==========================================
+ Hits          221      266      +45     
  Misses         85       85              
  Partials       21       21              
Impacted Files Coverage Δ
cmd/oras/internal/option/platform.go 100.00% <100.00%> (ø)
internal/cas/fetch.go 100.00% <100.00%> (ø)

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 Jul 27 '22 04:07 codecov-commenter

This PR is still pending on https://github.com/oras-project/oras-go/pull/244

qweeah avatar Jul 28 '22 08:07 qweeah