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 functionality with custom code.

This means that external developer community can extend core Jenkins CI functionality by building their own custom extensions. There are more than 1000 such Jenkins 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 file 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 includes a useful CLI utility, which automates Jenkins plugin install. It supports installation from the file with the list of plugin names.

Automating the plugin management

Jenkins plugin manager cli fits well with infrastructure as code approach. We can maintain a file with list of plugins to be installed in our code repository.

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 jenkins-plugin-cli -f /usr/share/jenkins/plugins.txt

See the full source code we used in that tutorial.

Summary

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

Chances are you will be tapping into large Jenkins public plugin catalogue or even create one for your own specific scenarios - therefore its important to understand how Jenkins plugins work under the hood.

Similar posts