Do manual build fail in Jenkins using shell script

Viewed 43321

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.

3 Answers
Related