Remove hasAllRepos function

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 <kristinnardalsecondary@gmail.com>
pull/8028/head
Kristinn Björgvin Árdal 6 years ago
parent 6fc9353056
commit ab5cba73f1
No known key found for this signature in database
GPG Key ID: CCA0EF70634FCCB9

@ -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) {

Loading…
Cancel
Save