appelier / bigtuna

Continuous Integration software written on top of Ruby on Rails 3 and DelayedJob.
http://bigtuna.appelier.com
273 stars 65 forks source link

cd-ing in one build step and running bundle install bundle's bigtuna's Gemfile #51

Closed ajsharp closed 13 years ago

ajsharp commented 13 years ago

In the output below, despite the fact that I'm cd-ing into the %build_dir%, bundle install is bundling bigtuna's Gemfile, not the app located in the build dir. What is going on here?

Build steps:

cd %build_dir%
bundle install
cp examples/config/* config/
bundle exec rake --trace

Output:

cd /var/www/bigtuna/releases/20110223023156/builds/data_wrangler/build_22_20110223104026

bundle install
Using rake (0.8.7) 
Using abstract (1.0.0) 
Using activesupport (3.0.3) 
Using builder (2.1.2) 
Using i18n (0.4.2) 
Using activemodel (3.0.3) 
Using erubis (2.6.6) 
Using rack (1.2.1) 
Using rack-mount (0.6.13) 
Using rack-test (0.5.6) 
Using tzinfo (0.3.23) 
Using actionpack (3.0.3) 
Using mime-types (1.16) 
Using polyglot (0.3.1) 
Using treetop (1.4.9) 
Using mail (2.2.10) 
Using actionmailer (3.0.3) 
Using arel (2.0.4) 
Using activerecord (3.0.3) 
Using activeresource (3.0.3) 
Using addressable (2.2.2) 
Using crack (0.1.8) 
Using daemons (1.1.0) 
Using delayed_job (2.1.1) 
Using eventmachine (0.12.10) 
Using multipart-post (1.0.1) 
Using faraday (0.5.3) 
Using haml (3.0.24) 
Using httparty (0.4.5) 
Using bundler (1.0.2) 
Using thor (0.14.6) 
Using railties (3.0.3) 
Using rails (3.0.3) 
Using jquery-rails (0.2.6) 
Using json (1.4.6) 
Using notifo (0.1.0) 
Using open4 (1.0.1) 
Using roauth (0.0.3) 
Using xmpp4r (0.5) 
Using scashin133-xmpp4r-simple (0.8.9) 
Using shout-bot (0.0.4) 
Using sqlite3-ruby (1.3.1) 
Using stringex (1.2.0) 
Using twitter-stream (0.1.10) 
Using tinder (1.4.3) 
Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed.

Your bundle was installed to `/var/www/bigtuna/shared/bundle`

cp examples/config/* config/

bundle exec rake --trace

Exit code: 1
(in /var/www/bigtuna/shared/builds/data_wrangler/build_22_20110223104026)
rake aborted!
no such file to load -- sinatra
/var/www/bigtuna/shared/builds/data_wrangler/build_22_20110223104026/lib/web_api.rb:1:in `require'
/var/www/bigtuna/shared/builds/data_wrangler/build_22_20110223104026/lib/web_api.rb:1
./lib/initializer.rb:26:in `require'
./lib/initializer.rb:26
/var/www/bigtuna/shared/builds/data_wrangler/build_22_20110223104026/Rakefile:4:in `require'
/var/www/bigtuna/shared/builds/data_wrangler/build_22_20110223104026/Rakefile:4
/var/www/bigtuna/shared/bundle/ruby/1.8/gems/rake-0.8.7/lib/rake.rb:2383:in `load'
/var/www/bigtuna/shared/bundle/ruby/1.8/gems/rake-0.8.7/lib/rake.rb:2383:in `raw_load_rakefile'
/var/www/bigtuna/shared/bundle/ruby/1.8/gems/rake-0.8.7/lib/rake.rb:2017:in `load_rakefile'
/var/www/bigtuna/shared/bundle/ruby/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
/var/www/bigtuna/shared/bundle/ruby/1.8/gems/rake-0.8.7/lib/rake.rb:2016:in `load_rakefile'
/var/www/bigtuna/shared/bundle/ruby/1.8/gems/rake-0.8.7/lib/rake.rb:2000:in `run'
/var/www/bigtuna/shared/bundle/ruby/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
/var/www/bigtuna/shared/bundle/ruby/1.8/gems/rake-0.8.7/lib/rake.rb:1998:in `run'
/var/www/bigtuna/shared/bundle/ruby/1.8/gems/rake-0.8.7/bin/rake:31
/var/www/bigtuna/shared/bundle/ruby/1.8/bin/rake:19:in `load'
/var/www/bigtuna/shared/bundle/ruby/1.8/bin/rake:19
wuputah commented 13 years ago

All commands in your build script are always executed in %build_dir%. Bundle install is picking up the BUNDLE_GEMFILE environment variable from Bigtuna (set by Rails... sigh).

ajsharp commented 13 years ago

@wuputah: Cool, thanks for the info on %build_dir%. I dug into the source a bit today and found the runner, and saw where it cd's into the %build_dir%. I also noticed that everything runs within a Bundler.with_clean_env block -- does this not solve the BUNDLE_GEMFILE issue?

If not, this seems like an issue that either a.) should be documented clearly on the docs site or b.) we should try to work around. Are you open to a patch on this issue?

wuputah commented 13 years ago

This has been a design issue between us and the Bundler team. After speaking with them, I've contributed a pull request to Bundler to make with_clean_env cleaner, hopefully will be merged soon, but we may still implement some extra cleansing in Bigtuna since Bundler 1.1 may not be out for some time and people may be using Bundler 1.0.x for even longer. I think it may be wise for Bigtuna to also clean RAILS_ENV since that catches people as well.