Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

List Jenkins plugins and dependencies (with graph)

I have added many plugins to Jenkins. How can I list the plugins and dependencies? Which plugins depend on which ones? Which ones are orphaned or unused, etc.

Ideally, explain how to make a graph (graphviz/dot...) ?

like image 622
Franklin Piat Avatar asked Jun 10 '16 21:06

Franklin Piat


People also ask

How do I list all plugins in Jenkins?

From the Jenkins home page: Click Manage Jenkins. Click Manage Plugins. Click on the Installed tab.

Where can I find plugins in Jenkins?

From the web UI Navigate to the Manage Jenkins > Manage Plugins page in the web UI. Click on the Advanced tab.

How many plugins does Jenkins have?

How many Jenkins Plugins are there? The 1,700+ plugins encompass source code management, administration, platforms, UI/UX, building management, and much more.


1 Answers

Copy-paste this groovy snippet to get a list of plugins (this snippet based on this exemple from zendesk.com):

Note: the groovy must be pasted in _Manage Jenkins >> Script Console

def plugins = jenkins.model.Jenkins.instance.getPluginManager().getPlugins()
plugins.each {
    println "${it.getShortName()} (${it.getVersion()}) => ${it.getDependencies()}"
}

To produce a graph, execute this snippet to generate a DOT graph (graphviz) file...

def plugins = jenkins.model.Jenkins.instance.getPluginManager().getPlugins()
println "digraph test {"
plugins.each {
    def plugin = it.getShortName()
    println "\"${plugin}\";"
    def deps =  it.getDependencies()
    deps.each {
      def s = it.shortName
      println "\"${plugin}\" -> \"${s}\";"
    }
} 
println "}"

Then use graphviz to generate an image from the output above:

dot -Tsvg  plugins.txt > plugins.svg
dot -Tpng  plugins.txt > plugins.png

Or copy-paste the output in one of the Graphviz: Online tool capable of accepting larger files

like image 200
Franklin Piat Avatar answered Sep 28 '22 04:09

Franklin Piat