Do manual build fail in Jenkins using shell script
continuous-integration, jenkins, shell
Solution
All you need to do is exit 1.
if [ -f "$file" ]
then
echo "$file found."
else
echo "$file not found."
exit 1
fi
Problem
I would like to mark a Jenkins build to fail on one scenario for example: ``` if [ -f "$file" ] then echo "$file found." else echo "$file not found." #Do Jenkins Build Fail fi ``` Is it possible via Shell Script? Answer: If we exit with integer 1, Jenkins build will be marked as failed. So I replaced the comment with `exit 1` to resolve this.