Created
April 26, 2018 17:13
-
-
Save kpettijohn/92ea7e202119c8d68e56968c9f18ff2b to your computer and use it in GitHub Desktop.
Jenkins list all plugins with version number
This file contains hidden or 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.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