WIP: Fix bash echo statement exit code
requested to merge 25394-gitlab-ci-script-doesn-t-pass-exit-code-of-previous-command-properly into master
What does this MR do?
- Wraps an echo statement and restores the previous commands exit code, so that the
echo
statement itself doesn't interfere.- Store current exit code
- Echo statement to be run
- Restore exit code (using a subshell
(exit $code)
).
Why was this MR needed?
What's the best way to test this MR?
TODO: Add unit test.
Manual test: This should fail:
script:
- "false"
- echo $?
This should succeed:
script:
- "true"
- echo $?
What are the relevant issue numbers?
Closes #25394 (closed)