Skip to content

Instantly share code, notes, and snippets.

@KyMidd
Created October 2, 2022 16:20
Show Gist options
  • Select an option

  • Save KyMidd/04e339a322e9ac8e7a16c1647db2bc50 to your computer and use it in GitHub Desktop.

Select an option

Save KyMidd/04e339a322e9ac8e7a16c1647db2bc50 to your computer and use it in GitHub Desktop.
# Read output value from job
#Potential Values: https://javadoc.jenkins-ci.org/hudson/model/Result.html
#SUCCESS - Build had no errors
#UNSTABLE - Build had some errors but they were not fatal
#FAILURE - Build had a fatal error
#NOT_BUILT - Module was not build
#ABORTED - Manually aborted
# Close out
echo "Job status is ${JOBSTATUS}"
if [[ "$JOBSTATUS" == "SUCCESS" ]]; then
echo "Build completed successfully"
echo "--------------------------------------"
exit 0
elif [[ "$JOBSTATUS" == "UNSTABLE" ]]; then
echo "Build completed with UNSTABLE result"
echo "--------------------------------------"
exit 0
else
echo "Job status is ${JOBSTATUS}"
echo "Build did not complete successfully"
echo "Sorry dude"
echo "--------------------------------------"
exit 1
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment