CI failure light

Alex Schokking Oct 24, 2017 9:01:20 AM

 

Background

We use Jenkins at BrandVerity as our Continuous Integration server. When someone pushed a change that would fail the automated tests Jenkins would send an email to the dev team about it. In practice it was easy for people not to notice these emails and the tests could remain broken for a big part of the day (which blocked the deployment of code to production). So I wanted to create a mechanism for the team to be able to quickly see if the tests were passing or not.

I've long been a fan of these individually addressable LED strips from adafruit and thought maybe we could use them for an indicator light in the dev area that everyone could see. The rub would be how to control these based on the results of the Jenkins build.

Solution

 

Jenkins light diagram

 

We setup Jenkins to send the test results to a slack channel (which was just convenient/useful in general). I then created a simple chat bot that would monitor this channel and keep track of which (if any) of the tests were currently failing.
 

We used a handy little wifi-enabled board from particle.io called the photon to wire into the LEDs. One of my favorite features of particle is that they provide you with a free api you can use to easily send messages to your photon without having to set up any infrastructure yourself. So now all we needed to do was have the chat bot make an HTTP request to our api.particle.io endpoint with the desired state of the lights (green vs red) and bobs your uncle!

All green

Here's the final result with the LEDs plugged into the Photon board at the bottom. It just needs USB power so it's really easy to move the strip around.

 
IMG_20171020_153434

We've been using the lights for a while now and I've been really happy with how quickly the team is able to notice failures and get them resolved to get us back to green! Since then we also added a little 'dance' of color when the code eventually gets deployed to production as a fun little celebration. 

Source code

Slack bot and photon code  

Topics: Hackdays

We're Hiring!