From 34f60fa89f203049528493c6bf5942a6a982f5b6 Mon Sep 17 00:00:00 2001 From: Fabian Burth Date: Thu, 9 Nov 2023 14:17:46 +0100 Subject: [PATCH 1/2] fix credential not being used --- pkg/helm/downloader.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pkg/helm/downloader.go b/pkg/helm/downloader.go index 33c45e6c25..4a076f131b 100644 --- a/pkg/helm/downloader.go +++ b/pkg/helm/downloader.go @@ -108,7 +108,9 @@ func (d *chartDownloader) complete(ctx oci.ContextProvider, ref, repourl string) creds := d.creds if d.creds == nil { d.creds = identity.GetCredentials(ctx.OCIContext(), repourl, ref) - if d.creds == nil { + if d.creds != nil { + creds = d.creds + } else { creds = common.Properties{} } } From 2b769018366fba020a78b14cf0aef6421cc88a86 Mon Sep 17 00:00:00 2001 From: Fabian Burth Date: Thu, 9 Nov 2023 15:56:29 +0100 Subject: [PATCH 2/2] restructure nested if --- pkg/helm/downloader.go | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/pkg/helm/downloader.go b/pkg/helm/downloader.go index 4a076f131b..9b399e781d 100644 --- a/pkg/helm/downloader.go +++ b/pkg/helm/downloader.go @@ -105,14 +105,12 @@ func DownloadChart(out common.Printer, ctx oci.ContextProvider, ref, version, re func (d *chartDownloader) complete(ctx oci.ContextProvider, ref, repourl string) error { rf := repo.NewFile() - creds := d.creds if d.creds == nil { d.creds = identity.GetCredentials(ctx.OCIContext(), repourl, ref) - if d.creds != nil { - creds = d.creds - } else { - creds = common.Properties{} - } + } + creds := d.creds + if creds == nil { + creds = common.Properties{} } config := vfs.Join(d.fs, d.root, ".config")