Skip to content

Commit

Permalink
update: refactored notation list command (notaryproject#481)
Browse files Browse the repository at this point in the history
This PR refactors the `notation list` command reducing the number of
calls to getSignatureRepository() and repo.Resolve().

Signed-off-by: Patrick Zheng <patrickzheng@microsoft.com>
  • Loading branch information
Two-Hearts authored and vaninrao10 committed Jan 5, 2023
1 parent 3ef6472 commit 80a1568
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions cmd/notation/verify.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,13 @@ func runVerify(command *cobra.Command, opts *verifyOpts) error {
return err
}

// initialize
reference := opts.reference
sigRepo, err := getSignatureRepository(ctx, &opts.SecureFlagOpts, reference)
if err != nil {
return err
}

// resolve the given reference and set the digest
ref, err := resolveReference(command.Context(), &opts.SecureFlagOpts, reference, sigRepo, func(ref registry.Reference, manifestDesc ocispec.Descriptor) {
fmt.Printf("Resolved artifact tag `%s` to digest `%s` before verification.\n", ref.Reference, manifestDesc.Digest.String())
Expand Down

0 comments on commit 80a1568

Please sign in to comment.