From ab5cba73f1f295e1aeca1b8acd7bae5e05df6ef1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristinn=20Bj=C3=B6rgvin=20=C3=81rdal?= Date: Wed, 29 Apr 2020 12:13:27 +0200 Subject: [PATCH] Remove hasAllRepos function MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Helm doesn't download from local cache so it's redundant to check whether they exist in local cache before downloading. This leads to bugs where `helm dep build` doesn't work when it should. Signed-off-by: Kristinn Björgvin Árdal --- pkg/downloader/manager.go | 39 --------------------------------------- 1 file changed, 39 deletions(-) diff --git a/pkg/downloader/manager.go b/pkg/downloader/manager.go index 00198de0c..808b44513 100644 --- a/pkg/downloader/manager.go +++ b/pkg/downloader/manager.go @@ -113,11 +113,6 @@ func (m *Manager) Build() error { } } - // Check that all of the repos we're dependent on actually exist. - if err := m.hasAllRepos(lock.Dependencies); err != nil { - return err - } - if !m.SkipUpdate { // For each repo in the file, update the cached copy of that repo if err := m.UpdateRepositories(); err != nil { @@ -382,40 +377,6 @@ func (m *Manager) safeDeleteDep(name, dir string) error { return nil } -// hasAllRepos ensures that all of the referenced deps are in the local repo cache. -func (m *Manager) hasAllRepos(deps []*chart.Dependency) error { - rf, err := loadRepoConfig(m.RepositoryConfig) - if err != nil { - return err - } - repos := rf.Repositories - - // Verify that all repositories referenced in the deps are actually known - // by Helm. - missing := []string{} -Loop: - for _, dd := range deps { - // If repo is from local path, continue - if strings.HasPrefix(dd.Repository, "file://") { - continue - } - - if dd.Repository == "" { - continue - } - for _, repo := range repos { - if urlutil.Equal(repo.URL, strings.TrimSuffix(dd.Repository, "/")) { - continue Loop - } - } - missing = append(missing, dd.Repository) - } - if len(missing) > 0 { - return errors.Errorf("no repository definition for %s. Please add the missing repos via 'helm repo add'", strings.Join(missing, ", ")) - } - return nil -} - // resolveRepoNames returns the repo names of the referenced deps which can be used to fetch the cached index file // and replaces aliased repository URLs into resolved URLs in dependencies. func (m *Manager) resolveRepoNames(deps []*chart.Dependency) (map[string]string, error) {