11package store
22
33import (
4+ "bytes"
45 "context"
56 "fmt"
67 "os"
@@ -14,6 +15,7 @@ import (
1415 "helm.sh/helm/v4/pkg/chart/common"
1516 commonutil "helm.sh/helm/v4/pkg/chart/common/util"
1617 helmchart "helm.sh/helm/v4/pkg/chart/v2"
18+ "helm.sh/helm/v4/pkg/chart/v2/loader"
1719 "helm.sh/helm/v4/pkg/chart/v2/util"
1820 "helm.sh/helm/v4/pkg/engine"
1921 "k8s.io/apimachinery/pkg/util/yaml"
@@ -484,12 +486,22 @@ func storeChart(ctx context.Context, s *store.Layout, cfg v1.Chart, opts *flags.
484486
485487 // add-images
486488 if opts .AddImages {
487- userValues := common.Values {}
488- if opts .HelmValues != "" {
489- userValues , err = common .ReadValuesFile (opts .HelmValues )
489+ userValues := map [string ]any {}
490+
491+ for _ , valuesFile := range opts .ValuesFiles {
492+ l .Debugf ("loading values for chart [%s]" , valuesFile )
493+
494+ valuesContent , err := os .ReadFile (valuesFile )
495+ if err != nil {
496+ return fmt .Errorf ("failed to read values file [%s]: %w" , valuesFile , err )
497+ }
498+
499+ vals , err := loader .LoadValues (bytes .NewReader (valuesContent ))
490500 if err != nil {
491- return fmt .Errorf ("failed to read helm values file [%s]: %w" , opts . HelmValues , err )
501+ return fmt .Errorf ("failed to read helm values file [%s]: %w" , valuesFile , err )
492502 }
503+
504+ userValues = loader .MergeMaps (userValues , vals )
493505 }
494506
495507 // set helm default capabilities
0 commit comments