Skip to content

Commit 713de5b

Browse files
thaJeztahndeloof
authored andcommitted
pkg/compose: explicitly map AuthConfig fields instead of a direct cast
Commit [cli@27b2797] forked the AuthConfig type from the API, and changed existing code to do a direct cast / convert of the forked type to the API type. This can cause issues if the API types diverges, such as the removal of the Email field. This patch explicitly maps each field to the corresponding API type, but adds some TODOs, because various code-paths only included a subset of the fields, which may be intentional for fields that were meant to be handled on the daemon / registry-client only. We should evaluate these conversions to make sure these fields should be sent from the client or not (and possibly even removed from the API type). [cli@27b2797]: docker/cli@27b2797 Signed-off-by: Sebastiaan van Stijn <[email protected]>
1 parent 9ded168 commit 713de5b

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

pkg/compose/build_classic.go

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,8 +154,17 @@ func (s *composeService) doBuildClassic(ctx context.Context, project *types.Proj
154154
return "", err
155155
}
156156
authConfigs := make(map[string]registry.AuthConfig, len(creds))
157-
for k, auth := range creds {
158-
authConfigs[k] = registry.AuthConfig(auth)
157+
for k, authConfig := range creds {
158+
authConfigs[k] = registry.AuthConfig{
159+
Username: authConfig.Username,
160+
Password: authConfig.Password,
161+
ServerAddress: authConfig.ServerAddress,
162+
163+
// TODO(thaJeztah): Are these expected to be included? See https://github.com/docker/cli/pull/6516#discussion_r2387586472
164+
Auth: authConfig.Auth,
165+
IdentityToken: authConfig.IdentityToken,
166+
RegistryToken: authConfig.RegistryToken,
167+
}
159168
}
160169
buildOptions := imageBuildOptions(s.dockerCli, project, service, options)
161170
imageName := api.GetImageNameOrDefault(service, project.Name)

0 commit comments

Comments
 (0)