mirror of
https://github.com/helmfile/helmfile.git
synced 2026-10-02 22:01:24 +02:00
This commit adds comprehensive support for Helm 4 while maintaining full backward compatibility with Helm 3. The implementation includes: - Updated helm version detection to support both Helm 3 and Helm 4 - Added HELMFILE_HELM4 environment variable to control Helm version - Modified helm execution paths to handle version-specific binaries - Updated helm plugin installation to support split architecture - Helm 4: Uses split plugin architecture (3 separate .tgz files) - helm-secrets.tgz - helm-secrets-getter.tgz - helm-secrets-post-renderer.tgz - Helm 3: Continues using single plugin installation - Updated Dockerfiles, CI workflows, and core installation code - Helm 4 requires post-renderers to be plugins, not executable scripts - Created Helm plugin structure for integration tests - Updated helmfile.yaml templates to dynamically select renderer type - Added test plugins: add-cm, add-cm1, add-cm2 - Updated integration tests for Helm 3/4 compatibility - Created Helm 4 variant expected output files - Fixed test determinism issues (repo cleanup between iterations) - Added version-specific output filtering for warnings/messages - Updated workflows to test both Helm 3 and Helm 4 - Matrix testing across Helm versions - Updated helm-diff to v3.14.0 for compatibility - Updated README and docs with Helm 4 information - Added migration guidance - Updated version requirements All changes are backward compatible - existing Helm 3 users will see no behavior changes. fix: update Helm 4 lint expected output to match filtered output The grep filter removes the semver warning, so the expected output should not include it. Updated lint-helm4 files to match the filtered output (warning removed, no extra blank line). Signed-off-by: Aditya Menon <amenon@canarytechnologies.com>
95 lines
5.1 KiB
Bash
95 lines
5.1 KiB
Bash
test_start "happypath - simple rollout of httpbin chart"
|
|
|
|
happypath_case_input_dir="${cases_dir}/happypath/input"
|
|
happypath_case_output_dir="${cases_dir}/happypath/output"
|
|
config_file="happypath.yaml.gotmpl"
|
|
|
|
info "Diffing ${happypath_case_input_dir}/${config_file}"
|
|
bash -c "${helmfile} -f ${happypath_case_input_dir}/${config_file} diff --detailed-exitcode; code="'$?'"; [ "'${code}'" -eq 2 ]" || fail "unexpected exit code returned by helmfile diff"
|
|
|
|
info "Diffing ${happypath_case_input_dir}/${config_file} without color"
|
|
bash -c "${helmfile} -f ${happypath_case_input_dir}/${config_file} --no-color diff --detailed-exitcode; code="'$?'"; [ "'${code}'" -eq 2 ]" || fail "unexpected exit code returned by helmfile diff"
|
|
|
|
info "Diffing ${happypath_case_input_dir}/${config_file} with limited context"
|
|
bash -c "${helmfile} -f ${happypath_case_input_dir}/${config_file} diff --context 3 --detailed-exitcode; code="'$?'"; [ "'${code}'" -eq 2 ]" || fail "unexpected exit code returned by helmfile diff"
|
|
|
|
info "Diffing ${happypath_case_input_dir}/${config_file} with altered output"
|
|
bash -c "${helmfile} -f ${happypath_case_input_dir}/${config_file} diff --output simple --detailed-exitcode; code="'$?'"; [ "'${code}'" -eq 2 ]" || fail "unexpected exit code returned by helmfile diff"
|
|
|
|
info "Templating ${happypath_case_input_dir}/${config_file}"
|
|
rm -rf ${dir}/tmp
|
|
${helmfile} -f ${happypath_case_input_dir}/${config_file} --debug template --output-dir tmp
|
|
code=$?
|
|
[ ${code} -eq 0 ] || fail "unexpected exit code returned by helmfile template: ${code}"
|
|
for output in $(ls -d ${dir}/tmp/*); do
|
|
# e.g. test/integration/tmp/happypath-877c0dd4-helmx/helmx
|
|
for release_dir in $(ls -d ${output}/*); do
|
|
release_name=$(basename ${release_dir})
|
|
golden_dir=${happypath_case_output_dir}/v3/${release_name}
|
|
info "Comparing template output ${release_dir}/templates with ${golden_dir}"
|
|
./diff-yamls ${golden_dir} ${release_dir}/templates || fail "unexpected diff in template result for ${release_name}"
|
|
done
|
|
done
|
|
|
|
info "Applying ${happypath_case_input_dir}/${config_file}"
|
|
bash -c "${helmfile} -f ${happypath_case_input_dir}/${config_file} apply --detailed-exitcode; code="'$?'"; echo Code: "'$code'"; [ "'${code}'" -eq 2 ]" || fail "unexpected exit code returned by helmfile apply"
|
|
|
|
info "Syncing ${happypath_case_input_dir}/${config_file}"
|
|
${helmfile} -f ${happypath_case_input_dir}/${config_file} sync
|
|
wait_deploy_ready httpbin-httpbin
|
|
info "Testing httpbin service connectivity"
|
|
n=0
|
|
retry_result=1
|
|
until [ ${n} -ge 5 ]; do
|
|
info "Testing httpbin (attempt $((n+1)))"
|
|
if ${kubectl} run curl-test-${n} --rm -i --restart=Never --image=curlimages/curl:latest --namespace=${test_ns} --command -- curl --fail http://httpbin-httpbin:8000/status/200; then
|
|
retry_result=0
|
|
break
|
|
fi
|
|
retry_result=$?
|
|
n=$[$n+1]
|
|
[ ${n} -lt 5 ] && sleep $((n ** 2))
|
|
done
|
|
[ ${retry_result} -eq 0 ] || fail "httpbin failed to return 200 OK"
|
|
|
|
info "Applying ${happypath_case_input_dir}/${config_file}"
|
|
${helmfile} -f ${happypath_case_input_dir}/${config_file} apply --detailed-exitcode
|
|
code=$?
|
|
[ ${code} -eq 0 ] || fail "unexpected exit code returned by helmfile apply: want 0, got ${code}"
|
|
|
|
info "Locking dependencies"
|
|
${helmfile} -f ${happypath_case_input_dir}/${config_file} deps
|
|
code=$?
|
|
[ ${code} -eq 0 ] || fail "unexpected exit code returned by helmfile deps: ${code}"
|
|
|
|
info "Applying ${happypath_case_input_dir}/${config_file} with locked dependencies"
|
|
${helmfile} -f ${happypath_case_input_dir}/${config_file} apply
|
|
code=$?
|
|
[ ${code} -eq 0 ] || fail "unexpected exit code returned by helmfile apply: ${code}"
|
|
${helm} list --namespace=${test_ns} || fail "unable to list releases"
|
|
|
|
info "Deleting release"
|
|
${helmfile} -f ${happypath_case_input_dir}/${config_file} destroy
|
|
${helm} status --namespace=${test_ns} httpbin &> /dev/null && fail "release should not exist anymore after a delete"
|
|
|
|
info "Ensuring \"helmfile destroy\" doesn't fail when no releases installed"
|
|
${helmfile} -f ${happypath_case_input_dir}/${config_file} destroy || fail "\"helmfile delete\" shouldn't fail when there are no installed releases"
|
|
|
|
info "Re-applying ${happypath_case_input_dir}/${config_file} with locked dependencies"
|
|
${helmfile} -f ${happypath_case_input_dir}/${config_file} apply
|
|
code=$?
|
|
[ ${code} -eq 0 ] || fail "unexpected exit code returned by helmfile apply: ${code}"
|
|
${helm} list --namespace=${test_ns} || fail "unable to list releases"
|
|
|
|
info "Deleting release with --skip-charts"
|
|
${helmfile} -f ${happypath_case_input_dir}/${config_file} destroy --skip-charts
|
|
${helm} status --namespace=${test_ns} httpbin &> /dev/null && fail "release should not exist anymore after a delete"
|
|
|
|
info "Ensuring \"helmfile destroy --skip-charts\" doesn't fail when no releases installed"
|
|
${helmfile} -f ${happypath_case_input_dir}/${config_file} destroy --skip-charts || fail "\"helmfile delete\" shouldn't fail when there are no installed releases"
|
|
|
|
info "Ensuring \"helmfile template\" output does contain only YAML docs"
|
|
(${helmfile} -f ${happypath_case_input_dir}/${config_file} template | kubectl apply -f -) || fail "\"helmfile template | kubectl apply -f -\" shouldn't fail"
|
|
|
|
test_pass "happypath"
|