views:

333

answers:

3

Hi,

when CruiseControl.rb wants to perform an integration test it looks for a rake task called "cruise" within the project and executes it.

Is there a way to hand over the current revision number to that task? I'm deploying an app using capistrano on a remote machine after integration tests. Because capistrano will deploy the HEAD revision if no special revision is passed, I'd like to tell it to use cc.rb's last checked revision...

any ideas?

+1  A: 

Hi krautsalat,

rake cruise runs in a directory containing a checkout. If your source control is git, extracting the revision is trivial.

IO.popen('git log -1|grep -i \'^commit\ \'').read.split[1]

cruise is running in a checkout that matches the revision you asked to be built, not HEAD, so the revision reported buy git log should be accurate.

Good luck!

mixonic
A: 

The answer that mixonic posted should be fine, but if you use Subversion you should execute the svnversion command to get the revision number instead.

Adam Byrtek
+2  A: 

If you need CC.rb revision you can do it this way:

desc 'Cruise'
task :curise do
  puts "Building revision #{ENV['CC_BUILD_REVISION']} from #{File.dirname(__FILE__)}"
end
knoopx