From 7bcf3d8896e761b2cac5fd31e5d041c64911aeef Mon Sep 17 00:00:00 2001 From: Luis Davim Date: Tue, 21 Sep 2021 13:59:08 +0100 Subject: [PATCH] fix: unknown command "chart" for "helm" Signed-off-by: Luis Davim --- internal/app/helm_helpers.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/internal/app/helm_helpers.go b/internal/app/helm_helpers.go index 43af55b2..11b79dbe 100644 --- a/internal/app/helm_helpers.go +++ b/internal/app/helm_helpers.go @@ -127,7 +127,13 @@ func helmExportChart(chart, dest string) error { // helmPullChart pulls chart and exports it to the specified destination // this should only be used with helm versions greater or equal to 3.7.0 func helmPullChart(chart, dest string) error { - cmd := helmCmd([]string{"chart", "pull", chart, "-d", dest}, "Pulling chart [ "+chart+" ] to "+dest) + chartParts := strings.Split(chart, ":") + if len(chartParts) < 2 { + return fmt.Errorf("missing chart version") + } + version := chartParts[len(chartParts)-1] + chart = strings.Join(chartParts[:len(chartParts)-1], ":") + cmd := helmCmd([]string{"pull", chart, "-d", dest, "--version", version}, "Pulling chart [ "+chart+" ] to "+dest) if _, err := cmd.Exec(); err != nil { return err }