Cruise Status

CruiseStatus allows your Ruby scripts to check the status of your project’s build. Use this to abort check-ins when the build has failed, for example.

CruiseStatus currently supports checking builds run on cruisecontrol.rb or on runcoderun.com.

CruiseControl.rb Example:

To check a cruise.rb build, pass the url to the project RSS feed to CruiseStatus:

require "cruisestatus"

if CruiseStatus.new( 'http://my.cruise.com/projects.rss' ).pass?
  puts "Build passed!"
else
  abort "Build failed…Boo!"
end

RunCodeRun.com Example:

To check a build on runcoderun.com, simply pass the url for the json API:

require "cruisestatus"

if CruiseStatus.new( 'http://runcoderun.com/api/v1/json/tobytripp' ).pass?
  puts "Build passed!"
else
  abort "Build failed…boo!"
end

Command-line Usage:

The gem’s binary is cruisestatus. Pass a URL to it and cruisestatus will check the build status at that URL and return a non-zero status if any of the builds reported there have failed.

Pass a ‘-p` option to prompt the user when a build has failed. If the user enters ’y’ at the prompt, cruisestatus will return a zero status regardless of build failures.

For example:

$ cruisestatus -p http://runcoderun.com/api/v1/json/tobytripp

Build FAILURES: cruisestatus
Are you sure you want to check in? (y/n): y

$ echo $?
0

$ cruisestatus -p http://runcoderun.com/api/v1/json/tobytripp

Build FAILURES: cruisestatus
Are you sure you want to check in? (y/n): n

$ echo $?
1

You can use this to abort check-ins onto broken builds. (See the post-commit hook in github.com/tobytripp/git-pre-commit/blob/master/git-hooks/post-commit for example). As you know, if the CI build is broken, no one should be checking in new code unless they’re fixing the build. You can use cruisestatus to help keep developers honest in that regard.

Note on Patches/Pull Requests

  • Fork the project.

  • Make your feature addition or bug fix.

  • Add tests for it. This is important so I don’t break it in a future version unintentionally.

  • Commit, do not mess with rakefile, version, or history. (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)

  • Send me a pull request.

Build Status

runcoderun.com/tobytripp/cruisestatus

TODO

  • Cruise.java support?

Copyright © 2010 Toby Tripp. See LICENSE for details.