Automattic / a8c-ci-toolkit-buildkite-plugin

A caching plugin that can be invoked from your build script.
21 stars 5 forks source link

Ensure we're using the latest version of `bundler` before running `bundle install` #28

Closed AliSoftware closed 2 years ago

AliSoftware commented 2 years ago

Fixes https://github.com/Automattic/bash-cache-buildkite-plugin/issues/16

Installs the latest version of bundler to avoid Gem::LoadError crashes when using mismatching versions.

AliSoftware commented 2 years ago

Good point, and if I remember correctly, parsing the version from the Gemfile.lock was another option that was considered in the description of https://github.com/Automattic/bash-cache-buildkite-plugin/issues/16 that this PR fixes.

I went with the simpler version of installing the latest (gem install bundler) because that's what we have been doing in practice in all places in our pipelines where we applied the workaround locally (e.g. here or here).

So the aim of that PR was simply moved applying that workaround from each individual pipeline to move it to the install_gems command directly, as was initially suggested in the original issue

I should have included all that in my PR description, sorry for not providing all the pointers in the first place.

AliSoftware commented 2 years ago

PS: @rynaardb also mentioned in https://github.com/Automattic/bash-cache-buildkite-plugin/issues/16#issuecomment-1184639099 that they should have now fixed this for new VMs that will be provisioned, via 77-gh-Automattic/buildkite-ci, by disabling bundler as a default gem when creating new VMs.

That being said, as @mokagio pointed out in the subsequent comment, it will probably take some time before we start using new VMs provisioned with the fix from 77-gh-Automattic/buildkite-ci. Sure @crazytonyli is currently provisioning new VMs for Xcode 14 betas, but we won't use Xcode 14 until it's final (likely end of September / start of October), if not later (as we might need to fix potential compilation issues on the projects adopting Xcode 14 before moving their CI to those new VMs). So in the meantime it's nice to have this workaround be applied and work even for older VMs.

wdyt @jkmassel @rynaardb ? Given the above: