Fix bundler version parsing for RubyGems/Bundler 4.x output format - #1172
Merged
Merged
Conversation
Fixes a hard staging failure exposed by #1171 (automated rubygems 3.4.19 -> 4.0.22 bump): **ERROR** Unable to add bundler path to default environment: failed to determine bundler version from output: 4.0.22 (2026-09-30 commit ff2bd50) Failed to run all supply scripts: exit status 15 GetBundlerVersion() parsed `bundle version`'s output with a regex requiring a literal "Bundler version " prefix (e.g. "Bundler version 2.7.2 (2025-09-09 commit b463ced1459)"). As of RubyGems/Bundler 4.x, that prefix has been dropped - the command now just prints the bare version number instead (e.g. "4.0.22 (2026-09-30 commit ff2bd50)"), causing the regex to find zero matches and the whole supply script to abort. Extracted the parsing logic into a small, directly unit-testable pure function (parseBundlerVersion) and made the "Bundler version " prefix optional in the regex, so both the legacy and the new output formats parse correctly.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes a hard staging failure that broke CI on #1171 (the automated
rubygems3.4.19->4.0.22dependency bump):Root cause
GetBundlerVersion()(src/ruby/versions/ruby.go) parses the output ofbundle versionwith a regex requiring a literal"Bundler version "prefix:This matches the legacy output format (e.g.
"Bundler version 2.7.2 (2025-09-09 commit b463ced1459)"). As of RubyGems/Bundler 4.x, that prefix has been dropped - the command now just prints the bare version number instead (e.g."4.0.22 (2026-09-30 commit ff2bd50)"). The regex finds zero matches against the new format, soGetBundlerVersion()returns an error, and the whole supply script aborts (exit status 15) - breaking every integration test that needsbundleto resolve its version (4 failures in #1171's CI run:vendor_bundle,custom_gemfile,Offline,MultiBuildpack/.../binary_buildpack).This is a real, 100%-reproducible functional regression exposed by the version bump - not CI flakiness.
Fix
parseBundlerVersion(output string) (string, error)."Bundler version "prefix optional in the regex ((?:Bundler version )?(\d+\.\d+\.\d+)), so both the legacy and new output formats parse correctly.Test plan
TestParseBundlerVersion(src/ruby/versions/ruby_internal_test.go) with 5 cases: legacy prefixed format, new unprefixed format (the exact string from the CI failure), a bare version number, unrecognized output, and empty output.go test ./src/ruby/versions/...- all 37 existing Ginkgo specs + 5 new test cases pass.go build ./...,go vet ./...- clean.Relationship to #1171
This is a prerequisite fix for #1171 (the rubygems bump) to be mergeable - recommend rebasing/re-running #1171's CI once this lands.