container/client: rework credentials storage

Instead of keeping an extra field in `Client`, we just use the
existing `sysCtx.DockerAuthConfig` structure. When the context
is later copied during the upload operation the credentials
will be copied as well. It also saves us from syncing the
credentials if we directly use said `sysCtx` for operations.
This commit is contained in:
Christian Kellner 2022-07-11 14:08:46 +02:00 committed by Ondřej Budai
parent 865a899f70
commit e53b9c8bb2
2 changed files with 10 additions and 15 deletions

View file

@ -749,8 +749,9 @@ func (impl *OSBuildJobImpl) Run(job worker.Job) error {
break
}
client.Auth.Username = targetOptions.Username
client.Auth.Password = targetOptions.Password
if targetOptions.Username != "" || targetOptions.Password != "" {
client.SetCredentials(targetOptions.Username, targetOptions.Password)
}
client.SetTLSVerify(targetOptions.TlsVerify)
sourcePath := path.Join(outputDirectory, jobTarget.OsbuildArtifact.ExportName, jobTarget.OsbuildArtifact.ExportFilename)