Files
feedc0de e17bcb25c6
Validate and deploy error pages / Validate manifests (push) Successful in 18s
Validate and deploy error pages / Deploy to Kubernetes (push) Successful in 1m46s
Render tag-only image references and test them in CI
2026-10-14 21:02:28 +02:00

44 lines
1.3 KiB
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
project_dir=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)
workdir=$(mktemp --directory)
trap 'rm -rf "${workdir}"' EXIT
if (( $# > 0 )); then
values_files=("$@")
else
values_files=(values.yaml values-brunner-ninja.yaml)
fi
for values_file in "${values_files[@]}"; do
case "${values_file}" in
/*) values_path="${values_file}" ;;
*) values_path="${project_dir}/${values_file}" ;;
esac
output="${workdir}/$(basename "${values_file}")"
helm lint "${project_dir}" --values "${values_path}"
helm template traefik-error-pages "${project_dir}" \
--namespace default \
--values "${values_path}" > "${output}"
test -s "${output}"
if grep -Eq 'image:.*(@|%!|<nil>)' "${output}"; then
echo "Rendered image must use a valid repository:tag reference" >&2
exit 1
fi
done
if [[ -f "${workdir}/values-brunner-ninja.yaml" ]]; then
grep --quiet 'brunner\.ninja Reverse Proxy' "${workdir}/values-brunner-ninja.yaml"
grep --quiet '^ name: authentik$' "${workdir}/values-brunner-ninja.yaml"
fi
if [[ -f "${workdir}/values.yaml" ]]; then
if grep --quiet '^ name: error-auth$' "${workdir}/values.yaml"; then
echo "Generic values unexpectedly enabled the authentication middleware" >&2
exit 1
fi
fi
echo "All requested configurations rendered successfully"