Bundler 2.1.x and greater caching issues

Hi,
Switched recently to the last version of bundler (2.2.2) and it has broke the caching system of our projects using has key the Gemfile.lock.
We are using the advised {{ checksum Gemfile.lock }} to generate our cache key but since the last version of bundler is adding a platforms info after an update. The generated cache key is different from the one that will be retrieve because the file has changed.

Is there a way to use the commit hash of the file or an other solution to solve this issue?

One trick with the checksum command is that you can create a temporary file with the caching data and then checksum that.

Depending on the contents on the Gemfile.lock, you should be able to filter out any data and then create a new file to checksum.

For example:

grep -vF 'PLATFORMS' > /tmp/gems.lock

Then you can use that for a checksum:

{{ checksum /tmp/gems.lock }}

If you had an example Gemfile.lock we can come up with something a bit robust for the platform data added.