DiUS Build-Lights is a device that provides visual feedback of our Continuous Integration (CI) and Continuous Deployment (CD) status. It polls our CI/CD server and displays the various gate or project status on an LED strip. Each section of the LED strip represents a gate or project, and the colour represents the status of that gate or project. It is an effective way of providing  constant visual feedback and it has become an essential part of our agile software development since its inception.

A brief history

The very first version of Build-Lights was hacked together by Julian Kelabora. Special thanks to Julian! He developed it for one of his projects, and the strip of flashing lights suddenly got everyone interested. I was one of them! I replicated the hardware for my own projects, but I re-wrote most of the software on the device. I also did not like bare wires hanging outside the Pi, so I modified the hardware to make it look tidy. It gained more interest over time and every now and then, people would request that I build a few units for them, but I was not happy with the hardware. Even though I made it tidier, it was still hacked together with loose wires, and therefore very fragile, so I started working on replacement hardware as my pet project. The result, DiUS Build-Lights 2.0.

The hardware

The DiUS Build-Lights 2.0 is a HAT that plugs on top of a Raspberry Pi. HAT is short for Hardware Attached on Top and it is a form factor specified by the Raspberry Pi Foundation. HAT modules are plug-and-play and there is no need to enable general-purpose input/output (GPIO)  and peripherals manually. With the Build-Lights HAT, the Serial Peripheral Interface (SPI) interface is enabled automatically, which is used to drive the LED strip. The HAT supports all models of Raspberry Pi’s with the 40-pin header. That includes Pi B+, 2B and Pi3. It takes 6V to 24V input and steps it down to 5V to run the Pi and the LED strip. It has built in transient protection circuit to deal with voltage spikes and ESD (electrostatic discharge) protection circuit to protect the Pi from getting damaged. The HAT is designed to be extensible with ESD protected I2C and GPIO pins available for external use like connecting to a big red ‘launch’ button. The serial port is opto-isolated which provides isolation up to 400V.

The software

The DiUS Build-Lights 2.0 software is written in Python. It is designed to be as flexible as possible to make future extensions clean and easy. The software reads in a configuration file that tells it the type of CI server it is talking to, and the type of LED strip it is driving. Most importantly, the configuration file specifies the projects to display on LEDs, and the order of the projects. Currently Jenkins is the only CI server that is supported, but more will be added in the near future. Similarly, other LED strips support may be added in the future.

The new software consists of five major parts:

  • Poller: defines how to communicate with the CI server.
  • Monitor: interprets the output of the poller to projects’ states.
  • Light strip driver: controls the LED strip based on the projects’ states.
  • Sound driver: plays a sound clip when a project state changes.
  • Light controller: this is the main file that pulls the relevant modules based on the config file.

Some of the software modules may be poorly named, but the software structure works pretty well so far. Keep in mind that the software was hacked up quickly and is completely open source.

The DiUS Build-Lights 2.0 software can be found here: https://github.com/DiUS/build-lights

The old Build-Lights instructions and software can be found here: https://github.com/jasaw/build-lights

If you are passionate about this project, you are more than welcome to contribute to the software. Support for other types of CI servers, or addition of a web interface or unit tests would greatly benefit the project.