How to get a list of installed Jenkins plugins with name and version pair How to get a list of installed Jenkins plugins with name and version pair jenkins jenkins

How to get a list of installed Jenkins plugins with name and version pair


You can retrieve the information using the Jenkins Script Console which is accessible by visiting http://<jenkins-url>/script. (Given that you are logged in and have the required permissions).

Screenshot of the Script Console

Enter the following Groovy script to iterate over the installed plugins and print out the relevant information:

Jenkins.instance.pluginManager.plugins.each{  plugin ->     println ("${plugin.getDisplayName()} (${plugin.getShortName()}): ${plugin.getVersion()}")}

It will print the results list like this (clipped):

SScreenshot of script output

This solutions is similar to one of the answers above in that it uses Groovy, but here we are using the script console instead. The script console is extremely helpful when using Jenkins.

Update

If you prefer a sorted list, you can call this sort method:

def pluginList = new ArrayList(Jenkins.instance.pluginManager.plugins)pluginList.sort { it.getShortName() }.each{  plugin ->     println ("${plugin.getDisplayName()} (${plugin.getShortName()}): ${plugin.getVersion()}")}

Adjust the Closure to your liking (e.g. here it is sorted by the shortName, in the example it is sorted by DisplayName)


These days I use the same approach as the answer described by @Behe below instead, updated link: https://stackoverflow.com/a/35292719/3423146 (old link: https://stackoverflow.com/a/35292719/1597808)


You can use the API in combination with depth, XPath, and wrapper arguments.

The following will query the API of the pluginManager to list all plugins installed, but only to return their shortName and version attributes. You can of course retrieve additional fields by adding '|' to the end of the XPath parameter and specifying the pattern to identify the node.

wget http://<jenkins>/pluginManager/api/xml?depth=1&xpath=/*/*/shortName|/*/*/version&wrapper=plugins

The wrapper argument is required in this case, because it's returning more than one node as part of the result, both in that it is matching multiple fields with the XPath and multiple plugin nodes.

It's probably useful to use the following URL in a browser to see what information on the plugins is available and then decide what you want to limit using XPath:

http://<jenkins>/pluginManager/api/xml?depth=1


Jenkins 1.588 (2nd of November, 2014) & 1.647 (4th of February, 2016)

  • Jenkins > Manage Jenkins

    enter image description here

  • System Information

    enter image description here

  • Plugins

    enter image description here