Coder Social home page Coder Social logo

xing-meets-robots's Introduction

xing-meets-robots

We've wired our Jenkins builds to call endpoints on a sinatra app to report the builds outcomes. The sinatra server is running on a Raspberry Pi, the RPi then commands an Arduino over USB to blink, fire office alarms and play Star Trek epic sounds (well, not that all) when a build is red!

This was our Innovation Week 09.2014 at XING's contest.

Installation

ssh to the RPi and run:

$ artoo arduino install
$ artoo install socat

Get the address of the arduino:

$ dmesg # on a raspbian install

[   12.566256] usb 1-1.2: new full-speed USB device number 4 using dwc_otg
[   12.701183] usb 1-1.2: New USB device found, idVendor=2341, idProduct=0043
[   12.709892] usb 1-1.2: New USB device strings: Mfr=1, Product=2, SerialNumber=220
[   12.720395] usb 1-1.2: Manufacturer: Arduino (www.arduino.cc)
[   12.727731] usb 1-1.2: SerialNumber: 5533033393035161B1D1
[   13.643661] cdc_acm 1-1.2:1.0: ttyACM0: USB ACM device

ADDRESS_OF_ARDUINO in the example is ttyACM0

Run the "server"

ssh to the RPi and run:

$ artoo arduino connect ADDRESS_OF_ARDUINO 8023 > artoo.log 2>&1 &
$ ruby lib/robots.rb > robots.log 2>&1 &
$ ruby lib/server.rb > server.log 2>&1 &
# example address is `/dev/cu.usbmodem1411`, but you might need to drop `/dev/` part

Setup jenkins

Jenkins should call the sinatra endpoint after every build reporting the build outcome.

Our simplistic approach so far is to add 2 Post-build tasks that find the status from the build log, one finds FAILURE in the log the other finds SUCCESS, then call curl http://RASPBERRRY-IP:4567/builds/jobs?status=success for the success case, and curl http://RASPBERRRY-IP:4567/builds/jobs?status=failure for the fail case.

TODO

  • redirect outputs to logs in the commands above or better use foreman
  • fix the network flickering problem
  • add an index to sinatra to list the builds

Team

  • Ricard Sole
  • Krzysztof Herod
  • Joaquin Rivera Padron @joahking

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.