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

前端 未结 21 2245
误落风尘
误落风尘 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:38

    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:

    1. This version is useful for getting specific package version
    Jenkins.instance.pluginManager.plugins.each{
      plugin -> 
        println ("${plugin.getShortName()}:${plugin.getVersion()}")
    }
    
    1. If you only want the plugin with the latest version you can use this (thanks @KymikoLoco for the tip)
    Jenkins.instance.pluginManager.plugins.each{
      plugin -> 
        println ("${plugin.getShortName()}:latest")
    }
    

提交回复
热议问题