From 88127d641b02fd781442eaf55a0767926c07a4cc Mon Sep 17 00:00:00 2001 From: Quan TRAN Date: Wed, 6 Apr 2022 01:02:14 +0200 Subject: [PATCH 1/2] [fix] chartify process when chart path is absolute Signed-off-by: Quan TRAN --- examples/remote-argo/helmfile.yaml | 7 +++++++ pkg/state/helmx.go | 6 +++++- 2 files changed, 12 insertions(+), 1 deletion(-) create mode 100644 examples/remote-argo/helmfile.yaml diff --git a/examples/remote-argo/helmfile.yaml b/examples/remote-argo/helmfile.yaml new file mode 100644 index 00000000..52878792 --- /dev/null +++ b/examples/remote-argo/helmfile.yaml @@ -0,0 +1,7 @@ +helmDefaults: + wait: true + waitForJobs: true + timeout: 300 +releases: +- name: argo-cd-crds + chart: git::https://github.com/argoproj/argo-helm.git@charts/argo-cd/crds?ref=master diff --git a/pkg/state/helmx.go b/pkg/state/helmx.go index 5f897ffb..14599493 100644 --- a/pkg/state/helmx.go +++ b/pkg/state/helmx.go @@ -100,7 +100,10 @@ func (st *HelmState) PrepareChartify(helm helmexec.Interface, release *ReleaseSp var shouldRun bool - dir := filepath.Join(st.basePath, chart) + dir := chart + if !filepath.IsAbs(chart) { + dir = filepath.Join(st.basePath, chart) + } if stat, _ := os.Stat(dir); stat != nil && stat.IsDir() { if exists, err := st.fileExists(filepath.Join(dir, "Chart.yaml")); err == nil && !exists { shouldRun = true @@ -180,6 +183,7 @@ func (st *HelmState) PrepareChartify(helm helmexec.Interface, release *ReleaseSp } if shouldRun { + st.logger.Debugf("Chartify process for %s", dir) generatedFiles, err := st.generateValuesFiles(helm, release, workerIndex) if err != nil { return nil, clean, err From 3cae3f4f89c12c5001cc89a38f43ebf0fa720492 Mon Sep 17 00:00:00 2001 From: Quan TRAN Date: Mon, 11 Apr 2022 23:41:28 +0200 Subject: [PATCH 2/2] add integration test Signed-off-by: Quan TRAN --- .../helmfile.yaml => test/integration/issue.2118.yaml | 0 test/integration/run.sh | 3 +++ 2 files changed, 3 insertions(+) rename examples/remote-argo/helmfile.yaml => test/integration/issue.2118.yaml (100%) diff --git a/examples/remote-argo/helmfile.yaml b/test/integration/issue.2118.yaml similarity index 100% rename from examples/remote-argo/helmfile.yaml rename to test/integration/issue.2118.yaml diff --git a/test/integration/run.sh b/test/integration/run.sh index e4d4096b..fcc0c2b5 100755 --- a/test/integration/run.sh +++ b/test/integration/run.sh @@ -159,6 +159,9 @@ if [[ helm_major_version -eq 3 ]]; then info "https://github.com/roboll/helmfile/issues/1867" (${helmfile} -f ${dir}/issue.1867.yaml template 1>/dev/null) || fail "\"helmfile template\" shouldn't fail" + + info "https://github.com/roboll/helmfile/issues/2118" + (${helmfile} -f ${dir}/issue.2118.yaml template 1>/dev/null) || fail "\"helmfile template\" shouldn't fail" else info "There are no regression tests for helm 2 because all the target charts have dropped helm 2 support." fi