Simplify the header decision in pkg/bindings/images.Build a bit

... now that two of the three cases are the same.

Should not change behavior.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
This commit is contained in:
Miloslav Trmač
2021-10-21 20:26:05 +02:00
parent f9be326274
commit d79414c54f

View File

@ -293,15 +293,11 @@ func Build(ctx context.Context, containerFiles []string, options entities.BuildO
headers map[string]string
err error
)
if options.SystemContext == nil {
headers, err = auth.MakeXRegistryConfigHeader(options.SystemContext, "", "")
} else {
if options.SystemContext.DockerAuthConfig != nil {
if options.SystemContext != nil && options.SystemContext.DockerAuthConfig != nil {
headers, err = auth.MakeXRegistryAuthHeader(options.SystemContext, options.SystemContext.AuthFilePath, options.SystemContext.DockerAuthConfig.Username, options.SystemContext.DockerAuthConfig.Password)
} else {
headers, err = auth.MakeXRegistryConfigHeader(options.SystemContext, "", "")
}
}
if err != nil {
return nil, err
}