Skip to content

Instantly share code, notes, and snippets.

@kellyrob99
Created December 4, 2011 18:07
Show Gist options
  • Save kellyrob99/1430856 to your computer and use it in GitHub Desktop.
Save kellyrob99/1430856 to your computer and use it in GitHub Desktop.
Example of parsing out the artifacts of the last successful build on Jenkins/Hudson using the JSON api
import groovy.json.*
def HOSTNAME = 'http://ci.jruby.org'
def JOBNAME = 'jruby-dist'
def JOB_URL = "$HOSTNAME/job/$JOBNAME/lastSuccessfulBuild"
def text = "$JOB_URL/api/json".toURL().text
println JsonOutput.prettyPrint(text)
def json = new JsonSlurper().parseText(text)
json.artifacts.each{
println it
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment