Skip to content

Instantly share code, notes, and snippets.

@jjaniec
Last active July 16, 2021 09:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jjaniec/f1740990ec34eeba75718c25bf82499a to your computer and use it in GitHub Desktop.
Save jjaniec/f1740990ec34eeba75718c25bf82499a to your computer and use it in GitHub Desktop.
Fetch plugin list from jenkins plugins directory
#!/bin/bash
set -o verbose
set -o pipefail
set -o errexit
set -o nounset
cd plugins
rm plugins.txt || true
for i in *;
do
if [ -d "${i}" ];
then
id=$(cat ${i}/META-INF/MANIFEST.MF | grep -m 1 'Short-Name' | cut -d ' ' -f 2 | tr -dc '[[:print:]]');
version=$(cat ${i}/META-INF/MANIFEST.MF | grep -m 1 'Plugin-Version' | cut -d ' ' -f 2 | tr -dc '[[:print:]]');
echo "${id}:${version}" >> plugins.txt;
fi;
done;
cat plugins.txt
cd ../
# wget https://raw.githubusercontent.com/jenkinsci/docker/master/jenkins-plugin-cli.sh
# wget https://github.com/jenkinsci/plugin-installation-manager-tool/releases/download/2.9.2/jenkins-plugin-manager-2.9.2.jar
# chmod +x ./jenkins-plugin-cli.sh
# mv jenkins-plugin-manager-2.9.2.jar /usr/lib/jenkins-plugin-manager.jar
# ./jenkins-plugin-cli.sh --plugin-file ./plugins.txt --war "/usr/lib/jenkins/jenkins.war" --verbose;
# cp -R /usr/share/jenkins/ref/plugins ./plugins
# sudo chown -R jenkins:jenkins ./plugins
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment