Skip to content

Instantly share code, notes, and snippets.

@kpettijohn
Created April 26, 2018 17:13
Show Gist options
  • Save kpettijohn/92ea7e202119c8d68e56968c9f18ff2b to your computer and use it in GitHub Desktop.
Save kpettijohn/92ea7e202119c8d68e56968c9f18ff2b to your computer and use it in GitHub Desktop.
Jenkins list all plugins with version number
import groovy.json.JsonBuilder
import groovy.json.JsonOutput
def json = new JsonBuilder().plugins {}
def plugins = jenkins.model.Jenkins.instance.getPluginManager().getPlugins()
for (p in plugins){
j = new JsonBuilder().plugin {
"${p.getShortName()}" "${p.getVersion()}"
}
json.plugins << j.plugin
}
println(new JsonBuilder(json.plugins).toPrettyString())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment