"Everybody is re-inventing the wheel, partially implementing the "details" of plugin management (signed metadata, artifacts checksums, plugins detached from core,…). It becomes obvious Jenkins should provide adequate tooling for plugin installation outside a live Jenkins instance." JENKINS-53767
My Google Summer of Code project tries to solve this problem by creating a library that will unify plugin management logic across the different implementations of Jenkins and providing a CLI tool that will make it easy for users to download plugins and view plugin information before Jenkins even starts. I’m excited to share that we just released an alpha version that you can check out here!
While I looked into pulling the Plugin Manager out of Jenkins core, this ended up being a challenging first step due to the complexity and number of dependencies. We instead decided to start by converting the install-plugins.sh bash script in Jenkins Docker to Java. There are several issues with the install-plugins.sh script - namely, that it is a bash script and has limited extensibility. Furthermore, it does not retrieve all of the most-up-to-date update center metadata.
Mimicking what was done in the install-plugins.sh script from the official Jenkins Docker image, the new plugin management library takes in a list of plugins, their versions, and/or urls from which to download the plugins, and downloads the requested plugins and their dependencies. The plugins are downloaded from the update center to a specified directory, and can then be loaded into Jenkins. Currently, the plugins to be downloaded can be specified via a plugins.txt file and/or the -plugins cli option, but we plan to further expand the input formats that can be accepted. Custom version specifiers for different update centers are also supported.
The library will first check if any of the requested plugins are currently either installed in the user-specified download location or user-specified Jenkins war file. Already installed plugins will be ignored or upgraded if a higher version is requested or required as a dependency. After determining the plugin download URL, the library will download the plugins and resolve and download their dependencies.
This is just the beginning: the plugin manager library and cli tool are very much still a work in progress. For the most up-to-date information on CLI options and how to run the tool, see the repository README.md. More robust input parsing, support for security warnings and available updates, Docker integration, and additional features coming soon!
Feel free to reach out through the Plugin Installation Manager CLI Tool Gitter chat or through the Jenkins Developer Mailing list. I would love to get your questions, comments, and feedback! We have meetings Tuesdays and Thursdays at 6PM UTC.