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

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

    I think these are not good enough answer(s)... many involve a couple of extra under-the-hood steps. Here's how I did it.

    sudo apt-get install jq
    

    ...because the JSON output needs to be consumed after you call the API.

    #!/bin/bash
    server_addr = 'jenkins'
    server_port = '8080'
    
    curl -s -k "http://${server_addr}:${server_port}/pluginManager/api/json?depth=1" \
      | jq '.plugins[]|{shortName, version,longName,url}' -c | sort \
      > plugin-list
    
    echo "dude, here's your list: "
    cat plugin-list
    

提交回复
热议问题