Technology

Jenkins Spark integration

You can make Jenkins publish messages to spark after or during builds.  Here's how we do this: 1. Get the spark room ID that you want to use:
curl https://api.ciscospark.com/v1/rooms -X GET -H "Authorization:Bearer SUPERLONGAUGZjg5ZjRhZDAtMDA1NC00OMzRmMjg5NTJiMTUwOTZkZDgtYTY0" | python -m json.tool
This will give you a list of rooms.  From here, you can find the room you want and get the ID of the room: Something like: Y2lzY29zcGFtxuovL3VzL1JPT00vOWRhMjY1MDAtOWY2Zi0xMWU1LTg0ODQtNzczOTMxZTUxMGE3 2.  In jenkins we can now notify the room of a build before the build or after the build by using the execute command plugin.  Putting a simple curl command like the below will create the command necessary to notify the spark room:
curl https://api.ciscospark.com/v1/messages \
-X POST -H "Authorization:Bearer \
 Zjg5ZjRhZDAtMDA1NC00ODM0LTkyNTAtNm..." \
 --data "roomId=Y2lzY29zcGFyazovL3VzL1JPT..." \
 --data "text=$JOB_NAME%20build%20$BUILD_ID%20completed"
Just substitute in the roomId and Authorization token.  You can also create a person using a different email account to make a 'jenkins user'.