Administrators are often asked to install plugins on production instances. However, doing so may cause unintended consequences.
Follow these best practices to ensure a smooth plugin installation:
-
Determine if the plugin is part of CloudBees Assurance Program.
If it is, you can skip to step 2.
If it is not, answer the following questions. If you answer yes to all the following questions, proceed to step 2. If you answer no to any of the following questions, do not install the plugin.
-
Was it released less than 2 years ago?
-
Is it maintained?
-
Does it have activity?
-
Is it free of security issues?
-
Does it have less than 5 non-security issues?
-
-
Install it on a development instance and run tests.
-
If it passes tests on the development instance, install it on a staging instance and run tests.
-
If it passes tests on the staging instance, install it on the production instance.
Install plugins from the Plugin Manager
To install plugins from the Plugin Manager:
-
Select in the upper-right corner to navigate to the Manage Jenkins page.
-
Select Plugins, and then select Installed plugins.
-
Enter the name of the plugin you want to install in the search field and verify that the plugin is not already installed.
If the plugin appears, then it is already installed.
-
On the Available tab, type the name of the plugin you want to install in the search field.
-
Select Install to the left of the plugin’s name.
-
Select Install, or select the to choose Install after restart.
-
A Download progress page displays the installation status of the plugin and its dependencies.
-
If you selected Install, once all plugins show Success, select Go back to the top page to start using the installed plugins right away.
-
If you selected Install after restart, plugins that require a restart show Downloaded Successfully. Will be activated during the next boot. Select Restart Jenkins when installation is complete and no jobs are running to restart the instance and complete the installation.
-
Install plugins from the command line
You can use the Jenkins CLI tool to install plugins from the command line instead of via the Plugins UI.
Execute a Groovy script and install a plugin using the CLI
| See the CLI user guide for more information on downloading and configuring the Jenkins CLI tool. |
The following bash script will execute a Groovy script and install the 'beer' plugin on all the online client controllers:
#!/usr/bin/env bash JENKINS_CLI=jenkins-cli.jar JENKINS_CJOC_URL=http://localhost:8080/ JENKINS_AUTH=admin:admin if [ -z "$JENKINS_CJOC_URL" ]; then echo "Need to set environment variable JENKINS_CJOC_URL (Operations Center root URL)." exit 1 fi if [ -z "$JENKINS_AUTH" ]; then echo "Need to set environment variable JENKINS_AUTH (format: 'userId:apiToken')." exit 1 fi if [ -f "$JENKINS_CLI" ] then echo "Using $JENKINS_CLI." else wget -O "$JENKINS_CLI" $JENKINS_CJOC_URL/jnlpJars/jenkins-cli.jar fi java -jar $JENKINS_CLI -s $JENKINS_CJOC_URL -auth $JENKINS_AUTH list-masters | jq -r '.data.masters[] | select(.status == "ONLINE") | .url' | while read url; do java -jar $JENKINS_CLI -s $url -auth $JENKINS_AUTH groovy = < configuration-script.groovy java -jar $JENKINS_CLI -s $url -auth $JENKINS_AUTH install-plugin beer done