Nuclear Rooster

27Apr/100

CIJabber: Get CIJoe build notifications and reminders via Jabber

What?

Here's a little script that hooks in to CIJoe to send build alerts and reminders via Jabber (i.e. GTalk).

CIJoe sending status via Jabber

Why?

Continuous integration is great, and it only works if you can keep track of the build status. Email just doesn't seem like the right tool for this. I've recently explored using Jabber instead of email for munin notifications, and I think this is an even bigger win. I want to know the build status, but I don't want the hassle of cleaning my inbox. I don't want to come back from a vacation with a million build emails. This is transitory information, and I only want to know it when I am paying attention.

I'm in, how?

  1. Clone the code

    git clone git://gist.github.com/374030.git /opt/cijabber
    
  2. Put in your Jabber/ GTalk creds and destination jabber account.
    create a gmail account if you need to
    create a party chat room (couldn't be easier)

    ##############################
    JABBER_USERNAME = "example@gmail.com"
    JABBER_PASSWORD = "secret"
    DESTINATION_JABBER_USERNAME = "my_cijabber@partychapp.appspotchat.com"
    ##############################
    
  3. Setup Crontab for reminders

    # m h  dom mon dow   command
    */5 * * * * /opt/cijabber/CIJabber.rb /opt/my_git_repo_for_cijoe > /dev/null
    
  4. Edit the build-worked and build-failed hooks:

    #!/bin/bash
    
    /opt/cijabber/CIJabber.rb /opt/my_git_repo_for_cijoe
    

Keep build stats with Party Chat's additional features

Party Chat still rocks. Not only does it provide a communication hub for you and your team, but it also has some cool bonus features that we can use to keep track of some stats. It's trivial to keep track of number of builds per-project, as well as the number of failures and successes.

Private API Disclaimer

This script digs into CIJoe's private API, so it may not work forever. CIJoe provides the ability to call a script when a build passes or fails. We'll use this functionality, but it isn't quite enough. I like the idea of continually being reminded of a failed build. For this, a crontab can be used to run the script, which uses CIJoe's private API to parse data about the last build.

Code!

Please give updates on the gist, or in the comments below.