Skip to content

fix(ci): survive a no-match grep in list-images so the empty check runs (backend#2746) - #893

Merged
saqlainsyed007 merged 1 commit into
developfrom
fix/2746-grep-pipefail-empty-check
Aug 28, 2026
Merged

fix(ci): survive a no-match grep in list-images so the empty check runs (backend#2746)#893
saqlainsyed007 merged 1 commit into
developfrom
fix/2746-grep-pipefail-empty-check

Conversation

@saqlainsyed007

@saqlainsyed007saqlainsyed007 commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

Closes tracebloc/backend#2746

Problem

scripts/list-images.sh runs under set -euo pipefail. The image-extraction assignment:

chart_images=$(grep -hoE '…image:…'"$RENDER"| sed -E ''| sort -u)

When the render contains no image: lines, grep exits 1 → pipefail propagates it → set -eaborts the script at the assignment, before the empty check right below it:

if [ -z"$chart_images" ];thenecho"list-images: the render produced no image: lines at all…">&2echo" …Refusing to report an empty pull set.">&2exit 1
fi

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-match grep.

Verification

  • bash -n clean
  • shellcheck -S warning -x clean
  • Empty-render probe: now prints the diagnostic and exits 1 (previously aborted silently at the assignment)

Bugbot 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.sh could exit silently when the Helm render had no image: lines: grep returns 1 on no match, pipefail + set -e aborted the script at the chart_images= assignment before the intended empty-set check.

The change appends || true to that pipeline (same idea as the task-repo grep around line 342) and documents backend#2746, so the script reaches the if [ -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.

…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>

@aptraceblocaptracebloc left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@saqlainsyed007
saqlainsyed007 merged commit ad4483c into developAug 28, 2026
50 of 52 checks passed
@saqlainsyed007
saqlainsyed007 deleted the fix/2746-grep-pipefail-empty-check branch August 28, 2026 07:22
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@saqlainsyed007@aptracebloc@LukasWodka