|
8 | 8 |
|
9 | 9 | "github.com/distribution/reference" |
10 | 10 | "github.com/docker/cli/cli/command" |
| 11 | + "github.com/docker/cli/cli/config" |
11 | 12 | "github.com/docker/cli/cli/streams" |
12 | 13 | "github.com/docker/cli/cli/trust" |
13 | 14 | "github.com/docker/cli/internal/jsonstream" |
@@ -68,7 +69,7 @@ func trustedPull(ctx context.Context, cli command.Cli, imgRefAndAuth trust.Image |
68 | 69 | if err != nil { |
69 | 70 | return err |
70 | 71 | } |
71 | | - updatedImgRefAndAuth, err := trust.GetImageReferencesAndAuth(ctx, AuthResolver(cli), trustedRef.String()) |
| 72 | + updatedImgRefAndAuth, err := trust.GetImageReferencesAndAuth(ctx, authResolver(cli), trustedRef.String()) |
72 | 73 | if err != nil { |
73 | 74 | return err |
74 | 75 | } |
@@ -172,7 +173,7 @@ func imagePullPrivileged(ctx context.Context, cli command.Cli, imgRefAndAuth tru |
172 | 173 |
|
173 | 174 | // TrustedReference returns the canonical trusted reference for an image reference |
174 | 175 | func TrustedReference(ctx context.Context, cli command.Cli, ref reference.NamedTagged) (reference.Canonical, error) { |
175 | | - imgRefAndAuth, err := trust.GetImageReferencesAndAuth(ctx, AuthResolver(cli), ref.String()) |
| 176 | + imgRefAndAuth, err := trust.GetImageReferencesAndAuth(ctx, authResolver(cli), ref.String()) |
176 | 177 | if err != nil { |
177 | 178 | return nil, err |
178 | 179 | } |
@@ -210,9 +211,16 @@ func convertTarget(t client.Target) (target, error) { |
210 | 211 | }, nil |
211 | 212 | } |
212 | 213 |
|
213 | | -// AuthResolver returns an auth resolver function from a command.Cli |
214 | | -func AuthResolver(cli command.Cli) func(ctx context.Context, index *registrytypes.IndexInfo) registrytypes.AuthConfig { |
| 214 | +// AuthResolver returns an auth resolver function from a [config.Provider]. |
| 215 | +// |
| 216 | +// Deprecated: this function was only used internally and will be removed in the next release. |
| 217 | +func AuthResolver(dockerCLI config.Provider) func(ctx context.Context, index *registrytypes.IndexInfo) registrytypes.AuthConfig { |
| 218 | + return authResolver(dockerCLI) |
| 219 | +} |
| 220 | + |
| 221 | +// authResolver returns an auth resolver function from a [config.Provider]. |
| 222 | +func authResolver(dockerCLI config.Provider) func(ctx context.Context, index *registrytypes.IndexInfo) registrytypes.AuthConfig { |
215 | 223 | return func(ctx context.Context, index *registrytypes.IndexInfo) registrytypes.AuthConfig { |
216 | | - return command.ResolveAuthConfig(cli.ConfigFile(), index) |
| 224 | + return command.ResolveAuthConfig(dockerCLI.ConfigFile(), index) |
217 | 225 | } |
218 | 226 | } |
0 commit comments