From fef14bea9df8b36ec124e1a66a950fd12d2ae462 Mon Sep 17 00:00:00 2001 From: cuisongliu Date: Sun, 22 Oct 2023 20:57:40 +0800 Subject: [PATCH] :bug: support env for export (#4135) Signed-off-by: cuisongliu --- pkg/clusterfile/pre_process.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/pkg/clusterfile/pre_process.go b/pkg/clusterfile/pre_process.go index dd11a129f54..77096c90015 100644 --- a/pkg/clusterfile/pre_process.go +++ b/pkg/clusterfile/pre_process.go @@ -17,6 +17,8 @@ package clusterfile import ( "bytes" "errors" + "os" + "strings" "helm.sh/helm/v3/pkg/cli/values" "helm.sh/helm/v3/pkg/getter" @@ -46,6 +48,13 @@ func (c *ClusterFile) Process() (err error) { } c.once.Do(func() { err = func() error { + for i := range c.customEnvs { + kv := strings.SplitN(c.customEnvs[i], "=", 2) + if len(kv) == 2 { + logger.Debug("set env: %s=%s", kv[0], kv[1]) + _ = os.Setenv(kv[0], kv[1]) + } + } clusterFileData, err := c.loadClusterFile() if err != nil { return err