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

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

    These days I use the same approach as the answer described by @Behe below instead 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:///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:///pluginManager/api/xml?depth=1
    

提交回复
热议问题