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

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

    I wanted a solution that could run on master without any auth requirements and didn't see it here. I made a quick bash script that will pull out all the versions from the plugins dir.

    if [ -f $JENKINS_HOME/plugin_versions.txt ]; then
      rm $JENKINS_HOME/plugin_versions.txt
    fi
    
    for dir in $JENKINS_HOME/plugins/*/; do
      dir=${dir%*/}
      dir=${dir##*/}
      version=$(grep Plugin-Version $JENKINS_HOME/plugins/$dir/META-INF/MANIFEST.MF | awk -F': ' '{print $2}')
      echo $dir $version >> $JENKINS_HOME/plugin_versions.txt
    done
    

提交回复
热议问题