fix: avoid --argjson by piping stack info into jq #22

Merged
elvis merged 1 commit from feat/cicd_improvements into main 2026-05-28 18:01:47 +00:00
Owner

Summary

Root cause: ash (Alpine's sh) doesn't propagate set -e into command substitutions, so when jq '.Env // []' received invalid input and produced empty output, $STACK_ENV silently became an empty string — which is not valid JSON for --argjson.

Fix: removed --argjson entirely. Instead of storing the Env array in a shell variable and passing it back to jq, we now pipe $STACK_INFO as stdin directly into jq and extract .Env from within jq itself:

BODY=$(printf '%s' "$STACK_INFO" | jq \
  --arg content "$STACK_FILE" \
  '{StackFileContent: $content, Env: (.Env // []), Prune: false, PullImage: true}')

No shell variable ever holds a raw JSON fragment that needs to be re-parsed.

Test plan

  • Merge to main → "Build and Push" completes with "Stack redeployed successfully" and no jq errors

🤖 Generated with Claude Code

## Summary Root cause: `ash` (Alpine's sh) doesn't propagate `set -e` into command substitutions, so when `jq '.Env // []'` received invalid input and produced empty output, `$STACK_ENV` silently became an empty string — which is not valid JSON for `--argjson`. Fix: removed `--argjson` entirely. Instead of storing the Env array in a shell variable and passing it back to jq, we now pipe `$STACK_INFO` as stdin directly into jq and extract `.Env` from within jq itself: ```sh BODY=$(printf '%s' "$STACK_INFO" | jq \ --arg content "$STACK_FILE" \ '{StackFileContent: $content, Env: (.Env // []), Prune: false, PullImage: true}') ``` No shell variable ever holds a raw JSON fragment that needs to be re-parsed. ## Test plan - [ ] Merge to main → "Build and Push" completes with "Stack redeployed successfully" and no jq errors 🤖 Generated with [Claude Code](https://claude.com/claude-code)
fix: avoid --argjson by piping stack info directly into jq
Some checks failed
Test / test (pull_request) Failing after 2s
a3f9842ba0
ash (Alpine's sh) doesn't exit on failed command substitutions even with
set -e, so an empty $STACK_ENV was silently passed to --argjson. Instead,
pipe $STACK_INFO as stdin to jq and extract .Env inside jq itself.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
elvis merged commit 0b1bd71e8a into main 2026-05-28 18:01:47 +00:00
elvis deleted branch feat/cicd_improvements 2026-05-28 18:01:47 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
elvis/actual-mcp!22
No description provided.