Commit a7bf57e
authored
fix: resolve subshell issue in image validation loop (#15)
## Problem
The image validation was failing with exit code 1 even when all
validation checks passed successfully. This was caused by a bash
subshell issue.
## Root Cause
The validation loop used a pipe pattern:
```bash
echo "$NEW_IMAGES" | jq -r '.[]' | while IFS= read -r image; do
# validation code that writes to /tmp/validation_failed.txt
done
```
This pattern creates a subshell, and files written inside the subshell
(`/tmp/validation_failed.txt`) are not visible to the parent shell after
the loop completes.
## Solution
Changed to process substitution pattern:
```bash
while IFS= read -r image; do
# validation code that writes to /tmp/validation_failed.txt
done < <(echo "$NEW_IMAGES" | jq -r '.[]')
```
This runs the loop in the current shell context, allowing file writes to
persist correctly.
## Testing
This fix will be validated with test PR #360 in
deutschebank-infrastructure repository, which previously showed all
checks passing but failed with exit code 1.
## Related
- Fixes validation failure in dotCMS/deutschebank-infrastructure#3601 parent eda022f commit a7bf57e
1 file changed
Lines changed: 3 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
393 | 393 | | |
394 | 394 | | |
395 | 395 | | |
396 | | - | |
| 396 | + | |
| 397 | + | |
397 | 398 | | |
398 | 399 | | |
399 | 400 | | |
| |||
540 | 541 | | |
541 | 542 | | |
542 | 543 | | |
543 | | - | |
| 544 | + | |
544 | 545 | | |
545 | 546 | | |
546 | 547 | | |
| |||
0 commit comments