Continuous Integration Too Simple to Ignore
Posted on April 15th, 2008 in rails | No Comments »
I’ve always been a big fan of continuous integration. There is something empowering about having a tireless little robot patiently waiting for you to check your code in. When it sees your latest commit, it quickly downloads it and then runs all your tests. When that’s over, it prints a nice web summary of what it did. It can even update your main team portal pages with updated content (javadocs, rdocs, test coverage, daily metrics, whatever). It is like having a groupie fanbot who loves your code.
Until you check in something that breaks (fails a test or worse yet, doesn’t compile). Then your little groupie is more like a stalker. Not only does it display a nasty web page (in shades of red) about the build YOU broke but it probably sent out a raft of emails about it. Pretty embarrassing.
This is actually a love hate thing. Every successful project I’ve worked (within the last 8 years) on has used continuous integration in one form or another. The pseuso standard in the industry has been Cruise Control. It is a pretty simple java based process and it can handle very complex setups. The big downside is it is a real big pain to setup.
Enter cruisecontrol rb.
What is cruise rb
This is essentially a cruise control written by the Thought Works guys in Ruby/Rails. The neato thing is this variant of cruise is a breeze to setup. Literally took 5 minutes. On our Redhat server it went something like this:
- wget http://rubyforge.org/frs/download.php/27495/cruisecontrolrb-1.2.1.tgz
- tar zxvf cruisecontrolrb-1.2.1.tgz
- cd cruisecontrolrb-1.2.1
- ./cruise add guide –url svn://some/repo/we/had/trunk
- ./cruise start &
- Add a redirector in apache to redirect */cruise/* to localhost:3333 (which is where cruise starts)
- sudo /usr/sbin/httpd -k restart
That’s it. (almost… read about some of the slight config tweaks I needed to make below)
Too easy.
Notes / Next Steps
Note, this version of cruise is limited to svn only (other SCM’s are in the works, and there is a patch for at least git out there somewhere). This cruise can support java (or other) projects as well as long as you tell it how to build.
Some Minor Hacks – cruise rb is RoR after all…
I actually needed to do a simple set of changes to make cruise’s dashboard (it’s webapp) happy behind the apache redirector (the redirector is needed because 03 doesn’t have port 3333 open to the outside world).
- add ActionController::AbstractRequest.relative_url_root = “/cruise” to the config/environment.rb file
- modify the public/stylesheets/*.css files so url(/images/…) were replaced with url(/cruise/images/…) throughout.
Continous integration is like zentest for the entire team but can also do some really useful things like building team / project documentation.