Skip to content

Commit b8ad44d

Browse files
committed
WIP
Signed-off-by: Sebastiaan van Stijn <[email protected]>
1 parent fcfab6e commit b8ad44d

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/client"
@@ -130,10 +129,7 @@ To push the complete multi-platform image, remove the --platform flag.
130129
}()
131130

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

139135
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/pkg/authconfig"
1617
registrytypes "github.com/moby/moby/api/types/registry"
1718
"github.com/moby/moby/client"
@@ -43,12 +44,15 @@ func newNotaryClient(cli command.Streams, imgRefAndAuth trust.ImageRefAndAuth) (
4344
}
4445

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

5458
// trustedPull handles content trust pulling of an image

0 commit comments

Comments
 (0)