fix: helmDefaults.skipRefresh ignored in runHelmDepBuilds (#2415)

fix: helmDefaults.skipRefresh ignored in runHelmDepBuilds (#2269)

`runHelmDepBuilds()` only checked the CLI flag (`opts.SkipRefresh`) when
deciding whether to run `helm repo update` before building dependencies.
This meant that setting `helmDefaults.skipRefresh: true` in helmfile.yaml
had no effect on the repo update call inside dep builds.

Add `!st.HelmDefaults.SkipRefresh` to the guard condition so that
`helmDefaults.skipRefresh: true` is respected alongside the CLI flag.

Signed-off-by: Aditya Menon <amenon@canarytechnologies.com>
This commit is contained in:
Aditya Menon
2026-02-22 14:13:05 +05:30
committed by GitHub
parent c63947483c
commit abfe73fa6f
8 changed files with 225 additions and 1 deletions
+1
View File
@@ -131,6 +131,7 @@ ${kubectl} create namespace ${test_ns} || fail "Could not create namespace ${tes
. ${dir}/test-cases/issue-2103.sh
. ${dir}/test-cases/unittest.sh
. ${dir}/test-cases/issue-2409-sequential-kubecontext.sh
. ${dir}/test-cases/issue-2269.sh
# ALL DONE -----------------------------------------------------------------------------------------------------------
+57
View File
@@ -0,0 +1,57 @@
# Issue #2269: helmDefaults.skipDeps and helmDefaults.skipRefresh should be respected
# https://github.com/helmfile/helmfile/issues/2269
#
# When helmDefaults.skipDeps=true and helmDefaults.skipRefresh=true are set in
# helmfile.yaml, helmfile should NOT attempt to add repos or update them.
# Previously, only the CLI flags --skip-deps and --skip-refresh worked;
# the helmDefaults equivalents were ignored in withPreparedCharts() and
# runHelmDepBuilds().
issue_2269_input_dir="${cases_dir}/issue-2269/input"
issue_2269_tmp=$(mktemp -d)
issue_2269_output="${issue_2269_tmp}/template.log"
test_start "issue-2269: helmDefaults.skipDeps and skipRefresh prevent repo operations"
# Run helmfile template WITHOUT any CLI --skip-deps/--skip-refresh flags.
# The helmDefaults in helmfile.yaml should be sufficient to skip repo operations.
# We use a fake repo URL that would fail if helmfile tried to contact it.
info "Running helmfile template with helmDefaults.skipDeps=true and skipRefresh=true"
${helmfile} -f "${issue_2269_input_dir}/helmfile.yaml" template > "${issue_2269_output}" 2>&1
code=$?
if [ $code -ne 0 ]; then
cat "${issue_2269_output}"
rm -rf "${issue_2269_tmp}"
fail "helmfile template failed - helmDefaults.skipDeps/skipRefresh were likely ignored and helmfile tried to contact the fake repo"
fi
# Verify no repo operations occurred
if grep -q "Adding repo" "${issue_2269_output}"; then
cat "${issue_2269_output}"
rm -rf "${issue_2269_tmp}"
fail "Issue #2269 regression: 'Adding repo' found in output despite helmDefaults.skipDeps=true and skipRefresh=true"
fi
info "No 'Adding repo' messages found"
if grep -q "Updating repo" "${issue_2269_output}" || grep -q "helm repo update" "${issue_2269_output}"; then
cat "${issue_2269_output}"
rm -rf "${issue_2269_tmp}"
fail "Issue #2269 regression: repo update found in output despite helmDefaults.skipRefresh=true"
fi
info "No repo update messages found"
# Verify the template actually produced output (sanity check)
if ! grep -q "test-2269" "${issue_2269_output}"; then
cat "${issue_2269_output}"
rm -rf "${issue_2269_tmp}"
fail "Template output missing expected content"
fi
info "Template produced expected output"
rm -rf "${issue_2269_tmp}"
test_pass "issue-2269: helmDefaults.skipDeps and skipRefresh prevent repo operations"
@@ -0,0 +1,4 @@
apiVersion: v2
name: test-chart-2269
version: 0.1.0
description: Minimal chart for issue #2269 integration test
@@ -0,0 +1,6 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: test-2269
data:
key: value
@@ -0,0 +1,13 @@
# Issue #2269: helmDefaults.skipDeps and helmDefaults.skipRefresh should prevent
# repo operations (Adding repo, helm repo update) without needing CLI flags.
repositories:
- name: fake-repo
url: https://fake-repo.example.com
helmDefaults:
skipDeps: true
skipRefresh: true
releases:
- name: test-release-2269
chart: ./chart