Making a Pi Build Server
07 MarUse a Pi with some blinkenlights to run Jenkins and do continuous builds of stuff from git/svn. The lights provide an immediate indicator of the state of the builds and Jenkins.
My initial plan is to run this on a Pi Zero - which is quite weedy in terms of processing grunt and memory. So using a Pi Zero as a build server means those builds could take a long time. But whatever, I can leave it on all the time and I'm in no real hurry. If it proves useful the same setup should also work on a Pi3, which has a lot of grunt compared to a Zero.
A Unicorn pHAT or some array of NeoPixels would make a good indicator panel, since the LEDs are full RGB colour range, so each LED would correspond to a project, with maybe one LED reserved for Jenkins and the box itself.
Given the number of LEDs in use, you'll probably want a lookup chart written up to stick near the Unicorn to link the LEDs to the projects they represent. Alternatively you could just live with a rule along the lines of "all green or yellow = fine, otherwise check the Jenkins messages".
The LED colours would indicate the current state of the projects and their builds. Something like:
- Bright green. Last build, and the previous few builds all succeeded
- Dim green. Last build succeeded, either no previous builds or they failed.
- Yellow. Build in progress
- Bright red. Last build failed to compile or build.
- Dim red. Last build succeeded, but with test failures.
- Blue. Unable to find source or config issues with the build.
For the Jenkins LED the colours could be:
- Green. Idle, all good.
- Yellow. Builds in progress
- Red. Jenkins not running
- Blue. Jenkins either not able to find sources or having a config problem
Jenkins has a plugin system, that uses Java classes with a specific structure that can be triggered as part of the build chain. So it should be fairly easy to control any LED add-on for which there is some kind of Java library available (probably using the GPIO or I2C libraries).
In fact it looks like someone has written exactly that kind of plugin for the PiGlow pHAT - a small board of 18 different coloured LEDs. Here's the github source of the Jenkins-piglow plugin. Given the LEDs are single colour, not RGB, either each of the 3 PiGlow arms would represent 1 project, or you'd go for one arm to represent the Jenkins summary across all projects.
Thinking more ambitiously, a Unicorn pHAT provides 32 RGB LEDs (4 x 8 grid) for £10. That gives scope for either 32 projects, or 31 projects and a Jenkins indicator too.
If that's not enough for you (how many projects are you handling!?!) there's a bigger brother, the Unicorn HAT, with 64 LEDS (8 x 8 grid) which fits nicely over a Pi - and you probably want to upgrade to a Pi3 rather than a Pi Zero if you've got that many projects!
Ok, someone has done a Jenkins plugin for the Unicorn hat too. Here's the github source of the Jenkins-unicorn plugin. Well, that makes things even easier. I should probably get on and do this.