Install Jenkins Plugins using Command Line Interface
1. Download Jenkins CLI file from Jenkins by executing below command
a. Wget http://<Jenkins-Server-IP-Address>:<Port>/jnlpJars/jenkins-cli.jar
b. Navigate to Path
2. Steps to Create Shell script
a. Create Shell Script for installation of plugins:
#!/bin/sh
java -jar jenkins-cli.jar -s http://$1/ install-plugin parameterized-trigger <Plugin_1 URL> <Plugin_2 URL> — username $2 — password $3 –restart
b. Select required plaugins from below url
http://updates.jenkins-ci.org/download/plugins/
c. Set Parameters as below
Param1: IP Address with Port — (locahost:8080)
Param2: Jenkins Username — (maulikshah)
Param3: Jenkins Password — (password)
d. Save Shell script
3. How to run the shell script
sh <Script name>.sh param1 param2 param3
For Example: sh install_jenkins_plugins.sh localhost:8080 maulikshah password
4. Get list of Installed Plugins
java -jar jenkins-cli.jar -s http://<IP Adddress> list-plugins — username <Username> — password <Password>
For Example: java -jar jenkins-cli.jar -s http:// localhost:8080/ list-plugins — username maulikshah — password password