File tree Expand file tree Collapse file tree 1 file changed +45
-0
lines changed
tools/jenkins/jenkins_home Expand file tree Collapse file tree 1 file changed +45
-0
lines changed Original file line number Diff line number Diff line change 1+ #!/usr/bin/python
2+ import urllib
3+ import json
4+ import sys
5+
6+
7+ def print_usage ():
8+ print "Usage: %s [jenkins_url (eg. http://50.56.12.202:8080/)]" \
9+ % sys .argv [0 ]
10+ sys .exit ()
11+
12+
13+ def fetch_blob (url ):
14+ return json .loads (urllib .urlopen (url + '/api/json' ).read ())
15+
16+
17+ if len (sys .argv ) < 2 :
18+ print_usage ()
19+
20+ BASE_URL = sys .argv [1 ]
21+
22+ root = fetch_blob (BASE_URL )
23+ results = {}
24+ for job_url in root ['jobs' ]:
25+ job = fetch_blob (job_url ['url' ])
26+ if job .get ('activeConfigurations' ):
27+ (tag , name ) = job ['name' ].split ('-' )
28+ if not results .get (tag ):
29+ results [tag ] = {}
30+ if not results [tag ].get (name ):
31+ results [tag ][name ] = []
32+
33+ for config_url in job ['activeConfigurations' ]:
34+ config = fetch_blob (config_url ['url' ])
35+
36+ log_url = ''
37+ if config .get ('lastBuild' ):
38+ log_url = config ['lastBuild' ]['url' ] + 'console'
39+
40+ results [tag ][name ].append ({'test' : config ['displayName' ],
41+ 'status' : config ['color' ],
42+ 'logUrl' : log_url ,
43+ 'healthReport' : config ['healthReport' ]})
44+
45+ print json .dumps (results )
You can’t perform that action at this time.
0 commit comments