Skip to content

Instantly share code, notes, and snippets.

@scrain
Last active November 1, 2019 22:00
Show Gist options
  • Save scrain/7c93322d7c587a458b51982f4e9798c6 to your computer and use it in GitHub Desktop.
Save scrain/7c93322d7c587a458b51982f4e9798c6 to your computer and use it in GitHub Desktop.
Jenkins script to report jobs by the JDK used
def jobsWithJdkSupport = Jenkins.instance.getAllItems(Job.class).findAll{it.hasProperty('JDK')}
def jdksInUse = jobsWithJdkSupport.collect{it.JDK?.name}.unique()
println "jdks in use: ${jdksInUse}\n"
jdksInUse.each{ jdk ->
println "jdk '${jdk}'"
jobsWithJdkSupport.findAll{ it.JDK?.name == jdk }.each { job ->
println "\t${job.name}"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment