Allow helmfile statefile to passed by stdin (#520)

* Allow helmfile statefile to passed by stdin

Signed-off-by: xiaomudk <xiaomudk@gmail.com>
This commit is contained in:
xiaomudk
2022-11-22 11:34:05 +08:00
committed by GitHub
parent ce7f38ee96
commit 7844145ee3
6 changed files with 131 additions and 17 deletions
+24
View File
@@ -27,6 +27,23 @@ for output in $(ls -d ${dir}/tmp/*); do
done
done
info "Templating ${dir}/happypath.yaml from stdin"
pushd ${dir}
rm -rf ./tmp
cat ./happypath.yaml | ../../${helmfile} -f - --debug template --output-dir tmp
code=$?
[ ${code} -eq 0 ] || fail "unexpected exit code returned by helmfile template: ${code}"
for output in $(ls -d ./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=./templates-golden/v${helm_major_version}/${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
popd
info "Applying ${dir}/happypath.yaml"
bash -c "${helmfile} -f ${dir}/happypath.yaml apply --detailed-exitcode; code="'$?'"; echo Code: "'$code'"; [ "'${code}'" -eq 2 ]" || fail "unexpected exit code returned by helmfile apply"
@@ -41,6 +58,13 @@ ${helmfile} -f ${dir}/happypath.yaml apply --detailed-exitcode
code=$?
[ ${code} -eq 0 ] || fail "unexpected exit code returned by helmfile apply: want 0, got ${code}"
info "Applying ${dir}/happypath.yaml from stdin"
pushd ${dir}
cat ./happypath.yaml | ../../${helmfile} -f - apply --detailed-exitcode
code=$?
[ ${code} -eq 0 ] || fail "unexpected exit code returned by helmfile apply: want 0, got ${code}"
popd
info "Locking dependencies"
${helmfile} -f ${dir}/happypath.yaml deps
code=$?