From d1172271e8e31ed992890d82fa734b37206f0c04 Mon Sep 17 00:00:00 2001 From: Kristian-ZH Date: Thu, 12 Oct 2023 11:59:10 +0300 Subject: [PATCH] Do not remove dependencies versions --- pkg/charts/dependencies.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/pkg/charts/dependencies.go b/pkg/charts/dependencies.go index 86197907..e0180a1e 100644 --- a/pkg/charts/dependencies.go +++ b/pkg/charts/dependencies.go @@ -257,16 +257,21 @@ func UpdateHelmMetadataWithDependencies(fs billy.Filesystem, mainHelmChartPath s for _, d := range chart.Metadata.Dependencies { if d.Name == dependencyName { d.Repository = fmt.Sprintf("file://./charts/%s", dependencyName) - d.Version = "" // Local chart archives don't need a version found = true } } if !found { + componentChart, err := helmLoader.Load(filesystem.GetAbsPath(fs, fmt.Sprintf("../%s/charts", dependencyName))) + if err != nil { + return err + } + componentVersion := componentChart.Metadata.Version + // Dependency does not exist, so we add it to the list d := &helmChart.Dependency{ Name: dependencyName, Condition: fmt.Sprintf("%s.enabled", dependencyName), - Version: "", // Local chart archives don't need a version + Version: componentVersion, Repository: fmt.Sprintf("file://./charts/%s", dependencyName), } chart.Metadata.Dependencies = append(chart.Metadata.Dependencies, d)