Jenkins on Raspberry Pi

Jenkins on Raspberry Pi

On Neofonie Mobile GmbH team event, the Fedex Day, we came upon the idea of visualising the build status of our projects on our Continuous Integration system. While investigating existing notification solutions, we found none that suited our needs; they were either not eye-catching (like email notifications, which we already used), or they were too expensive to deploy to the whole team. Thus, during our Fedex Day (alright, we had prototyped hardware in advance), we created devices that would inform us visually about the current project build status and build progress with the aim for the devices to be affordable, easy to create, and wireless capable.

Since Jenkins CI checks project compilation and performs tests on every source change already but only presents the results on the web-based dashboard or through emails, we wanted to improve the way to observe build status. We wanted it to be more direct and effortless (and a little bit decorative too – there is nothing like a green glow in the office at the end of the day), so we ended up with dedicated hardware for observing build status hanging on a wall in the developers’ rooms.

Architecture

The project idea is really simple. The central element of the system is a Raspberry Pi computer that periodically asks Jenkins CI about the status of projects. Each endpoint, an indicator device, has a unique ID assigned. The Raspberry Pi maps the project’s name to the proper device ID, and then it broadcasts the build status wirelessly.

Diagram created with Jenkins logoRaspberry Pi logo and own photography of hardware; courtesy of Michal Dabrowski

Upon receiving the message address to a particular indicator, the latter updates the LED ring animation. Depending on the received build state it goes from subtle green fading for successful builds, up to alarming red blinking for broken builds.

Hardware

In order to achieve reasonable pricing with a highly scalable tool, we decided to use Raspberry Pi, as mentioned above, to serve as a hub and the Arduino Nano board as the controller for Neopixel matrix. For wireless communication, we used a NRF24L01+ module, since it can be easily incorporated in both the hub and the endpoints.

Project Hardware Listing

  • Raspberry Pi Model B+ (running Raspbian) with SD card (any Raspberry Pi model could be used, however mind the GPIO connections).
Courtesy of Tomasz Grynfelder
  • Arduino Nano v3.3 (any kind of arduino device should be fine, please just keep in mind, that nRF24L01+ has to be powered with 3.3V).
Courtesy of Tomasz Grynfelder
  • nRF24L01+ modules (we recommend using the external antenna model on the Raspberry Pi and PCB antenna ones on indicators; in case of connectivity issues please add bypass capacitors between power and ground pins).
Courtesy of Tomasz Grynfelder
  • Neopixel LED ring or strip  (we’ve used 8 LED pixels strip and 16 LED pixels ring; please mind current draw limits of Arduino when using larger number of pixels).
Courtesy of Tomasz Grynfelder
  • Universal board or printed PCB (please find included eagle schematic).
  • Female to female wires.

Hardware Assembly

Wiring Raspberry Pi

Connect nRF24L01+ module in the following way (we used nRF24L01+ with the PCB antenna, in external antenna model pinout is the same).

Diagram created with http://fritzing.org/home/

Please mind that we refer to the GPIO numbers or special function name, not pin numbers.

Connection scheme:

PI header → nRF24 header

3v3 → VCC

GND → GND

SPI_MISO → MISO

SPI_MOSI → MOSI

SPI_CLK → SCK

SPI_CE0_N → CSN

GPIO_25 → CE

NOT USED IRQ

Wiring Jenkins Indicator

Diagram created with http://fritzing.org/home/

Connection scheme:

Arduino → Neopixel

5v → VCC

GND → GND

D3 → DATA_IN

We strongly suggest the use ICSP pins as side pins are often causing issues with nRF24.

Arduino → nRF24L01+

3.3V → VCC

GND → GND

CNS → D8

CE → D7

MISO → ICSP MISO (D12)

MOSI → ICSP MOSI (D11)

SCK → ICSP SCK (D13)

NOT USED IRQ

Software

Setting up Raspberry Pi

