Slide 1
Excellent Education Program
Innovative Methods of Teaching

Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Cum sociis natoque penatibus et magnis dis parturient.

Slide 2
Learning Through Play
Devoted to the Early Education

Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim.

Slide 2
Learning Through Play
Devoted to the Early Education

Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim.

Slide 2
Learning Through Play
Devoted to the Early Education

Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim.

Slide 2
Learning Through Play
Devoted to the Early Education

Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim.

Slide 3
Learning Through Play
Find a Class for your Children

Aenean leo ligula, porttitor eu, consequat vitae, eleifend ac, enim. Aliquam lorem ante, dapibus in, viverra quis.

previous arrow
next arrow

Script to check the build status of a Jenkins job

Spread the Knowledge

Using JSON & Curl

[code]BUILD_STATUS=$(curl –user USER:TOKEN_VALUE –silent $BUILD_URLapi/json | jq -r ‘.result’)
echo $BUILD_STATUS[/code]

Using jenkins Plugins
Plugins Name – Conditional Build Step

For Implementations, Please check here.
https://stackoverflow.com/questions/11125598/getting-the-build-status-in-post-build-script

Using Python & Json

[code]</pre>
#!/usr/bin/python
#
# author: ajs
# license: bsd
# copyright: re2

import json
import sys
import urllib
import urllib2

jenkinsUrl = “https://jenkins.example.com/job/”

if len( sys.argv ) > 1 :
jobName = sys.argv[1]
jobNameURL = urllib.quote(jobName)
else :
sys.exit(1)

try:
jenkinsStream = urllib2.urlopen( jenkinsUrl + jobNameURL + “/lastBuild/api/json” )
except urllib2.HTTPError, e:
print “URL Error: ” + str(e.code)
print ” (job name [” + jobName + “] probably wrong)”
sys.exit(2)

try:
buildStatusJson = json.load( jenkinsStream )
except:
print “Failed to parse json”
sys.exit(3)

if buildStatusJson.has_key( “result” ):
print “[” + jobName + “] build status: ” + buildStatusJson[“result”]
if buildStatusJson[“result”] != “SUCCESS” :
exit(4)
else:
sys.exit(5)

sys.exit(0)

Reference –
<a href=”http://serverfault.com/questions/309848/how-can…49988bb53ee820fe202a”>serverfault.com/questions/309848/how-can…49988bb53ee820fe202a</a>
<pre>[/code]

Rajesh Kumar