Uh oh!
There was an error while loading. Please reload this page.
fix(ci): survive a no-match grep in list-images so the empty check runs (backend#2746) - #893
Conversation
…ns (backend#2746) The `chart_images=$(grep … | sed … | sort -u)` assignment runs under `set -euo pipefail`. When the render has no `image:` lines, `grep` exits 1, `pipefail` propagates it, and `set -e` aborts the script at the assignment — before the defense-in-depth empty check below it. So the fail-loud "the render produced no image: lines … refusing to report an empty pull set" diagnostic was dead code: the operator got a bare non-zero exit with no explanation. Append `|| true`, exactly as the sibling assignment at line ~342 already does, so the empty case reaches the check and prints the actionable message. Both grep-substitution assignments in the script now handle a no-match grep. Verified: bash -n clean, shellcheck -S warning -x clean, and an empty-render probe now prints the diagnostic and exits 1 instead of aborting silently. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
aptracebloc
left a comment
There was a problem hiding this comment.
Correct, minimal fix. Under set -euo pipefail, a no-match grep in the chart_images=$(…) pipeline exits 1, pipefail propagates it, and set -e aborts at the assignment — killing the script before the [ -z "$chart_images" ] diagnostic that was meant to fire. Appending || true (matching the sibling task_repos= idiom) lets the empty case reach that fail-loud check. The successful-enumeration path is unchanged. CI green.
One trivial non-blocking nit (couldn't attach inline this pass): the new comment says survival works "exactly as line 338 does," but 338 is the closing } — the actual || true sibling is task_repos= at ~342 (your PR body has it right). Referencing the assignment by name rather than a line number would keep it from rotting.
Approving.
— drafted with Claude Code
Uh oh!
There was an error while loading. Please reload this page.
Closes tracebloc/backend#2746
Problem
scripts/list-images.shruns underset -euo pipefail. The image-extraction assignment:chart_images=$(grep -hoE '…image:…'"$RENDER"| sed -E '…'| sort -u)When the render contains no
image:lines,grepexits 1 →pipefailpropagates it →set -eaborts the script at the assignment, before the empty check right below it:So that fail-loud diagnostic was dead code — the operator got a bare non-zero exit with no explanation of what went wrong.
Fix
Append
|| true, exactly as the sibling assignment at line ~342 already does, so the empty case reaches the check and prints the actionable message. Both grep-substitution assignments in the script now survive a no-matchgrep.Verification
bash -ncleanshellcheck -S warning -xcleanBugbot Medium, deferred at the develop→staging hop on client#889 — fix-forward on develop.
Note
Low Risk
Single-line shell robustness fix; behavior only changes when grep finds no matches, and then it improves diagnostics without altering successful enumeration paths.
Overview
list-images.shcould exit silently when the Helm render had noimage:lines:grepreturns 1 on no match,pipefail+set -eaborted the script at thechart_images=assignment before the intended empty-set check.The change appends
|| trueto that pipeline (same idea as the task-repogreparound line 342) and documents backend#2746, so the script reaches theif [ -z "$chart_images" ]block and prints the fail-loud message instead of a bare non-zero exit.Reviewed by Cursor Bugbot for commit ee5e3d5. Bugbot is set up for automated code reviews on this repo. Configure here.