From a88ece05a466e0402166b50246345a4aadf63e57 Mon Sep 17 00:00:00 2001 From: Levi van Noort <73097785+levivannoort@users.noreply.github.com> Date: Wed, 14 Oct 2026 09:47:09 +0200 Subject: [PATCH] fix: fail update-images when values.yaml can't be read The image list came from yq through process substitution, whose exit status set -e doesn't see: a missing yq or an unparseable values.yaml printed an error and exited 0, like a run with nothing to update. Read it into a variable first. --- hack/update-images.sh | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/hack/update-images.sh b/hack/update-images.sh index 528a814..e7e7e3e 100755 --- a/hack/update-images.sh +++ b/hack/update-images.sh @@ -80,8 +80,14 @@ newest() { escape() { sed 's/[][\.*^$+?(){}|/]/\\&/g' <<<"$1"; } +# Read before the loop rather than through process substitution, whose exit +# status set -e doesn't see: a values.yaml yq can't parse must fail the run. +images=$(yq -r '.. | select(tag == "!!map" and has("registry") and has("repository") and .tag != "") + | [(path | map(tostring) | join(".")), .registry, .repository, .tag] | @tsv' "$VALUES") + changed=0 while IFS=$'\t' read -r path registry repository tag; do + [[ -n "$path" ]] || continue # the here-string's line when there are no images if [[ "$all" == false ]] && grep -qx "${registry}/${repository}" <<<"$appwrite_group"; then printf ' %-45s %s (follows Appwrite %s, --all to update)\n' "${registry}/${repository}" "$tag" \ "$(yq '.appVersion' "$CHART/Chart.yaml")" @@ -106,8 +112,7 @@ while IFS=$'\t' read -r path registry repository tag; do { print } ' "$VALUES" > "$VALUES.tmp" && mv "$VALUES.tmp" "$VALUES" fi -done < <(yq -r '.. | select(tag == "!!map" and has("registry") and has("repository") and .tag != "") - | [(path | map(tostring) | join(".")), .registry, .repository, .tag] | @tsv' "$VALUES") +done <<<"$images" if [[ "$changed" -gt 0 && "$dry_run" == false ]]; then "$(dirname "$0")/chart-images.sh"