You can launch our configuration script jenkins-indicator-setup.sh (with superuser proviledges) or perform the following steps manually:

  1. Checkout the git project repository from Bitbucket https://bitbucket.org/neofoniemobile/jenkins-indicator-rpi.git master
  2. Install the following packages on Raspbian:
    1. git
    2. libboost1.50-all
    3. python-jenkinsapi
    4. python-setuptools
    5. python-enum34
    6. gcc-avr
    7. binutils-avr avr-libc
    8. gdb-avr avrdude espeak
  3. For Raspberry Pi 1 or 0, extend swap size twice
  4. Download, compile, and install the RF24 library (can be found here: https://github.com/TMRh20/RF24)

At this point you should be able to get nrf24 on Raspberry up and running. You can test it by invoking sudo ./test_hardware.py 1 2 3

That script will try sending test notifications to the devices with ids 1 2 and 3. We will see how to assign ids to the devices later. You should see the following output:

The script then tries to send emulated build status messages to the indicators with the provided IDs. These are the numbers that we used for testing but you can modify the script to use an arbitrary device, but let’s leave it until we are done with the arduino indicator part though.

Setting up Arduino

To configure the Arduino board, please perform the following steps manually:

  1. Checkout the git project repository from Bitbucket https://bitbucket.org/neofoniemobile/jenkins-indicator-arduino.git master
  2. Install platform.io CLI (see: http://platformio.org/get-started/cli)
  3. Connect the arduino nano into usb port and execute platformio run in project’s directory. You should see the following output (compilation and flashing arduino):

Setting up Arduino Indicator Eeprom

To properly run the endpoint device so that it can listen to the hub’s broadcasted messages, you have to configure the Arduino Indicator. We decided to store the configuration in two predefined addresses of the Arduino’s EEPROM memory.

Address 0x00 holds the identifier for the device, while address 0x01 holds the number of pixels that device has.

In order to make the device configuration easier, we created scripts that will generate and flash the EEPROM of your indicator directly from your Raspberry Pi.

Please connect the device to the USB port and run configure_indicator.py script, where you will be asked two questions:

  • what is the device ID (every indicator in your location should have a unique ID),
  • how many Neopixel LEDs the device has.

You should see the following output:

Testing Indicator and Raspberry Pi

Please connect your Indicator to a 5V power source (ie a phone charger or a USB port). Then run sudo ./test_hardware script as mentioned before (you should change the indicator number if you specified a different value when programming EEPROM).

After that, the indicator should start receiving messages and update the Neopixel LED matrix accordingly.

Setting up Raspberry Pi Service

After successful tests, you can proceed with the configuring service on Raspberry Pi. In the sample_service directory you can find template files that should be placed in /etc/indicator and /etc/init.d .

Please proceed with the following steps:

  1. Set your Jenkins credentials in server_config.json file (password corresponds to the Jenkins API access token which can be generated under: http://[your.jenkins.server]/me/configure)
  1. Move the server_config.json file to the /etc/indicator
  2. Make the server_config.json file readable only by a superuser (since it contains Jenkins access credentials!)
  3. Set your project name – device ID mapping in the indicator_config.json file
  1. Copy the indicator_config.json file to the /etc/indicator directory (depending on your preferences, you may also restrict access to this file)
  2. Set DIR in indicator.service file to your location of the repository
  3. Copy the indicator.service file to /etc/init.d directory
  4. Give superuser root Read Write and Execute permissions to the indicator.service file

After the given steps, you should be able to start and stop the service and see its status using the following commands:

  • sudo service indicator start
  • sudo service indicator stop
  • sudo service indicator status

If you would like to make the service start at bootup you can use update-rc.d script to do that:

sudo update-rc.d indicator defaults

That’s it! Now you should have your Jenkins Indicators up and running.

IOT Ideas

As the Jenkins Indicator project gave our team a perfect visualisation of our day-to-day work and a lot of fun too, we’re going to explore new areas and share our knowledge on much higher level of complexity and top notch technologies like Bluetooth Low Energy or low level programming.

Smart things that surround people, starting from home up to their workplace, are getting much more common year by year. We are now trying to stay ahead of these changes and give everybody a helping hand to get their own hardware and join the IoT.

We’re looking forward to show you more in the near future!

Published on 23 February 2017, updated on 08 October 2020

Share on
Tomasz Grynfelder and Michal Dabrowski

Tomasz Grynfelder and Michal Dabrowski

Tomasz Grynfelder – Senior Software Engineer at Neofonie Mobile GmbH, mobile technologies freak highly focused on iOS development and security. Serial conferences, meetups and hackathons participant (as both speaker and audience). After hours, great fan of cycling and sailing. Michal Dabrowski – works as Software Engineer at Neofonie Mobile. He specializes in Android application- and system development. Privately big fan of Raspberry Pi, Arduino and all platforms that enable creating hacky devices (especially the ones one can use via a mobile device later on).

SAP Silver Partner Logo

Neofonie setzt auf SAP Commerce Cloud

Als Spezialist für E-Commerce Lösung hat Neofonie die Partnerschaft mit SAP ausgeweitet und ist nun auch Implementierungspartner für die SAP Commerce Plattform.

Illustration von CRM-Systemen

Neofonie hilft mit CRM-Beratung zur 360° Kundensicht

Neofonie unterstĂĽtzt Sie beim Aufbau eines erfolgreichen Customer Relation Managements.

SEO in bunten Buchstaben

Webinar: Relaunch und SEO – So machen Sie es richtig

Am 25.08. zeigt SEO-Experte Anton Littau, wie die richtige Strategie zum richtigen Zeitpunkt hilft.

SAP Silver Partner Logo

Neofonie ist SAP Silver Partner mit TXTWerk

Als SAP Silver Partner stellt Neofonie das Text Mining Framework TXTWerk im SAP App Center ab sofort bereit.

Ibexa-Logo

Neofonie und Ibexa sind Partner

Neofonie und Ibexa vereinbaren Partnerschaft, um Content und Commerce stärker miteinander zu verbinden.

Grant McGillivray

Neofonie startet eigenständige UX-Agentur

Das Geheimnis ist nun endgĂĽltig gelĂĽftet: ION ONE nennt sich die neue UX-Agentur von Neofonie!

digital-ratgeber.de auf einen Macbook

Wort und Bild Verlag stellt Digital Ratgeber vor

Mit Neofonie als Partner bringt der Wort & Bild Verlag mit dem „Digital Ratgeber“ eine neue Informationsplattform für Apotheken und deren Kunden auf den Markt.

Stadtwerke Oranienburg News

Storytelling-Beratung fĂĽr Stadtwerke Oranienburg

Neofonie unterstĂĽtzt die Stadtwerke Oranienburg in einem kreativen Kommunikationsworkshop, um ihr Online-Ableseportal mit einem Kino-Werbespot zu promoten.

Frau mit Kind im Arm, tröstet das Kind

Spende fĂĽr ein Berliner Kinderhospiz

Mitarbeiter der Neofonie und Neofonie Mobile spenden 1.500 EUR für das Berliner Kinderhospiz „Berliner Herz“.

Niedlicher Roboter

Chatbot erstellen in 5 Schritten

Wie ein Chatbot in wenigen Schritten entwickelt werden kann, stellen Bertram Sändig und Cornelia Werk vor.

Schwarzes Mikrofon

Neofonie Blogcast jetzt auf Google Podcast anhören

Mit der Einführung von Google Podcast in Deutschland, ist jetzt auch der Neofonie Blogcast auf allen Google-Geräten verfügbar.

Wann Big Data im Forderungsmanagement sinnvoll ist

Ob Analyseverfahren fĂĽr ein Unternehmen sinnvolle Ergebnisse bringen, kann nicht pauschal beantwortet werden.

Rot-beleuchtete Treppen

Flexibilität als Erfolgsfaktor bei der Shopsystem Auswahl

Welche Punkte Sie bei einer neuen Shoplösung beachten sollten, stellt Michael Vax, VP Product bei Spryker vor.

Jovo Logo

Neofonie Mobile baut Alexa Skills and Google Actions mit Jovo

Neofonie Mobile ist neuer Partner des Entwicklungs-Framework Jovo und erstellt damit Sprachanwendungen fĂĽr Google und Alexa.

Illustration von digitalen Versicherungen

Versicherungen im Vergleich: Apps sind Pflicht

Die aktuelle Marktanalyse des App-Spezialisten Neofonie Mobile belegt Nachholbedarf in der digitalen Transformation unter Versicherern und Krankenkassen.

Text Mining Consulting KI E-Commerce

Wie Onlineshops von KĂĽnstlicher Intelligenz profitieren

Welche Punkte Sie bei einer neuen Shoplösung beachten sollten, stellt Michael Vax, VP Product bei Spryker, vor.

Was eine moderne Suchlösung leisten muss

Eine Suche auf Websites hilft Nutzern, schneller Informationen zu finden. Suchlösungen haben dabei nicht mehr länger nur den Anspruch einzelne Begriffe zu finden, sondern relevante Inhalte gezielt auf die Bedürfnisse des Nutzers auszuspielen.

Individual-Commerce: Wie Produktkonfiguratoren Onlineshopper glĂĽcklich machen

Auch Onlineshops können den Kunden mittels smarter Produktkonfiguratoren individuell abholen und ihnen ihr ganz persönliches Shoppingerlebnis ermöglichen.

Jägermeister Produktkonfigurator

Wie Jägermeister mit neuem Onlineshop mehr Umsatz macht

Das Erfolgsrezept stellt Wiljo Krechting, Manager Public Relations von Shopware, genauer vor.

Mit B2B-Storytelling und UX zu mehr Erfolg

B2B Unternehmen mĂĽssen vom B2C-Nutzererlebnis lernen, um ihre Businesskunden nachhaltig zu begeistern. Dabei stehen User Experience (UX) und Storytelling im Mittelpunkt.

Unser Newsletter „Neo Report“ vermittelt konkretes Praxiswissen, Trends und Know-how für Ihr digitales Business – quartalsweise und kompakt. Jetzt anmelden.