How can I get a list of installed Jenkins plugins?
I searched the Jenkins Remote Access API document, but it was not found. Should I use Jenkins\' CLI? Is there a d
From the Jenkins home page:
Or
If you're working in a docker environment and want to output the plugin list in a plugins.txt format in order to pass that to the install_scripts.sh use these scripts in the http://{jenkins}/script
console:
Jenkins.instance.pluginManager.plugins.each{
plugin ->
println ("${plugin.getShortName()}:${plugin.getVersion()}")
}
Jenkins.instance.pluginManager.plugins.each{
plugin ->
println ("${plugin.getShortName()}:latest")
}
There is a table listing all the plugins installed and whether or not they are enabled at http://jenkins/systemInfo
The Jenkins CLI supports listing all installed plugins:
java -jar jenkins-cli.jar -s http://localhost:8080/ list-plugins
Use Jenkins CLI like this:
java -jar jenkins-cli.jar -s http://[jenkins_server] groovy = < pluginEnumerator.groovy
=
in the call means 'read from standard input'. pluginEnumerator.groovy contains the following Groovy code:
println "Running plugin enumerator"
println ""
def plugins = jenkins.model.Jenkins.instance.getPluginManager().getPlugins()
plugins.each {println "${it.getShortName()} - ${it.getVersion()}"}
println ""
println "Total number of plugins: ${plugins.size()}"
If you would like to play with the code, here's Jenkins Java API documentation.
If Jenkins run in a the Jenkins Docker container you can use this command line in Bash:
java -jar /var/jenkins_home/war/WEB-INF/jenkins-cli.jar -s http://localhost:8080/ list-plugins --username admin --password `/bin/cat /var/jenkins_home/secrets/initialAdminPassword`