Caching private gems efficiently



At ScoutRFP we use GH auth tokens to fetch private gems on our servers via HTTPS. At first I’ve decided to employ the same strategy when moving our builds to CircleCI. It was working fine except the one thing - bundle check , was always failing, causing to run bundle install each time. What was even more frustrating it would never install anything new (everything was cached).

The issue was solved as soon as I’ve added SSH keys to our CI user on GH, and used the git protocol to fetch private gems. Now it takes 2 seconds instead of 26 seconds, to verify the bundle.

bundle check --path=vendor/bundle || bundle install --path=vendor/bundle --jobs=4 --retry=3 
The Gemfile's dependencies are satisfied