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

前端 未结 21 2225
误落风尘
误落风尘 2020-11-30 17:14

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

21条回答
  •  栀梦
    栀梦 (楼主)
    2020-11-30 17:29

    # list of plugins in sorted order
    # Copy this into your Jenkins script console
        def plugins = jenkins.model.Jenkins.instance.getPluginManager().getPlugins()
    
        List list = new ArrayList()
    
        i = 0
        plugins.each {
          ++i
          //println " ${i}  ${it.getShortName()}: ${it.getVersion()}"
          list.add("${it.getShortName()}: ${it.getVersion()}")
        }
    
        list.sort{it}
        i = 0
        for (String item : list) {
          i++
          println(" ${i} ${item}")
        }
    

提交回复
热议问题