Jenkins CI plugins and plugin management

Jenkins CI plugin management and automation

In the previous Jenkins CI tutorial part, we have covered examples of how to automate continuous integration server setup and configuration. This tutorial part provides more detailed information about how Jenkins CI manages plugins.

What is Jenkins CI 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 to extend core funcionality with custom code.

This means that external developer community can extend core Jenkins CI functionality by building extensions. There are more than 1000 such custom plugins available in the official Jenkins CI plugin repository.

Jenkins plugin is a standard Java Archive format package which follows the specific structure and has .hpi extension.

Each 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 CI 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 section.

If you are using Jenkins cli tool, it provides the methods to install / uninstall plugins.

Another option is to manually copy the .hpi plugin packages to the JENKINS_HOME/plugins directory on the server. Where they will be loaded on master node restart.

Jenkins official Docker image comes with very useful script to install all plugins which are passed as a parameters.

Automating the plugin management

The latest option is very useful for automation and for maintaining infrastructure and a code approach. You can maintain a list of plugins to be installed in the simple, version controlled file.

In the previous part of tutorial we created the code within Dockerfile which took the list of plugins as input and installed them one by one.

# 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

See the full source code we used in that tutorial.

Summary

This post covers the plugin concept and plugin management in Jeniks CI world.

Its was an important topic to understand if you are using Jenkins CI server. Chances are you will be tapping into large Jenkins public plugin catalogue or even create one for your own specific scenarios.

Similar posts