#278 new
Jarl Friis

cruise fails when projects have AR observer and there is no development database.

Reported by Jarl Friis | March 8th, 2010 @ 08:04 AM

Hi.

I just introduced an AR observer into my project. That made my CI builds fail.

The error in the build log was this:

home/cruise/.cruise/projects/pegasus/work cruise$ ruby1.8 -e "require 'rubygems' rescue nil; require 'rake'; load '/home/cruise/cruisecontrol-1.4.0/tasks/cc_build.rake'; ARGV << '--nosearch' << 'cc:build'; Rake.application.run; ARGV.clear"
rake aborted!
FATAL:  password authentication failed for user "pegasus_dev"

pegasus_dev is the name of the database in my development environment. On my CI machine (where cc.rb runs), there is no DB nor DB user for development environment.

I confirmed that when I outcommented my configuration line enabling my observer like this in config/environment.rb

  # config.active_record.observers = :order_state_observer

then things started to work again.

But why the sudden was CC.rb sudenly starting to use my development environment?

So I got curious: I went to my CI machine ~/.cruise/projects/pegasus/work and ran (adding the --trace argument)

ruby1.8 --debug -e "require 'rubygems' rescue nil; require 'rake'; load '/home/cruise/cruisecontrol-1.4.0/tasks/cc_build.rake'; ARGV << '--nosearch' << '--trace' << 'cc:build'; Rake.application.run; ARGV.clear" 2> ~/trace.err 1> ~/trace.out

That showed that when configuring observer, the ENV['RAILS_ENV'] = 'test' statement in cc_build.rake:38 is not propagated properly to the project rake task db:test:purge, it has to be set on a higher level.

So I added the argument 'RAILS_ENV=test' to the build command, and things work.

I supply a patch for this.

No comments found

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

People watching this ticket

Attachments

Tags

Pages