Created
January 5, 2018 11:34
-
-
Save CalamarBicefalo/e6cd2cffe4caa8aeff7fcbb67cf4e782 to your computer and use it in GitHub Desktop.
Script to check whether a jenkins build is broken or not
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
build_info=$(curl -s http://<jenkinshost>/job/<your-job>/lastBuild/api/json --user <read-only-username>:<committable-password>) | |
job_status=`echo $build_info | grep "\"result\":\"SUCCESS\""` | |
if [ -n "$job_status" ] | |
then | |
continue; | |
else | |
while true; do | |
read -p "The latest build is broken or a build is already in progress. Is your commit fixing a broken build? (y or n) " yn | |
case $yn in | |
[Yy] ) echo "Thanks!"; break;; | |
[Nn] ) echo "Please wait until the build is done!"; exit 1;; | |
* ) echo "Please answer y or n.";; | |
esac | |
done | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment