Learn about our RFC process, Open RFC meetings & more.Join in the discussion! »

rpi-jenkins-light

1.1.0 • Public • Published

Raspberry Pi Jenkins Light

Test Status

Demo

Note: this package was tested on Raspberry Pi 2.

Installation

  • SSH to Raspberry Pi
  • $ sudo su (need install Node and GPIO module)
  • Install NodeJs 5.x
    • Add repository $ curl -sL https://deb.nodesource.com/setup_5.x | sudo -E bash -
    • Run $ apt-get install nodejs
  • From GitHub sources:
    • Clone repository $ git clone https://github.com/antonfisher/rpi-jenkins-light.git
    • $ cd rpi-jenkins-light
    • Install dependencies $ npm install
  • From NPM:
    • $ npm install rpi-jenkins-light.

Configure

Edit $ vim configs/config.js file:

module.exports = {
    rpi: {                          // Raspberry Pi sub-config
        gpio: {                     // GPIO [General Purpose Input Output] config
            color: {
                red: 15,            // pin # for red color
                yellow: 11,         // pin # for yellow color
                green: 7            // pin # for green color
            },
            outputLevel: {
                on: true,  // 3v3   // led turn on output level
                off: false // 0v    // led turn off output level
            }
        }
    },
    jenkins: {                      // Jenkins sub-config
        interval: 5 * 1000,         // requests interval
        host: '10.0.0.1',
        port: '8080',
        view: 'JenkinsLight',       // http://localhost:8080:/view/%VIEW_NAME%/
        demoMode: true              // ignore jenkins config, turn on red-yellow-green lights
    }
};

Demo mode

To run light in demo mode set property: demoMode: true in jenkins section in configs/config.js.

Connect LEDs to Raspberry Pi

Example config works with this configuration: LEDs connections

Pins map

Pins

More about Pi's pins...

Final version

Under hood 1

Under hood 2

Configure Jenkins

  • Open Jenkins main page
  • Create new list view called JenkinsLight
  • Add monitored tasks to this view.

Jenkins View

Run

  • $ sudo su (need for GPIO module)
  • From GitHub sources:
    • $ node run.js
  • From NPM:
    • $ node ./node_modules/rpi-jenkins-light/run.js.

Autorun

  • $ sudo su (need for global modules)
  • $ npm install pm2 -g
  • $ pm2 startup
  • $ pm2 start run.js
  • $ pm2 save.

Tests

  • Use NodeJs v5.x
  • $ npm install --dev
  • $ npm test.

Release History

  • 1.1.0 Tests and improvements
    • configuration examples
    • test with jenkins mock
  • 1.0.0 Initial release.

ToDo

  • npm global module
  • add link to article

License

Copyright (c) 2015 Anton Fisher a.fschr@gmail.com

MIT License. Free use and change.

Install

npm i rpi-jenkins-light

DownloadsWeekly Downloads

1

Version

1.1.0

License

MIT

Last publish

Collaborators

  • avatar