This repository contains a collections of Jenkins features that can be installed and maintained in your Jenkins instance. It can be implemented in a container context or not.
A feature is a combination of :
- plugins. If a plugin has other plugins dependency, those plugins will be installed automatically.
- groovy scripts. Those script are executed at jenkins startup to pre-initialize jenkins settings and plugins. They are also called on Demand (like GitHub merge Pull request) to update your Jenkins instance at runtime. You can also call them frequently to ensure Jenkins is always configured the same way! This is done by the groovy plugin. (See Groovy plugin page
- shell scripts. Those scripts can install some Jenkins external tools, like maven, mesos library, etc...
Are you searching for a DevOps way to manage your Jenkins instance???
In short, you can manipulate xml files and install plugins, but those files are active only when you restart Jenkins. By building a collection of Groovy code combined with plugins and shell scripts, it gives you the ability to update Jenkins dynamically without restarting it and breaking your project build factory.
You can read a more detailled discussion about how to manage Jenkins from a Code perspective here
In a DevOps context, be able to have a Build factory controlled by code is key. If you have any other ideas to make this paradigm a reality for you, share it!!! The approach given here is not necessarily the only correct one. So feel free to discuss it through issues.
You need to install a GO binary called jplugins. This tool is static and should work on most of linux system without trouble.
-
Download the
jplugins
with:Code example:
curl -sSL -o jplugins https://github.com/forj-oss/jplugins/releases/download/latest/jplugins chmod +x jplugins
-
Create a text file
jplugins.lst
. Provide the list of feature name (prefixed byfeature:
) or plugin name (prefixed byplugin:
) one per line.Ex:
$ cat jplugins.lst feature:jenkins-pipeline plugin:embeddable-build-status
-
Call jplugins with your file
./jplugins install --from-features
jplugins
can be used in 2 steps, in order to prepare plugins/features update offline.
- Out of Jenkins Server: Prepare the list of plugins/features (
jplugins.lock
) to install. Typically, we commit this lock file in GIT. - In Jenkins Server: Install plugins/features as defined by jplugins.lock
This section describes how to do it:
-
Prepare list of plugins/features out of Jenkins Server
-
Create a text file
jplugins.lst
. Provide the list of feature name (prefixed byfeature:
) or plugin name (prefixed byplugin:
) one per line.Ex:
$ cat jplugins.lst feature:jenkins-pipeline plugin:embeddable-build-status
-
Call jplugins with your file
./jplugins init
-
-
Install plugins/features as defined by
jplugins.lock
./jplugins install
For detailled options, do ./jplugins --help or read documentation from https://github.com/forj-oss/jplugins
Each line prefixed by feature:
or plugin:
will describe an installation task
When prefixed by plugins
, the script will download the plugin from $JENKINS_UC/download/plugins
(JENKINS_UC=https://updates.jenkins-ci.org) to
$JENKINS_HOME/ref/plugins
Plugins dependencies are automatically downloaded.
When prefixed by feature:
, the script with download a feature description file.
This file defines :
- The name of groovy scripts to install under
$JENKINS_HOME/ref/groovy.init.d
. Identified withgroovy:
- Plugins to install. Plugins dependencies are automatically downloaded. Identified with
plugin:
Example:
$ jplugins install --from-features
For detailled options, do ./jplugins --help or read documentation from https://github.com/forj-oss/jplugins
If you have developed some groovy/shell scripts that can interest any other jenkins users, I would suggest you to contribute to this repo.
In anyway, if you believe that you can provide something to this project, have a look in the contribution document to get help and technics to make your contribution a success! Thank you!
R&D DevOps IT - FORJ Team