Zum Inhalt springen

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).

Das könnte Sie auch interessieren

Neofonie Mobile mit klimaneutraler Website

Jeder Klick auf neofonie-mobile.de ist klimaneutral. Neofonie Mobile unterstützt hierfür zertifizierte Klimaprojekte.

Neofonie gründet KI-Agentur ontolux

Neofonie verkündet den Start einer neuen KI-Agentur, die sich den Themen Text Mining, Suche und Natural Language Processing verschrieben hat. Die langjährige Forschungs- und Projektkompetenz wird ab sofort in der eigenständigen Marke ontolux gebündelt.

2 Iphone - mit Bildschirm der "meinbezirk" App, weisser Hintergrund

Neofonie Mobile launcht „meinbezirk espresso“ App

Mit der neuen meinbezirk espresso-App baut der Verlag Regionalmedien Austria sein Portfolio aus und liefert ein modernes und innovatives App-Konzept per swipe für sein regionales News-Angebot.

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.

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“.

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.

Mobile Commerce im Aufschwung

HTML5-Applikation, Web-App, responsive oder mobile Webseite oder doch native App?

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.

Junger Mann tippt auf einem Tablet

Hover-Effekt und die Usability auf Tablets

Karsten Rieger, ehemaliger Professional Frontend Developer bei Neofonie, erklärt an Hand eines Beispiels, warum auf Tablet Optimierungen nicht verzichtet werden sollte.

Zwei Programmierer an ihrem Arbeitsplatz

Was Entwickler in der IT heute mitbringen müssen

Ob abgeschlossenes Studium oder Quereinstieg – die folgenden Skills sollten Entwickler in der IT heute mitbringen.

App-Entwicklung mit Flutter: Neue Chancen in naher Zukunft

Im Interview erklärt Marcel Heinzel, Business Analyst von Neofonie Mobile, die Vor- und Nachteile von Flutter.

Frau testet eine App auf einem iPhone und macht dabei Notizen

Testmethoden im IT-Qualitätsmanagement

Katarina Apelt, Software Testerin bei Neofonie, stellt die wichtigsten Testmethoden kurz vor.

Frau hält Einkaufstüten und schaut auf ihr Smartphone

In 10 Schritten zum Erfolg mit M-Commerce

Steffen Lüdtke von Neofonie Mobile verrät im Blogbeitrag, wie Shop-Besitzer in nur 10 Schritten die perfekte, mobile Einkaufswelt gestalten können und zum Erfolg bringen.

Logo des Internet Agentur Rankings

Agentur-Ranking 2020

Laut aktuellem Internetagentur-Ranking zählt Neofonie auch in diesem Jahr zu den Top 50 Agenturen in Deutschland.

Amazon Alexa-Device neben einem Smartphone

Alexa Skill: Eine Anleitung in 5 Schritten

Marketingexperte Sinan Arslan und Softwareentwickler Ziad El-Jayyousi zeigen auf, warum “Voice” zum zukünftigen Marketing-Mix gehört.

Newsletter

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