Skip to content

Commit 48b0f62

Browse files
committed
WIP
Signed-off-by: Sebastiaan van Stijn <[email protected]>
1 parent 51440cb commit 48b0f62

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

cli/command/image/push.go

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ import (
1616
"github.com/docker/cli/cli/command/completion"
1717
"github.com/docker/cli/cli/streams"
1818
"github.com/docker/cli/internal/jsonstream"
19-
"github.com/docker/cli/internal/registry"
2019
"github.com/docker/cli/internal/tui"
2120
"github.com/moby/moby/api/types/auxprogress"
2221
"github.com/moby/moby/api/types/image"
@@ -129,10 +128,7 @@ To push the complete multi-platform image, remove the --platform flag.
129128
}()
130129

131130
if !opts.untrusted {
132-
// Resolve the Repository name from fqn to RepositoryInfo
133-
indexInfo := registry.NewIndexInfo(ref)
134-
authConfig := command.ResolveAuthConfig(dockerCli.ConfigFile(), indexInfo)
135-
return pushTrustedReference(ctx, dockerCli, indexInfo, ref, authConfig, responseBody)
131+
return pushTrustedReference(ctx, dockerCli, ref, responseBody)
136132
}
137133

138134
if opts.quiet {

cli/command/image/trust.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import (
1212
"github.com/docker/cli/cli/streams"
1313
"github.com/docker/cli/cli/trust"
1414
"github.com/docker/cli/internal/jsonstream"
15+
"github.com/docker/cli/internal/registry"
1516
"github.com/moby/moby/api/types/image"
1617
registrytypes "github.com/moby/moby/api/types/registry"
1718
"github.com/opencontainers/go-digest"
@@ -42,12 +43,15 @@ func newNotaryClient(cli command.Streams, imgRefAndAuth trust.ImageRefAndAuth) (
4243
}
4344

4445
// pushTrustedReference pushes a canonical reference to the trust server.
45-
func pushTrustedReference(ctx context.Context, ioStreams command.Streams, indexInfo *registrytypes.IndexInfo, ref reference.Named, authConfig registrytypes.AuthConfig, in io.Reader) error {
46+
func pushTrustedReference(ctx context.Context, dockerCLI command.Cli, ref reference.Named, responseBody io.Reader) error {
47+
// Resolve the Repository name from fqn to RepositoryInfo
48+
indexInfo := registry.NewIndexInfo(ref)
4649
repoInfo := &trust.RepositoryInfo{
4750
Name: reference.TrimNamed(ref),
4851
Index: indexInfo,
4952
}
50-
return trust.PushTrustedReference(ctx, ioStreams, repoInfo, ref, authConfig, in, command.UserAgent())
53+
authConfig := command.ResolveAuthConfig(dockerCLI.ConfigFile(), indexInfo)
54+
return trust.PushTrustedReference(ctx, dockerCLI, repoInfo, ref, authConfig, responseBody, command.UserAgent())
5155
}
5256

5357
// trustedPull handles content trust pulling of an image

0 commit comments

Comments
 (0)