Skip to content

Instantly share code, notes, and snippets.

@tizki
Last active September 7, 2016 18:52
Show Gist options
  • Save tizki/67e7e87b72c1d2bfef141b3b3e4496a1 to your computer and use it in GitHub Desktop.
Save tizki/67e7e87b72c1d2bfef141b3b3e4496a1 to your computer and use it in GitHub Desktop.
This script prints builds of a job by their result
/* This script prints builds by their result */
def jenkins = Jenkins.getInstance()
def jobName = "myJob"
def job = jenkins.getItem(jobName)
results = ["SUCCESS","UNSTABLE","FAILURE","ABORTED"]
def builfdByResult = { result -> job.getBuilds().findAll{ it.getResult().toString() == result} }
results.each { res ->
println "Builds ended with result ${res}"
println builfdByResult(res)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment