Use gopkg.in/yaml.v2 for Helmfile v0.x (#609)

This should fix #435 for Helmfile v0.x releases since the next v0.150.0.
We introduce a new envvar to opt-in to the new YAML library, so that you can give it a shot before upgrading your Helmfile to v1. The same envvar can be used to opt-out of the new YAML library after you upgrade to Helmfile v1, giving you a more flexible migration story.

Signed-off-by: Yusuke Kuoka <ykuoka@gmail.com>
This commit is contained in:
Yusuke Kuoka
2023-01-04 18:17:24 +09:00
committed by GitHub
parent 490bb5d147
commit 4688cf0132
28 changed files with 357 additions and 246 deletions
@@ -2,6 +2,14 @@ if [[ helm_major_version -eq 3 ]]; then
postrender_diff_case_input_dir="${cases_dir}/postrender-diff/input"
postrender_diff_case_output_dir="${cases_dir}/postrender-diff/output"
config_file="helmfile.yaml"
if [[ ${HELMFILE_V1MODE} = true ]]; then
pushd "${postrender_diff_case_input_dir}"
mv "${config_file}" "${config_file}.gotmpl"
config_file="${config_file}.gotmpl"
popd
fi
postrender_diff_out_file=${postrender_diff_case_output_dir}/result
if [[ $EXTRA_HELMFILE_FLAGS == *--enable-live-output* ]]; then
postrender_diff_out_file=${postrender_diff_case_output_dir}/result-live
@@ -14,7 +22,7 @@ if [[ helm_major_version -eq 3 ]]; then
info "Comparing postrender diff output ${postrender_diff_reverse} with ${postrender_diff_case_output_dir}/result.yaml"
for i in $(seq 10); do
info "Comparing build/postrender-diff #$i"
${helmfile} -f ${postrender_diff_case_input_dir}/helmfile.yaml diff --concurrency 1 &> ${postrender_diff_reverse} || fail "\"helmfile diff\" shouldn't fail"
${helmfile} -f ${postrender_diff_case_input_dir}/${config_file} diff --concurrency 1 &> ${postrender_diff_reverse} || fail "\"helmfile diff\" shouldn't fail"
diff -u ${postrender_diff_out_file} ${postrender_diff_reverse} || fail "\"helmfile diff\" should be consistent"
echo code=$?
done