Created
December 4, 2011 18:03
-
-
Save kellyrob99/1430845 to your computer and use it in GitHub Desktop.
A script to find the source control version of the last successful build on every Jenkins job for a particular server. Outputs whether or not each job is building the expectedVersion.
This file contains 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
import groovy.json.JsonSlurper | |
assert args && args.size() == 2 | |
def urls = args[0].split(',') | |
def expectedVersion = args[1] | |
urls.each { url -> | |
println "examining url $url" | |
def json = new JsonSlurper().parseText(url.toURL().text) | |
json.jobs.each { | |
try | |
{ | |
def job = new JsonSlurper().parseText("${it.url}/api/json?depth=1".toURL().text) | |
if (!job.builds[0].changeSet.revisions[0].module.endsWith(expectedVersion)) | |
{ | |
println "$it.url fails!" | |
} | |
else | |
{ | |
println "$it.url passes!" | |
} | |
} | |
catch (e) | |
{ | |
println "Exception thrown processing $it.url : $e" | |
} | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment