In the previous tutorial part, we have covered examples of how to automate Jenkins CI setup and configuration. This tutorial part is about Jenkins plugins and plugin management.
What is Jenkins plugin?
One of the main strengths of Jenkins continuous integration server is its extensibility via plugins.
Jenkins defines the set of interfaces which can be implemented and extended by custom code created by community of developers.
Which means that developer community can create core functionality extensions to suit their own needs.
And they do – Jenkins currently has more than 1000 plugins available in its plugin repository.
Jenkins plugin is a standard Java Archive format package which follow the specific structure and has
Each Jenkins plugin is self contained – it packages all the resources like images, files and compiled code needed for plugin to work.
How Jenkins manages plugins?
Jenkins loads plugins from the
JENKINS_HOME/plugins directory during the master node startup.
You have few options to manage Jenkins plugins.
User interface provides the plugin management screen at
Manage Jenkins -> Manage Plugins
If you are using Jenkins cli tool, it provides the methods to install / uninstall plugins.
Or you can manually copy the
.hpi plugin packages to the plugins directory.
Jenkins official Docker image comes with very useful script to install all plugins which are passed as a parameters.
Automating the plugin management
The last option is the most interesting one if you are aiming to version control your infrastructure and setup as a code.
You can maintain the list of plugins to be installed in the simple file.
In the previous part of tutorial we created the code which took the list of plugins from file and installed them one by one during the Docker build.
# install jenkins plugins COPY ./jenkins-plugins /usr/share/jenkins/plugins RUN while read i ; \ do /usr/local/bin/install-plugins.sh $i ; \ done < /usr/share/jenkins/plugins
You can find the full setup and automation scripts in tutorial source code on Github.
You have to restart Jenkins master after adding new plugins to
In this part of tutorial we have explored what are the the Jenkins plugins and how to manage them.
Its was an important topic, as in several other parts of the tutorial we are going to leverage Jenkins plugins built by community of developers.
These plugins will save us lots of time and effort while completing our practical examples.
We will manage plugins in the separate text file – so you can always reference which plugins are required.