Skip to content

Make bundler-checksum work with Bundler v2.5.0 (part 2)

Stan Hu requested to merge sh-update-bundler-checksum into master

What does this MR do and why?

Bundler v2.5.0 introduced a CHECKSUMS section in Gemfile.lock and significantly refactored checksums into Bundler::Checksum. The refactoring dropped the Bundler::RubyGemsGemInstaller#checksum_type method, causing pre-install checks to fail with NoMethodError: undefined method 'checksum_type' as seen in https://gitlab.com/gitlab-org/gitlab/-/jobs/5861840560.

This commit fixes the digest comparison to use the digest set in Bundler::Checksum. This change needs to be backwards compatible with Bundler v2.4.x until we require v2.5.x.

This merge request will enable Renovate automatic updates to work again.

How to set up and validate locally

I suggest using a Docker environment to make sure gems are installed from scratch. In your gitlab dir, run:

docker run -it -v $(pwd):/build ruby:3.2 bash
cd /build/vendor/gems/bundler-checksum/test/project_with_checksum_lock
scripts/test

This should install successfully on this branch but fail in master.

Edited by Stan Hu

Merge request reports