How to make a job fail on Jenkins
Hello all,
This is a rather important topic with a rather simple solution:
- Add to your build an Execute Shell
- Set the command to something like:
if [ -f "$file" ] then echo "$file found." else echo "$file not found." exit 1 fi
The important part for the failure is exit 1
If the condition meets it (and for what we care they can always meet it), exit 1 will fail the job.
Remembers that anything that fails (even plugins/syntax errors) will make the job fail.
Don’t fail at failing.