A plugin that triggers your Spark.io device when Jenkins build fails.
This plugin adds a post-build action which allows to execute a function on your Spark device. The call is invoked via a REST call to Spark Cloud API so all you need is a Spark core connected to the cloud and a head full of IoT ideas for your build failed notificator ;)
Go to Manage Jenkins -> Configure system and setup following Spark notifier propoerties:
- Spark access token - your Spark API access token
- Device id - your Spark core id
- Function - name of a function called by the plugin via Spark API (see sample code below)
int pin = D0;
int trigger(String command);
void setup() {
pinMode(pin, OUTPUT);
Spark.function("trigger", trigger); // this must match the "Function" property in plugin configuration
}
void loop() {
}
int trigger(String command) {
digitalWrite(pin, HIGH);
delay(400);
digitalWrite(pin, LOW);
return 1;
}
We use async HTTP POST call to execute a function on Spark, so making a 400ms delay won't result in a lag on your Jenkins installation.
This video shows a Spark Core connected to Arduino with Adafruit's Wave Shield, which plays a "siren" sound when a build fails. Enjoy!
This project is licenced under Apache License Version 2.0