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

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

    With curl and jq:

    curl -s /pluginManager/api/json?depth=1 \
      | jq -r '.plugins[] | "\(.shortName):\(.version)"' \
      | sort
    

    This command gives output in a format used by special Jenkins plugins.txt file which enables you to pre-install dependencies (e.g. in a docker image):

    ace-editor:1.1
    ant:1.8
    apache-httpcomponents-client-4-api:4.5.5-3.0
    

    Example of a plugins.txt: https://github.com/hoto/jenkinsfile-examples/blob/master/source/jenkins/usr/share/jenkins/plugins.txt

提交回复
热议问题