December 19, 2009 20:43
Posted by Jeremy Durham
I’ve been using bundler happily for the last month or so, and if you haven’t already checked it out, there’s numerous other sources that can explain it better than I can. Go check them out. Today I want to focus on CI and what having 60 megs of bundled code can mean for your builds.
Each of our builds are about 70 meg, 60 megs for the bundled code, a few megs in logs and a few megs in code. We generally push about 10-15 times per day. Right now we have 3 main projects going on. Even though I forked Integrity to only keep builds for a limited time, which in our case is 14 days, one app could still use as much as 10 gigs of space to store 14 days of builds. When you consider that we have three apps, with several more starting soon, these numbers were starting to look really scary.
We worked out a simple solution that seems to solve our problem, and actually speed up our builds. We set an environment variable, right now called CI, which specifies where the bundled gems lives. When we do a bundle, we do: CI=/path/to/bundled/gems gem bundle && rake integrity:all.
We modified both our Gemfile and preinitializer as follows:
bundle_path ENV['CI'] ? ENV['CI'] : 'vendor/bundled_gems'
bundle_path = ENV['CI'] ? ENV['CI'] ? 'vendor/bundled_gems'
This allows developers on their local machine to just do a normal “gem bundle” to run the app, but gives us flexibility on the build machine to point at a relative path where the bundled gems will live, outside of the application. That means the bundled gems just get updated, instead of getting pulled each time.
How are you managing bundled gems and Continuous Integration? What do you do with your gigs worth of old builds?