The plugin manager downloads plugins and their dependencies into a folder so that they can easily be imported into an instance of Jenkins. The goal of this tool is to replace the Docker install-plugins.sh script and the many other implementations of plugin management that have been recreated across Jenkins. The tool also allows users to see more information about the plugins they are downloading such as available updates and security warnings. By default, plugins will be downloaded; the user can specify not to download plugins using the --no-download option.
Download the latest plugin-management-cli jar from here and run it as shown below.
java -jar /file/path/jenkins-plugin-manager-*.jar --war /file/path/jenkins.war --plugin-file /file/path/plugins.txt --plugins delivery-pipeline-plugin:1.3.2 deployit-plugin
Alternatively you may build it yourself from source:
mvn clean install
java -jar plugin-management-cli/target/jenkins-plugin-manager-*.jar --war /file/path/jenkins.war --plugin-file /file/path/plugins.txt --plugins delivery-pipeline-plugin:1.3.2 deployit-plugin
--plugin-file
or-f
: (optional) Path to the plugins.txt or plugins.yaml file, which contains a list of plugins to install. If this file does not exist or the file exists but does not have a .txt or .yaml/.yml extension, an error will be thrown.--plugin-download-directory
or-d
: (optional) Path to the directory in which to install plugins, which can also be set via the PLUGIN_DIR environment variable. Directory will be created if it does not exist. If no directory is entered, directory will default to C:\ProgramData\Jenkins\Reference\Plugins if detected OS is Windows, or /usr/share/jenkins/ref/plugins otherwise.--plugins
or-p
: (optional) List of plugins to install (see plugin format below), separated by a space.--war
or-w
: (optional) Path to Jenkins war file. If no war file is entered, will default to /usr/share/jenkins/jenkins.war or C:\ProgramData\Jenkins\jenkins.war, depending on the user's OS. Plugins that are already included in the Jenkins war will only be downloaded if their required version is newer than the one included.--list
or-l
: (optional) Lists plugin names and versions of: installed plugins (plugins that already exist in the plugin directory), bundled plugins (non-detached plugins that exist in the war file), plugins that will be downloaded (highest required versions of the requested plugins and dependencies that are not already installed), and the effective plugin set (the highest versions of all plugins that are already installed or will be installed)--verbose
: (optional) Set to true to show additional information about plugin dependencies and download process--view-security-warnings
: (optional) Set to true to show if any of the user specified plugins have security warnings--view-all-security-warnings
: (optional) Set to true to show all plugins that have security warnings.--available-updates
: (optional) Set to true to show if any requested plugins have newer versions available. If a Jenkins version-specific update center is available, the latest plugin version will be determined based on that update center's data.--output {json,stdout,yaml}
: (optional) Format to output plugin updates file in, stdout is the default.--latest false
: (optional) Set to false to download the minimum required version of all dependencies.--latest-specified
: (optional) (advanced) Set to true to download latest dependencies of any plugin that is requested to have the latest version. All other plugin dependency versions are determined by the update center metadata or the plugin MANIFEST.MF.--jenkins-update-center
: (optional) Sets the main update center filename, which can also be set via the JENKINS_UC environment variable. If a CLI option is entered, it will override what is set in the environment variable. If not set via CLI option or environment variable, will default to https://updates.jenkins.io/update-center.actual.json--jenkins-experimental-update-center
: (optional) Sets the experimental update center, which can also be set via the JENKINS_UC_EXPERIMENTAL environment variable. If a CLI option is entered, it will override what is set in the environment variable. If not set via CLI option or environment variable, will default to https://updates.jenkins.io/experimental/update-center.actual.json--jenkins-incrementals-repo-mirror
: (optional) Sets the incrementals repository mirror, which can also be set via the JENKINS_INCREMENTALS_REPO_MIRROR environment variable. If a CLI option is entered, it will override what is set in the environment variable. If not set via CLI option or environment variable, will default to https://repo.jenkins-ci.org/incrementals.--jenkins-plugin-info
: (optional) Sets the location of plugin information, which can also be set via the JENKINS_PLUGIN_INFO environment variable. If a CLI option is entered, it will override what is set in the environment variable. If not set via CLI option or environment variable, will default to https://updates.jenkins.io/current/plugin-versions.json.--version
or-v
: (optional) Displays the plugin management tool version and exits.--no-download
: (optional) Set to true to avoid downloading plugins. By default it is set to false and plugins will be downloaded.--skip-failed-plugins
: (optional) Adds the option to skip plugins that fail to download - CAUTION should be used when passing this flag as it could leave Jenkins in a broken state.
CACHE_DIR
: used to configure the directory where the plugins update center cache is located. By default it will be in~/.cache/jenkins-plugin-management-cli
, if the user doesn't have a home directory when it will go to:$(pwd)/.cache/jenkins-plugin-management-cli
.
The expected format for plugins in the .txt file or entered through the --plugins
CLI option is artifact ID:version
or artifact ID:url
or artifact:version:url
Use plugin artifact ID, without -plugin extension. If a plugin cannot be downloaded, -plugin will be appended to the name and download will be retried. This is for cases in which plugins don't follow the rules about artifact ID (i.e. docker plugin).
The version and download url are optional. By default, the latest version of the plugin will be downloaded. If both a version and a url are supplied, the version will not be used to determine the plugin download location and the library will attempt to download the plugin from the given url.
The following custom version specifiers can also be used:
latest
- downloads the latest version from a version specific update center if one exists for the version in the Jenkins war file. If no version specific update center exists, will use the main update center https://updates.jenkins.ioexperimental
- downloads the latest version from the experimental update center, which offers Alpha and Beta versions of plugins. Default value: https://updates.jenkins.io/experimentalincrementals;org.jenkins-ci.plugins.workflow;2.19-rc289.d09828a05a74
- downloads the plugin from the incrementals repo. For this option you need to specify groupId of the plugin. Note that this value may change between plugin versions without notice. More information on incrementals and their use for Docker images can be found here.
Plugins can also be entered in a Jenkins yaml file with the following format:
jenkins:
...
plugins:
- artifactId: git
source:
version: latest
- artifactId: job-import-plugin
source:
version: 2.1
- artifactId: docker
- artifactId: cloudbees-bitbucket-branch-source
source:
version: 2.4.4
- artifactId: script-security
source:
url: http://ftp-chi.osuosl.org/pub/jenkins/plugins/script-security/1.56/script-security.hpi
- artifactId: workflow-step-api
groupId: org.jenkins-ci.plugins.workflow
source:
version: 2.19-rc289.d09828a05a74
...
tool:
...
Any root object other than plugins
will be ignored by the plugin installation manager tool. As with the plugins.txt file, version and url are optional, and if no version is entered, the latest version is the default. If a groupId is entered, the tool will try to download the plugin from the incrementals repository.
The CLI can output a new file with all plugins updated.
Text format:
$ java -jar jenkins-plugin-manager-*.jar --available-updates --output txt --plugins mailer:1.31
mailer:1.32
Yaml format:
java -jar jenkins-plugin-manager-*.jar --available-updates --output txt --plugins mailer:1.31
plugins:
- artifactId: "mailer"
source:
version: "1.32"
Human readable:
$ java -jar jenkins-plugin-manager-*.jar --available-updates --plugins mailer:1.31
Available updates:
mailer (1.31) has an available update: 1.32
If a url is included, then a placeholder should be included for the version. Examples of plugin inputs:
github-branch-source
- will download the latest versiongithub-branch-source:latest
- will download the latest versiongithub-branch-source:2.5.3
- will download version 2.5.3github-branch-source:experimental
- will download the latest version from the experimental update centergithub-branch-source:2.5.2:https://updates.jenkins.io/2.121/latest/github-branch-source.hpi
- will download version of plugin at url regardless of requested versiongithub-branch-source:https://updates.jenkins.io/2.121/latest/github-branch-source.hpi
- will treat the url like the version, which is not likely the behavior you wantgithub-branch-source::https://updates.jenkins.io/2.121/latest/github-branch-source.hpi
- will download plugin from url
If a plugin to be downloaded from the incrementals repository is requested using the -plugins option from the CLI, the plugin name should be enclosed in quotes, since the semi-colon is otherwise interpreted as the end of the command.
java -jar plugin-management-cli/target/jenkins-plugin-manager-*.jar -p "workflow-support:incrementals;org.jenkins-ci.plugins.workflow;2.19-rc289.d09828a05a74"
Proxy support is available using standard Java networking system properties http.proxyHost
and http.proxyPort
. Note that this provides only basic NTLM support and you may need to use an authentication proxy like CNTLM.
# Example using proxy system properties
java -Dhttp.proxyPort=3128 -Dhttp.proxyHost=myproxy.example.com -jar plugin-management-cli/target/jenkins-plugin-manager-*.jar
The plugin manager tries to use update center data to get the latest information about a plugin's dependencies. If this information is unavailable, it will use the dependency information from the downloaded plugin's MANIFEST.MF file. By default, the versions of the plugin dependencies are determined by the update center metadata or the plugin MANIFEST.MF file, but the user can specify other behavior using the latest
or latest-specified
options.
For plugins listed in a .txt file, each plugin must be listed on a new line. Comments beginning with #
will be filtered out.
Support for downloading plugins from maven is not currently supported. JENKINS-58217
When using --latest
you may run into a scenario where the jenkins update mirror contains the directory of the newer version of a plugin(release in progress), regardless of if there is a jpi to download, which results in a download failure. It's recommended that you pin your plugin requirement versions until the mirror has been updated to more accurately represent what's available, more information can be found here, and here.