Skip to content

Commit

Permalink
fix: update to refactor set http debug log
Browse files Browse the repository at this point in the history
Signed-off-by: Junjie Gao <[email protected]>
  • Loading branch information
JeyJeyGao committed Dec 2, 2022
1 parent 32adea3 commit 7caa240
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion cmd/notation/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ func runList(command *cobra.Command, opts *listOpts) error {
sigRepo := notationRegistry.NewRepository(remoteRepo)

// core process
manifestDesc, err := getManifestDescriptorFromReference(command.Context(), &opts.SecureFlagOpts, reference, false)
manifestDesc, err := getManifestDescriptorFromReference(command.Context(), &opts.SecureFlagOpts, reference)
if err != nil {
return err
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/notation/login.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ func runLogin(cmd *cobra.Command, opts *loginOpts) error {
}

func validateAuthConfig(ctx context.Context, opts *loginOpts, serverAddress string) error {
registry, err := getRegistryClient(&opts.SecureFlagOpts, serverAddress, false)
registry, err := getRegistryClient(&opts.SecureFlagOpts, serverAddress)
if err != nil {
return err
}
Expand Down
10 changes: 5 additions & 5 deletions cmd/notation/manifest.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,20 @@ import (
"context"
"errors"

notationregistry "github.com/notaryproject/notation-go/registry"
notationRegistry "github.com/notaryproject/notation-go/registry"
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
"oras.land/oras-go/v2/registry"
)

func getManifestDescriptorFromContext(ctx context.Context, opts *SecureFlagOpts, ref string, debug bool) (ocispec.Descriptor, error) {
func getManifestDescriptorFromContext(ctx context.Context, opts *SecureFlagOpts, ref string) (ocispec.Descriptor, error) {
if ref == "" {
return ocispec.Descriptor{}, errors.New("missing reference")
}

return getManifestDescriptorFromReference(ctx, opts, ref, debug)
return getManifestDescriptorFromReference(ctx, opts, ref)
}

func getManifestDescriptorFromReference(ctx context.Context, opts *SecureFlagOpts, reference string, debug bool) (ocispec.Descriptor, error) {
func getManifestDescriptorFromReference(ctx context.Context, opts *SecureFlagOpts, reference string) (ocispec.Descriptor, error) {
ref, err := registry.ParseReference(reference)
if err != nil {
return ocispec.Descriptor{}, err
Expand All @@ -26,5 +26,5 @@ func getManifestDescriptorFromReference(ctx context.Context, opts *SecureFlagOpt
if err != nil {
return ocispec.Descriptor{}, err
}
return notationregistry.NewRepository(repository).Resolve(ctx, ref.ReferenceOrDefault())
return notationRegistry.NewRepository(repository).Resolve(ctx, ref.ReferenceOrDefault())
}
2 changes: 1 addition & 1 deletion cmd/notation/registry.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ func setHttpDebugLog(repo *remote.Repository, debug bool) {
}
}

func getRegistryClient(opts *SecureFlagOpts, serverAddress string, debug bool) (*remote.Registry, error) {
func getRegistryClient(opts *SecureFlagOpts, serverAddress string) (*remote.Registry, error) {
reg, err := remote.NewRegistry(serverAddress)
if err != nil {
return nil, err
Expand Down
4 changes: 2 additions & 2 deletions cmd/notation/sign.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ func runSign(command *cobra.Command, cmdOpts *signOpts) error {
}

// core process
desc, opts, err := prepareSigningContent(command.Context(), cmdOpts)
desc, opts, err := prepareSigningContent(ctx, cmdOpts)
if err != nil {
return err
}
Expand All @@ -100,7 +100,7 @@ func runSign(command *cobra.Command, cmdOpts *signOpts) error {
}

func prepareSigningContent(ctx context.Context, opts *signOpts) (ocispec.Descriptor, notation.SignOptions, error) {
manifestDesc, err := getManifestDescriptorFromContext(ctx, &opts.SecureFlagOpts, opts.reference, opts.Debug)
manifestDesc, err := getManifestDescriptorFromContext(ctx, &opts.SecureFlagOpts, opts.reference)
if err != nil {
return ocispec.Descriptor{}, notation.SignOptions{}, err
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/notation/verify.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ func resolveReference(command *cobra.Command, opts *verifyOpts) (registry.Refere
}

// Resolve tag reference to digest reference.
manifestDesc, err := getManifestDescriptorFromReference(command.Context(), &opts.SecureFlagOpts, opts.reference, opts.Debug)
manifestDesc, err := getManifestDescriptorFromReference(command.Context(), &opts.SecureFlagOpts, opts.reference)
if err != nil {
return registry.Reference{}, err
}
Expand Down

0 comments on commit 7caa240

Please sign in to comment.