aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xplugins/check_jenkins_job13
1 files changed, 8 insertions, 5 deletions
diff --git a/plugins/check_jenkins_job b/plugins/check_jenkins_job
index ab40f87..5f075bd 100755
--- a/plugins/check_jenkins_job
+++ b/plugins/check_jenkins_job
@@ -15,15 +15,18 @@ USER=$4
shift 5
-CURL_OUT=$( curl -s --basic -u "$USER:$PASS" $@ $JENKINS_URL/view/$VIEW/job/$JOB/lastBuild/api/json )
+CURL_OUT=$( curl -s --basic -u "$USER:$PASS" "$@" "$JENKINS_URL/view/$VIEW/job/$JOB/lastBuild/api/json" )
-RESULT=$( jq -r .result <<< $CURL_OUT )
-ID=$( jq -r .displayName <<< $CURL_OUT )
+RESULT=$( jq -r .result <<< "$CURL_OUT" )
+RUNNING=$( jq -r .building <<< "$CURL_OUT" )
+ID=$( jq -r .displayName <<< "$CURL_OUT" )
if [ "$RESULT" = "SUCCESS" ]; then
- echo JOB OK: $JOB $ID succeeded
+ echo "JOB OK: $JOB $ID succeeded"
exit 0
+elif [ "$RUNNING" = "true" ]; then
+ echo "JOB OK: $JOB $ID is running"
fi
-echo JOB CRITICAL: $JOB $ID failed
+echo "JOB CRITICAL: $JOB $ID failed"
exit 2