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

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

    Another option for Python users:

    from jenkinsapi.jenkins import Jenkins
    
    #get the server instance
    jenkins_url = 'http://:/jenkins'
    server = Jenkins(jenkins_url, username = '', password = '')
    
    #get the installed plugins as list and print the pairs
    plugins_dictionary = server.get_plugins().get_plugins_dict()
    for key, value in plugins_dictionary.iteritems():
        print "Plugin name: %s, version: %s" %(key, value.version)
    

提交回复
热议问题