|
1 | 1 | # JenkinsLamp
|
2 |
| -A build lamp for jenkins. |
3 | 2 |
|
4 |
| -# Setup |
| 3 | +A lamp for display the states of the jenkins jobs in the console and also with a real traffic light connected on raspberry pi. |
5 | 4 |
|
6 |
| -## Package from rasbian repository |
| 5 | +## Getting Started |
7 | 6 |
|
8 |
| - apt-get vim git python-dev python-rpi.gpio npm |
| 7 | +These instructions will get you a copy of the project up and running on your local unix based machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system. |
9 | 8 |
|
10 |
| -## Install WiringPi |
| 9 | +### Prerequisites |
11 | 10 |
|
12 |
| -http://raspberrypiguide.de/howtos/raspberry-pi-gpio-how-to/ |
| 11 | +You need node.js in version 8 or higher and a JavaScript package manager like [yarn](https://github.com/yarnpkg/yarn) or [npm](https://www.npmjs.com/). |
13 | 12 |
|
14 |
| -## Install node |
| 13 | +``` |
| 14 | +node -v |
| 15 | +``` |
15 | 16 |
|
16 |
| - wget https://nodejs.org/dist/latest-v6.x/node-v6.10.2-linux-armv6l.tar.gz |
17 |
| - sudo mv node-v6.10.2-linux-armv6l.tar.gz /opt |
18 |
| - cd /opt |
19 |
| - sudo tar -xzf node-v6.10.2-linux-armv6l.tar.gz |
20 |
| - sudo rm node-v6.10.2-linux-armv6l.tar.gz |
21 |
| - sudo mv node-v6.10.2-linux-armv6l nodejs |
22 |
| - sudo ln -s /opt/nodejs/bin/node /usr/bin/node |
23 |
| - sudo ln -s /opt/nodejs/bin/npm /usr/bin/npm |
| 17 | +For the real traffic light, you use a raspberry pi with three lamps. |
24 | 18 |
|
25 |
| -## Setup a service |
| 19 | +### Installing for console only |
26 | 20 |
|
27 |
| -tbd |
| 21 | +Checkout this repository and call the package manager for get the needed JavaScript libraries. |
28 | 22 |
|
29 |
| -# Start and stop |
| 23 | +``` |
| 24 | +yarn install |
| 25 | +or |
| 26 | +npm install |
| 27 | +``` |
30 | 28 |
|
31 |
| - service JenkinsLamp start |
32 |
| - service JenkinsLamp status |
33 |
| - service JenkinsLamp stop |
34 |
| - |
| 29 | + |
| 30 | +### Installing with real traffic light |
| 31 | + |
| 32 | +You will also prepare the raspberry pi for use the GPIO connectors from node.js. Install the following python packages from rasbian repository: |
| 33 | + |
| 34 | +``` |
| 35 | +apt-get python-dev python-rpi.gpio |
| 36 | +``` |
| 37 | + |
| 38 | +For manual testing the GPIO connectors from raspberry pi you can use the [WiringPi Tool](http://wiringpi.com/). |
| 39 | + |
| 40 | +## Configuration |
| 41 | + |
| 42 | +Rename the config.json.sample file to config.json. Change the host, port, user, password in the first section. If you use the JenkinsLamp on a raspberry pi then change the useLibrary to `raspberryPiLamp.js`. |
| 43 | + |
| 44 | +``` |
| 45 | +"jenkins": { |
| 46 | + "host": "host from jenkins", |
| 47 | + "port": host from jenkins, |
| 48 | + "path": "/api/json?tree=jobs[name,color]", |
| 49 | + "pathNova": "/job/s16-backend-nova/api/json?tree=activeConfigurations[name,color,url]", |
| 50 | + "user": "the user", |
| 51 | + "password": "the password", |
| 52 | + "useLibrary": "pcLamp.js", |
| 53 | + "delay": 60000 |
| 54 | +} |
| 55 | +``` |
| 56 | + |
| 57 | +Any lamp sections are a traffic light in the console. |
| 58 | + |
| 59 | +``` |
| 60 | +{ |
| 61 | + "id": "dev. job", |
| 62 | + "name": "develop multibranch job", |
| 63 | + "enabled" : true, |
| 64 | + "job" : { |
| 65 | + "type" : "color", |
| 66 | + "path": "/job/s16/job/s16-multibranch-pipeline/job/develop/api/json?tree=name,color", |
| 67 | + "ignore": [], |
| 68 | + "colorJsonPath": "color" |
| 69 | + } |
| 70 | +``` |
| 71 | + |
| 72 | +## Running the tests |
| 73 | + |
| 74 | +Currently there are no tests available |
| 75 | + |
| 76 | +## Start |
| 77 | + |
| 78 | +Start the JenkinsLamp with: |
| 79 | + |
| 80 | +``` |
| 81 | +node jenkinsLamp |
| 82 | +``` |
| 83 | + |
| 84 | +## Authors |
| 85 | + |
| 86 | +* **Jonas schmid** - *Initial work* - [tuxmatta](https://github.com/tuxmatta) |
| 87 | + |
| 88 | +See also the list of [contributors](https://github.com/your/project/contributors) who participated in this project. |
| 89 | + |
| 90 | +## License |
| 91 | + |
| 92 | +This project is licensed under the MIT License - see the [LICENSE.md](LICENSE.md) file for details |
0 commit comments