fix: search recursively for YAML files in Helm 4 output-dir integration test
Agent-Logs-Url: https://github.com/helmfile/helmfile/sessions/c5d33143-f611-40db-b73a-e5189d944ffd Co-authored-by: yxxhero <11087727+yxxhero@users.noreply.github.com>
This commit is contained in:
parent
e2dcdea56a
commit
680835aa06
|
|
@ -24,14 +24,27 @@ ${helmfile} -f ${issue_2515_case_dir}/input/helmfile.yaml \
|
|||
--output-dir-template "${issue_2515_output_dir}/{{.Release.Name}}" \
|
||||
&> ${issue_2515_tmp}/log || fail "helmfile template should not fail"
|
||||
|
||||
issue_2515_templates_dir="${issue_2515_output_dir}/issue-2515/templates"
|
||||
if [ ! -d "${issue_2515_templates_dir}" ]; then
|
||||
fail "Expected templates directory ${issue_2515_templates_dir} to exist"
|
||||
fi
|
||||
|
||||
issue_2515_output_file=$(find "${issue_2515_templates_dir}" -type f \( -name '*.yaml' -o -name '*.yml' \) | head -n 1)
|
||||
if [ -z "${issue_2515_output_file}" ]; then
|
||||
fail "Expected rendered YAML file under ${issue_2515_templates_dir}"
|
||||
if [ "${HELMFILE_HELM4}" = "1" ]; then
|
||||
# Helm 4 natively applies --post-renderer to --output-dir output.
|
||||
# The directory structure may differ from Helm 3 (no guaranteed templates/ subdir),
|
||||
# so search recursively for any YAML file. Fall back to stdout (log) if no files written.
|
||||
issue_2515_output_file=$(find "${issue_2515_output_dir}" -type f \( -name '*.yaml' -o -name '*.yml' \) 2>/dev/null | head -n 1)
|
||||
if [ -z "${issue_2515_output_file}" ]; then
|
||||
# Helm 4 may write post-rendered output to stdout rather than files
|
||||
issue_2515_output_file="${issue_2515_tmp}/log"
|
||||
if ! grep -q "postrendered" "${issue_2515_output_file}"; then
|
||||
fail "Expected post-rendered YAML (namespace postrendered) in output files under ${issue_2515_output_dir} or stdout. Dir: $(find ${issue_2515_output_dir} 2>/dev/null || echo 'not found'). Log: $(cat ${issue_2515_output_file})"
|
||||
fi
|
||||
fi
|
||||
else
|
||||
issue_2515_templates_dir="${issue_2515_output_dir}/issue-2515/templates"
|
||||
if [ ! -d "${issue_2515_templates_dir}" ]; then
|
||||
fail "Expected templates directory ${issue_2515_templates_dir} to exist"
|
||||
fi
|
||||
issue_2515_output_file=$(find "${issue_2515_templates_dir}" -type f \( -name '*.yaml' -o -name '*.yml' \) | head -n 1)
|
||||
if [ -z "${issue_2515_output_file}" ]; then
|
||||
fail "Expected rendered YAML file under ${issue_2515_templates_dir}"
|
||||
fi
|
||||
fi
|
||||
|
||||
if grep -q "original-cm" "${issue_2515_output_file}"; then
|
||||
|
|
|
|||
Loading…
Reference in New Issue