Adds charts in "charts\" directory to dependencies

Dependencies should be processed even if they are not added to requirements.yaml
Fixes https://github.com/kubernetes/helm/issues/2599
reviewable/pr2607/r1
Sushil Kumar 8 years ago
parent 012cb0ac1a
commit 7ce5c7925b

@ -258,6 +258,24 @@ func ProcessRequirementsEnabled(c *chart.Chart, v *chart.Config) error {
}
var chartDependencies []*chart.Chart
// If any dependency is not a part of requirements.yaml
// then this should be added to chartDependencies.
// However, if the dependency is already specified in requirements.yaml
// we should not add it, as it would be anyways processed from requirements.yaml
for _, existingDependency := range c.Dependencies {
var dependencyFound bool
for _, req := range reqs.Dependencies {
if existingDependency.Metadata.Name == req.Name && existingDependency.Metadata.Version == req.Version {
dependencyFound = true
break
}
}
if !dependencyFound {
chartDependencies = append(chartDependencies, existingDependency)
}
}
for _, req := range reqs.Dependencies {
if chartDependency := getAliasDependency(c.Dependencies, req); chartDependency != nil {
chartDependencies = append(chartDependencies, chartDependency)

@ -378,13 +378,6 @@ func TestDependentChartAliases(t *testing.T) {
t.Fatalf("Cannot load requirements for test chart, %v", err)
}
// var expectedDependencyCharts int
// for _, reqmt := range reqmts.Dependencies {
// expectedDependencyCharts++
// if len(reqmt.Alias) >= 0 {
// expectedDependencyCharts += len(reqmt.Alias)
// }
// }
if len(c.Dependencies) != len(reqmts.Dependencies) {
t.Fatalf("Expected number of chart dependencies %d, but got %d", len(reqmts.Dependencies), len(c.Dependencies))
}

Loading…
Cancel
Save