Hudson在构建时加载错误版本的gem

时间:2012-06-28 21:34:04

标签: ruby-on-rails continuous-integration hudson

我在Hudson CI中有一个破碎的构建,我不确定如何修复。问题似乎很简单 - 加载了错误的gem版本 - 但是Hudson控制台输出似乎与错误消息相矛盾。

Hudson的构建console输出:

[...hudson fetching code from SCM...]

Commencing build of Revision 496c7a18b3b56b14037d2d643858cec217be289a (origin/master)
Checking out Revision 496c7a18b3b56b14037d2d643858cec217be289a (origin/master)
[workspace] $ bash -xe /tmp/hudson424603273172296439.sh
+ export RAILS_ENV=hudson
+ RAILS_ENV=hudson
+ bundle install

[...list of a bunch of gems, truncated...]

Using launchy (2.1.0) 

[...the rest of the gems...]

[32mYour bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed.[0m
+ bundle exec rake hudson:all --trace
/home/build/build_gems/gems/bundler-1.0.7/lib/bundler/runtime.rb:27:in `setup': You have already activated launchy 0.3.7, but your Gemfile requires launchy 2.1.0. Consider using bundle exec. (Gem::LoadError)
    from /home/build/build_gems/gems/bundler-1.0.7/lib/bundler/spec_set.rb:12:in `each'
    from /home/build/build_gems/gems/bundler-1.0.7/lib/bundler/spec_set.rb:12:in `each'
    from /home/build/build_gems/gems/bundler-1.0.7/lib/bundler/runtime.rb:17:in `setup'
    from /home/build/build_gems/gems/bundler-1.0.7/lib/bundler.rb:100:in `setup'
    from /home/build/build_gems/gems/bundler-1.0.7/lib/bundler/cli.rb:343:in `exec'
    from /home/build/build_gems/gems/bundler-1.0.7/lib/bundler/vendor/thor/task.rb:22:in `send'
    from /home/build/build_gems/gems/bundler-1.0.7/lib/bundler/vendor/thor/task.rb:22:in `run'
    from /home/build/build_gems/gems/bundler-1.0.7/lib/bundler/vendor/thor/invocation.rb:118:in `invoke_task'
    from /home/build/build_gems/gems/bundler-1.0.7/lib/bundler/vendor/thor.rb:246:in `dispatch'
    from /home/build/build_gems/gems/bundler-1.0.7/lib/bundler/vendor/thor/base.rb:389:in `start'
    from /home/build/build_gems/gems/bundler-1.0.7/bin/bundle:13
    from /home/build/build_gems/bin/bundle:19:in `load'
    from /home/build/build_gems/bin/bundle:19
Build step 'Execute shell' marked build as failure

因此,bundle install命令显示正在使用launchy (2.1.0),但错误表明launchy 0.3.7已被激活。我不确定这种差异/冲突在哪里。

正如您所看到的,我们正在使用bundle exec来运行构建,因此捆绑应该适用,所以我不确定这里发生了什么。

在hudson项目配置的“Build =>执行shell”部分中,我有以下三行,这就是全部:

export RAILS_ENV="hudson"
bundle install
bundle exec rake hudson:all --trace

Gemfile有:

...
group :development, :cucumber, :test,:hudson do
  gem "populator",  ">= 0.2.5"
  gem "factory_girl",">= 1.2.1"
  gem "faker", ">= 0.3.1"
  gem "rspec", "1.3.2"
  gem "rspec-rails", "1.3.4"
  gem "webrat"  
  gem "capybara"
  gem 'launchy'
  gem "cucumber","1.1.8"
  gem "cucumber-rails","0.3.2"
  gem "database_cleaner"
  gem "ruby-debug"
end
...

Gemfile.lock

GEM
  ...
  specs:
    ...
    launchy (2.1.0)
    ...
...

DEPENDENCIES
  ...
  launchy
  ...

1 个答案:

答案 0 :(得分:0)

显然答案就在这个链接中。不确定我是如何在谷歌搜索答案中错过了这个:

http://www.opinionatedprogrammer.com/2011/03/bundler-problem-you-have-already-activated-launchy-0-3-7/

基本上,为您的应用创建自定义gemset +按照文章中的说明进行操作。