From 268a4808e98164bf4f88d1509c8f083f2c9f9859 Mon Sep 17 00:00:00 2001 From: Cyril Jouve Date: Wed, 14 Feb 2024 10:16:48 +0100 Subject: [PATCH] run deps without chart preparation (#1011) * nonreg for #1011 Signed-off-by: Cyril Jouve * run deps without chart preparation Signed-off-by: Cyril Jouve --------- Signed-off-by: Cyril Jouve --- pkg/app/app.go | 14 +------------- pkg/app/run.go | 6 ++++++ test/integration/run.sh | 1 + test/integration/test-cases/deps-mr-1011.sh | 9 +++++++++ .../test-cases/deps-mr-1011/input/helmfile.yaml | 13 +++++++++++++ 5 files changed, 30 insertions(+), 13 deletions(-) create mode 100644 test/integration/test-cases/deps-mr-1011.sh create mode 100644 test/integration/test-cases/deps-mr-1011/input/helmfile.yaml diff --git a/pkg/app/app.go b/pkg/app/app.go index 0778fe15..1b983a96 100644 --- a/pkg/app/app.go +++ b/pkg/app/app.go @@ -120,19 +120,7 @@ func (a *App) Init(c InitConfigProvider) error { func (a *App) Deps(c DepsConfigProvider) error { return a.ForEachState(func(run *Run) (_ bool, errs []error) { - prepErr := run.withPreparedCharts("deps", state.ChartPrepareOptions{ - SkipRepos: c.SkipRepos(), - SkipDeps: true, - SkipResolve: true, - Concurrency: c.Concurrency(), - }, func() { - errs = run.Deps(c) - }) - - if prepErr != nil { - errs = append(errs, prepErr) - } - + errs = run.Deps(c) return }, c.IncludeTransitiveNeeds(), SetFilter(true)) } diff --git a/pkg/app/run.go b/pkg/app/run.go index 6a184aa6..d3eb1d6f 100644 --- a/pkg/app/run.go +++ b/pkg/app/run.go @@ -104,6 +104,12 @@ func (r *Run) withPreparedCharts(helmfileCommand string, opts state.ChartPrepare } func (r *Run) Deps(c DepsConfigProvider) []error { + if !c.SkipRepos() { + if err := r.ctx.SyncReposOnce(r.state, r.helm); err != nil { + return []error{err} + } + } + r.helm.SetExtraArgs(GetArgs(c.Args(), r.state)...) return r.state.UpdateDeps(r.helm, c.IncludeTransitiveNeeds()) diff --git a/test/integration/run.sh b/test/integration/run.sh index 0a5bcdaa..e4812991 100755 --- a/test/integration/run.sh +++ b/test/integration/run.sh @@ -90,6 +90,7 @@ ${kubectl} create namespace ${test_ns} || fail "Could not create namespace ${tes . ${dir}/test-cases/chart-needs.sh . ${dir}/test-cases/postrender.sh . ${dir}/test-cases/chartify.sh +. ${dir}/test-cases/deps-mr-1011.sh # ALL DONE ----------------------------------------------------------------------------------------------------------- diff --git a/test/integration/test-cases/deps-mr-1011.sh b/test/integration/test-cases/deps-mr-1011.sh new file mode 100644 index 00000000..3ad0d2f3 --- /dev/null +++ b/test/integration/test-cases/deps-mr-1011.sh @@ -0,0 +1,9 @@ +deps_mr_1011_input_dir="${cases_dir}/deps-mr-1011/input" + +config_file="helmfile.yaml" + +test_start "helmfile deps nonreg for #1011" + +${helmfile} -f ${deps_mr_1011_input_dir}/${config_file} deps || fail "\"helmfile deps\" shouldn't fail" + +test_pass "helmfile deps nonreg for #1011" diff --git a/test/integration/test-cases/deps-mr-1011/input/helmfile.yaml b/test/integration/test-cases/deps-mr-1011/input/helmfile.yaml new file mode 100644 index 00000000..ef2ba2bb --- /dev/null +++ b/test/integration/test-cases/deps-mr-1011/input/helmfile.yaml @@ -0,0 +1,13 @@ +repositories: + - name: rook-release + url: https://charts.rook.io/release + - name: incubator + url: https://charts.helm.sh/incubator + +releases: + - name: rook-ceph + chart: rook-release/rook-ceph + version: 1.12.x + dependencies: + - chart: incubator/raw + version: x