mirror of https://github.com/docker/cli.git
parent
c85961b15d
commit
6e8a0d3b6e
|
|
@ -16,7 +16,6 @@ import (
|
||||||
"github.com/docker/cli/cli/command/completion"
|
"github.com/docker/cli/cli/command/completion"
|
||||||
"github.com/docker/cli/cli/streams"
|
"github.com/docker/cli/cli/streams"
|
||||||
"github.com/docker/cli/internal/jsonstream"
|
"github.com/docker/cli/internal/jsonstream"
|
||||||
"github.com/docker/cli/internal/registry"
|
|
||||||
"github.com/docker/cli/internal/tui"
|
"github.com/docker/cli/internal/tui"
|
||||||
"github.com/moby/moby/api/types/auxprogress"
|
"github.com/moby/moby/api/types/auxprogress"
|
||||||
"github.com/moby/moby/client"
|
"github.com/moby/moby/client"
|
||||||
|
|
@ -129,10 +128,7 @@ To push the complete multi-platform image, remove the --platform flag.
|
||||||
}()
|
}()
|
||||||
|
|
||||||
if !opts.untrusted {
|
if !opts.untrusted {
|
||||||
// Resolve the Repository name from fqn to RepositoryInfo
|
return pushTrustedReference(ctx, dockerCli, ref, responseBody)
|
||||||
indexInfo := registry.NewIndexInfo(ref)
|
|
||||||
authConfig := command.ResolveAuthConfig(dockerCli.ConfigFile(), indexInfo)
|
|
||||||
return pushTrustedReference(ctx, dockerCli, indexInfo, ref, authConfig, responseBody)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if opts.quiet {
|
if opts.quiet {
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,7 @@ import (
|
||||||
"github.com/docker/cli/cli/streams"
|
"github.com/docker/cli/cli/streams"
|
||||||
"github.com/docker/cli/cli/trust"
|
"github.com/docker/cli/cli/trust"
|
||||||
"github.com/docker/cli/internal/jsonstream"
|
"github.com/docker/cli/internal/jsonstream"
|
||||||
|
"github.com/docker/cli/internal/registry"
|
||||||
"github.com/moby/moby/api/pkg/authconfig"
|
"github.com/moby/moby/api/pkg/authconfig"
|
||||||
registrytypes "github.com/moby/moby/api/types/registry"
|
registrytypes "github.com/moby/moby/api/types/registry"
|
||||||
"github.com/moby/moby/client"
|
"github.com/moby/moby/client"
|
||||||
|
|
@ -43,12 +44,15 @@ func newNotaryClient(cli command.Streams, imgRefAndAuth trust.ImageRefAndAuth) (
|
||||||
}
|
}
|
||||||
|
|
||||||
// pushTrustedReference pushes a canonical reference to the trust server.
|
// pushTrustedReference pushes a canonical reference to the trust server.
|
||||||
func pushTrustedReference(ctx context.Context, ioStreams command.Streams, indexInfo *registrytypes.IndexInfo, ref reference.Named, authConfig registrytypes.AuthConfig, in io.Reader) error {
|
func pushTrustedReference(ctx context.Context, dockerCLI command.Cli, ref reference.Named, responseBody io.Reader) error {
|
||||||
|
// Resolve the Repository name from fqn to RepositoryInfo
|
||||||
|
indexInfo := registry.NewIndexInfo(ref)
|
||||||
repoInfo := &trust.RepositoryInfo{
|
repoInfo := &trust.RepositoryInfo{
|
||||||
Name: reference.TrimNamed(ref),
|
Name: reference.TrimNamed(ref),
|
||||||
Index: indexInfo,
|
Index: indexInfo,
|
||||||
}
|
}
|
||||||
return trust.PushTrustedReference(ctx, ioStreams, repoInfo, ref, authConfig, in, command.UserAgent())
|
authConfig := command.ResolveAuthConfig(dockerCLI.ConfigFile(), indexInfo)
|
||||||
|
return trust.PushTrustedReference(ctx, dockerCLI, repoInfo, ref, authConfig, responseBody, command.UserAgent())
|
||||||
}
|
}
|
||||||
|
|
||||||
// trustedPull handles content trust pulling of an image
|
// trustedPull handles content trust pulling of an image
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue