From d79414c54ff89c3deea84e2ac600525744fc75c5 Mon Sep 17 00:00:00 2001 From: Miloslav Trmač Date: Thu, 21 Oct 2021 20:26:05 +0200 Subject: Simplify the header decision in pkg/bindings/images.Build a bit MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ... now that two of the three cases are the same. Should not change behavior. Signed-off-by: Miloslav Trmač --- pkg/bindings/images/build.go | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) (limited to 'pkg/bindings') diff --git a/pkg/bindings/images/build.go b/pkg/bindings/images/build.go index 54c831c36..fece5e9d0 100644 --- a/pkg/bindings/images/build.go +++ b/pkg/bindings/images/build.go @@ -293,14 +293,10 @@ 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, "", "") + 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 { - if 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, "", "") - } + headers, err = auth.MakeXRegistryConfigHeader(options.SystemContext, "", "") } if err != nil { return nil, err -- cgit v1.2.3-54-g00ecf