How to write a Jenkins Plugin – Introduction


I love Jenkins. Use it all the time. Depend on it, rely on it. Wherever I work, I always make considerable and sustained efforts to improve the way that Jenkins is used. Extending from commit builds to complete delivery pipelines, improving the organisation and structure, enhancing the reporting and performance, integrating with tools like Sonar. Sometimes I even find myself having to introduce and encourage the use of Jenkins, and it always amazes me when I find a team that don’t use CI. Almost always, there is a lot if work to do to get the team to follow the “broken windows” principle and work hard to keep everything green (or blue if you prefer!) across the board, to treat failed jobs as a priority requiring immediate action.There are lots of great plugins I use to help keep things clean, and I wanted to make one for a feature I needed. In a large distributed team with almost 200 different jobs, there were many occasional or persistent failures that largely went unnoticed. One small way to draw attention to the problematic jobs was to colour the view tabs red where there were failures, and to modify the view tab label to show the number of failures.

I first implemented this using a GreaseMonkey script, which worked brilliantly but gave me no way to force the same effects for all other users. I needed a plugin for that.

I’ve made one (, and it works, but it was a bit tricky. The documentation for this sort of thing is a little disjointed and incomplete. There are some key concepts that were quite confusing at first.

Gradually I got to grips with it and by the time I finished I knew it really shouldn’t be that hard. So I decided to write a quick guide to creating Jenkins Plugins.

What You’ll Learn

This series of articles will walk you through:

  • Setting up a plugin development environment
  • Adding global configuration options
  • Modifying Jenkins UI components using custom Jelly tag libraries
  • Hosting your plugin in the Jenkins GitHub
  • Publishing your plugin
  • Documenting your plugin in the Jenkins plugins Wiki


This is an introductory guide that covers the important basics that will get you and your plugin up and running.  It will be really simple, in fact quite trivial, because I couldn’t find a really clear and simple tutorial that didn’t go off into irrelevant detail.

This guide is a quick and simple tutorial that will help you get your project started and not distract you with functional issues of someone else’s plugin that you will never care about. We talk about getting started, basic configuration, deploying and running, cover some key examples of working with the Jenkins UI and the Jenkins model, and an overview of publishing your plugin, leaving you to concentrate on the functional aspects of your own plugin and figuring out what part of Jenkins you need to extend.

This tutorial will recreate the Custom View Tabs plugin I made, which allows you to change the colour and add custom label text for the view tabs, according to the statuses of the jobs contained within a view.

See for more details on functionality, but really the functionality is unimportant. This series is more about the mechanics of getting a plugin working.

Posted in Jenkins, Jenkins Plugins

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: