No possibiity to faile the job in after_script
after_script
ignores errors
There should be a possibility to fail the after_script
if set -e
(Exit immediately if a command exits with a non-zero status) was used
Steps to reproduce
- Create a gob with some staff
- Use
after_script
to do some checks. If there are some reason to fail the job (For example, some ports were not closed, new temporary files, git changes, etc.), the pipeline should fails too
Example Project
yamsl:
after_script:
- ./scripts/check_after_state.sh
#!/bin/bash
set -e
if [[ `git status --porcelain` ]]; then
# some logic
echo Error: The state should be clean
exit -1
fi
What is the current bug behavior?
set -e
is ignored, job passes
What is the expected correct behavior?
job should fail