Back to blog

Learning plugin development by improving the LIFX notifier plugin

Veaceslav Gaidarji
January 10, 2017

This is a cross post by Veaceslav Gaidarji, open source developer and contributor to the Jenkins and Bitrise projects.

Some time ago I encountered a LIFX smart bulbs. These are the bulbs with a chip inside - 50% bulb, 50% chip. There are mobile applications for easy configuration and remote control of the bulb. Nothing special here, it simply works and is very convenient to have such bulbs in dormitory.

Brilliant idea time

99% of ideas which come to our minds either were already implemented by someone else or they are useless.

— Veaceslav Gaidarji

And as it always happens, the developer inside me generated an idea which, as it always happens, was implemented by someone else already.

The idea was: to connect a LIFX bulb to Jenkins server and update the color according to a job’s state.

Before starting to work on such Jenkins plugin, I searched for similar projects on Google and the first links pointed me to existing LIFX notifier plugin and a blog post from Michael Neale who created the plugin. Michael’s post describes exactly what I had in mind.

At this point I had 2 options:

  • forget about building something new and just use the plugin

  • improve existing plugin

First option is always easy and effortless, but second one is more challenging.

Improving an existing plugin

The existing LIFX notifier plugin did its job really well and I was able to connect my bulb to Jenkins and test it. But it wasn’t complete and had no configurable at all, therefore no possibility to change the colors.

First, I read Jenkins contribution guidelines, which encourage developers to improve existing plugins (if any) and not create other versions of plugins with similar functionality. Then I contacted the plugin author, Michael Neale, via email and kindly asked for the contributor access in GitHub for the existing plugin version. After a short discussion about my plans on this plugin, Michael added me as a contributor to GitHub repo and wished me good luck. Thanks Michael!

I wanted to improve the LIFX notifier plugin to add the ability customize the colors (in progress, build success and build failure). This is not a hard task actually. A 1000+ plugins were developed for Jenkins by the hackers like me, which means that I should have no problem to do it as well. Fortunately for me, I have used some plugins already which had a UI similar to that I had planned to add to the LIFX notifier, such as:

  1. HockeyApp plugin

  2. Fabric Beta publisher plugin

  3. Different Build notifiers plugins

Reviewing the code for these plugins, plus Jenkins plugin development documentation, and of course looking over Jelly components helped me to:

  • Better understand the Jenkins architecture.

  • Learn how Jenkins plugins work in general.

  • Learn how to create the UI components for a plugin.

  • Learn how to subscribe to Jenkins job state changes using appropriate extension points.

In a few weeks I’ve finished my plugin modifications and added unit tests for its major parts. As a result, the plugin now has a UI configuration section in Post-build Actions which is self descriptive:

plugin configuration

The last step was to prepare new plugin version and publish it to the world! The Jenkins "Hosting plugins" document describes step by step process of how to publish a plugin.

This includes many steps which should be respected very carefully.

Demo

What I’ve learned

It was my first experience in Jenkins plugins development. I should say that steep learning curve is high enough, and sometimes is really hard to find answers on appearing questions. But in general it’s all about Java, XML, Maven and it’s a lot of fun developing Jenkins plugins.

Check out the LIFX notifier page for more information about the latest releases!


Bonus: bitrise.io users, I’ve developed step LIFX notifier for bitrise as well.

About the author

Veaceslav Gaidarji

Veaceslav is a software developer with the main focus on Android platform. In his free time, he enjoys working on different open-source projects.