Ruby 2.4.2 - failing after latest update

Hello!
I ran my build 14 hours ago and it worked, 10 hours ago the ruby images were updated.

For some reason, the right ruby gems cannot be accessed from inside rails commands, but they work when using SSH to connect.

Any clue on what have changed?

Might be related to Bundler and this

Hey @david.wesmn this can happen sometimes when we update our 1.0 images, and it’s related to your project cache. I’ve reset the cache for you, so your next build will take a bit longer to rebuild it. You should be good to go after that.

If anyone else is experiencing a similar issue please open a support ticket at https://support.circleci.com

Hello @fernfernfern.

I have tried clearing cache and running it without cache multiple times to no awail.

Should I open a support ticket instead?

@david.wesmn, yes please open a ticket. There may be something else at issue in your case here.

@david.wesmn Does it help if you use bin/rails test instead of bundle exec rails?

I will try that if I have time, right now I kept bundler 1.16 but used bundle install --system instead of bundle install --deploy. But the caching is not as good then.

Hi David,

Thank you for reporting this and for sharing that link to the bundler issue. I’ve reproduced this and confirmed it’s a problem with bundler 1.16.0 and issue 6144.

To summarize for others, that issue affects bundle install --deployment and bundle install --path <anything>. We typically suggest --path vendor/bundle, but as long as this flag is used, bundler will follow a bad code path. This also only seems to affect certain programs and packages, ones that launch another Ruby process requiring the Bundler environment. I’ve seen this affect rake test and rails test because of the Spring loader, and cucumber.

A workaround is to install bundler 1.15.4 with:

sudo gem uninstall -x bundler
sudo gem install bundler --version 1.15.4

This will let you keep using --deployment or --path vendor/bundle for caching.

As for our convenience image, I’ll create an issue with the community Ruby image to see if I can get it fixed there. We can patch this in our Ruby convenience images, but I’d prefer to keep ours as close to the community images as possible.

Yes, bundler 1.15.4 probably works best. Hopefully there will be patches in bundler or e.g. spring.

@Eric @zzak @fernfernfern
The latest answer in the bundler thread seems to be on to something, saying the issue lies in the environment variables and spring.
https://github.com/bundler/bundler/issues/6144#issuecomment-342686828

Hi David,

Thanks for updating us. I think the issue is still Bundler 1.16.0 and not Spring-specific. The suggested fix to Spring he links to has a failing test. In it, the failure messages are more dependency problems. Zak informed me that rails/rails pinned Bundler to < 1.16 because they were getting failures on their master.

In addition to that issue, this bundler issue regarding cucumber and this rubygems issue regarding bundler produce similar errors. At least in the Rubygems issue, Spring isn’t involved.

Rubygems 2.7.2 fixed one person’s issue, but didn’t fix my rails test reproduction.

Tried to switch back to bundle install --deployment now and it is working again:
https://circleci.com/gh/pensionsupplysning/web/89

I started having issues a while ago and still cannot use bundle install --deployment.

Did you figure this out @Eric?

Hi David,

You saw a regression of this behavior because we rolled back a change to our Ruby images that uninstalled Bundler 1.16.0. That version of bundler wasn’t uninstalled fully because the upstream image installs it as a default gem, making it more difficult to uninstall.

For now, can you work around this issue by uninstalling bundler 1.16.0 as in this post:

https://discuss.circleci.com/t/failed-to-invoke-bundler-on-circleci-2-0-with-circleci-ruby-2-4-2/18480/18