1

I am attempting to use cruisecontrol.rb for continuous integration. The code that is being built resides in a Mercurial repository.

What I would like is for CI to run only when a change is pushed to a specific branch. The documentation indicates that this is supported. I have tried:

./cruise add my_project -r repository_location -s hg -b development

I also tried using this approach in the cruise_config.rb for the project:

Project.configure do |project|
  project.source_control = SourceControl::Mercurial.new(:repository => 'repository_location', :branch => 'development')
end

These both appear to result in the project building from tip no matter what branch tip is pointing to.

Ultimately, I can make it work (more based on my knowledge of Mercurial than cruisecontrol.rb), but it seems like one of the two options above should work.

Here is what I did to make it work:

  1. Added the project as in the first example.
  2. Stripped all changsets except the first one from cruisecontrol.rb's copy of the repo.
  3. Pulled only the branch I wanted.
  4. Added the following alias to cruisecontrol.rb's hgrc:

    pull = pull --branch development
    
  5. Modified the following code in cruisecontrol/lib/source_control/mercurial/log_parser.rb:

    def parse(message)
      ...
      entries.each do |entry|
        next unless entry.match(/^changeset:\s+\d+:(.....)/) # Added only this line.
        ...
      end
    end
    

So far, it appears to be working as intended. I'm going to be adding builds for other branches and we'll see.

However, I'm hoping someone can tell me how to do this within the constructs of cruisecontrol.rb, as all documentation seems to indicate that this would be supported.

toadjamb
  • 934
  • 1
  • 9
  • 14

0 Answers0