What it means
CI marks a step failed only if it exits non-zero. In a pipe, only the last command's status counts (cmd | tee log hides cmd's failure); a script without set -e carries on after an error and exits with the last command's status.
Causes and fixes
Most likely first. Run the check, and if it matches, apply the fix.
1. A pipe hides the failing command's exit code
Check:
grep -n '|' the step
Fix: set -o pipefail (bash) at the top of the script.
2. The script keeps going after errors
Check:
head -3 script.sh
Fix: set -euo pipefail, and exit with a meaningful code.
3. The test or check prints FAIL but exits 0
Check:
run it locally and echo $?
Fix: Make it exit non-zero on failure.
Fix it yourself
A live machine in your browser with this problem already on it. The grader checks the result.
- A Pipeline That Always Passesmedium 10 min
- Log Everything, Keep the Exit Codemedium 10 min
- A Smoke Test That Always Says OKmedium 12 min
No account needed for your first tries.
Related errors
- unbound variable
The script uses set -u and read a variable that was never set.