From ea49d811bff09697fff736a8a52165691d5862d5 Mon Sep 17 00:00:00 2001 From: Asir Tamboli Date: Fri, 29 Oct 2021 06:20:37 +0530 Subject: [PATCH] Updated oci format logic Signed-off-by: Asir Tamboli --- pkg/downloader/manager.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/pkg/downloader/manager.go b/pkg/downloader/manager.go index b0ade6c90..52f1a1312 100644 --- a/pkg/downloader/manager.go +++ b/pkg/downloader/manager.go @@ -342,7 +342,7 @@ func (m *Manager) downloadAll(deps []*chart.Dependency) error { } version := "" - if strings.HasPrefix(churl, "oci://") { + if registry.IsOCI(churl) { if !resolver.FeatureGateOCI.IsEnabled() { return errors.Wrapf(resolver.FeatureGateOCI.Error(), "the repository %s is an OCI registry", churl) @@ -477,7 +477,7 @@ func (m *Manager) hasAllRepos(deps []*chart.Dependency) error { Loop: for _, dd := range deps { // If repo is from local path or OCI, continue - if strings.HasPrefix(dd.Repository, "file://") || strings.HasPrefix(dd.Repository, "oci://") { + if strings.HasPrefix(dd.Repository, "file://") || registry.IsOCI(dd.Repository) { continue } @@ -579,7 +579,7 @@ func (m *Manager) resolveRepoNames(deps []*chart.Dependency) (map[string]string, for _, dd := range deps { // Don't map the repository, we don't need to download chart from charts directory // When OCI is used there is no Helm repository - if dd.Repository == "" || strings.HasPrefix(dd.Repository, "oci://") { + if dd.Repository == "" || registry.IsOCI(dd.Repository) { continue } // if dep chart is from local path, verify the path is valid @@ -595,7 +595,7 @@ func (m *Manager) resolveRepoNames(deps []*chart.Dependency) (map[string]string, continue } - if strings.HasPrefix(dd.Repository, "oci://") { + if registry.IsOCI(dd.Repository) { reposMap[dd.Name] = dd.Repository continue } @@ -709,7 +709,7 @@ func (m *Manager) parallelRepoUpdate(repos []*repo.Entry) error { // // If it finds a URL that is "relative", it will prepend the repoURL. func (m *Manager) findChartURL(name, version, repoURL string, repos map[string]*repo.ChartRepository) (url, username, password string, insecureskiptlsverify, passcredentialsall bool, caFile, certFile, keyFile string, err error) { - if strings.HasPrefix(repoURL, "oci://") { + if registry.IsOCI(repoURL) { return fmt.Sprintf("%s/%s:%s", repoURL, name, version), "", "", false, false, "", "", "", nil }