Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,9 @@ ENV PATH="$BUNDLE_BIN:$PATH:$BUNDLE_PATH/bin"
RUN apt-add-repository ppa:brightbox/ruby-ng \
&& apt-get update \
&& apt-get install -y --no-install-recommends ruby2.7 ruby2.7-dev \
&& gem update --system 3.3.11 --no-document \
&& gem update --system 3.2.20 \
&& gem install bundler -v 1.17.3 --no-document \
&& gem install bundler -v 2.3.12 --no-document \
&& gem install bundler -v 2.3.10 --no-document \
&& rm -rf /var/lib/gems/2.7.0/cache/* \
&& rm -rf /var/lib/apt/lists/*

Expand Down
6 changes: 3 additions & 3 deletions bundler/helpers/v2/build
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@ cd "$install_dir"

# NOTE: Sets `BUNDLED WITH` to match the installed v2 version in Gemfile.lock
# forcing specs and native helpers to run with the same version
BUNDLER_VERSION=2.3.12 bundle config --local path ".bundle"
BUNDLER_VERSION=2.3.12 bundle config --local without "test"
BUNDLER_VERSION=2.3.12 bundle install
BUNDLER_VERSION=2.3.10 bundle config --local path ".bundle"
BUNDLER_VERSION=2.3.10 bundle config --local without "test"
BUNDLER_VERSION=2.3.10 bundle install
Original file line number Diff line number Diff line change
Expand Up @@ -5,32 +5,16 @@
module BundlerDefinitionRubyVersionPatch
def source_requirements
if ruby_version
requested_version = ruby_version.gem_version
requested_version = ruby_version.to_gem_version_with_patchlevel
sources.metadata_source.specs <<
Gem::Specification.new("Ruby\0", requested_version)
end

sources.metadata_source.specs <<
Gem::Specification.new("Ruby\0", "2.5.3")
Gem::Specification.new("Ruby\0", "2.5.3p105")

super
end

def metadata_dependencies
@metadata_dependencies ||=
[
Bundler::Dependency.new("Ruby\0", ruby_version_requirements),
Bundler::Dependency.new("RubyGems\0", Gem::VERSION)
]
end

def ruby_version_requirements
return [] unless ruby_version

ruby_version.versions.map do |version|
Gem::Requirement.new(version)
end
end
end

Bundler::Definition.prepend(BundlerDefinitionRubyVersionPatch)
2 changes: 1 addition & 1 deletion bundler/lib/dependabot/bundler/helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ module Dependabot
module Bundler
module Helpers
V1 = "1.17.3"
V2 = "2.3.12"
V2 = "2.3.10"
# If we are updating a project with no Gemfile.lock, we default to the
# newest version we support
DEFAULT = V2
Expand Down
15 changes: 4 additions & 11 deletions bundler/lib/dependabot/bundler/native_helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def clamp(seconds)
def self.run_bundler_subprocess(function:, args:, bundler_version:, options: {})
# Run helper suprocess with all bundler-related ENV variables removed
bundler_major_version = bundler_version.split(".").first
helpers_path = versioned_helper_path(bundler_major_version)
helpers_path = versioned_helper_path(bundler_version: bundler_major_version)
::Bundler.with_original_env do
command = BundleCommand.
new(options[:timeout_per_operation_seconds]).
Expand All @@ -47,7 +47,7 @@ def self.run_bundler_subprocess(function:, args:, bundler_version:, options: {})
args: args,
env: {
# Bundler will pick the matching installed major version
"BUNDLER_VERSION" => installed_bundler_version(bundler_major_version),
"BUNDLER_VERSION" => bundler_version,
"BUNDLE_GEMFILE" => File.join(helpers_path, "Gemfile"),
# Prevent the GEM_HOME from being set to a folder owned by root
"GEM_HOME" => File.join(helpers_path, ".bundle")
Expand All @@ -61,15 +61,8 @@ def self.run_bundler_subprocess(function:, args:, bundler_version:, options: {})
end
end

def self.versioned_helper_path(bundler_major_version)
File.join(native_helpers_root, "v#{bundler_major_version}")
end

# Maps the major version unto the specific version we have installed
def self.installed_bundler_version(bundler_major_version)
return Helpers::V1 if bundler_major_version == "1"

Helpers::V2
def self.versioned_helper_path(bundler_version:)
File.join(native_helpers_root, "v#{bundler_version}")
end

def self.native_helpers_root
Expand Down
4 changes: 2 additions & 2 deletions bundler/script/ci-test
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ fi

if [[ "$SUITE_NAME" == "bundler2" ]]; then
cd helpers/v2 \
&& BUNDLER_VERSION=2.3.12 bundle install \
&& BUNDLER_VERSION=2.3.12 bundle exec rspec spec \
&& BUNDLER_VERSION=2.3.10 bundle install \
&& BUNDLER_VERSION=2.3.10 bundle exec rspec spec \
&& cd -
fi
2 changes: 1 addition & 1 deletion bundler/spec/dependabot/bundler/helper_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
end

let(:v1) { "1.17.3" }
let(:v2) { "2.3.12" }
let(:v2) { "2.3.10" }

describe "#bundler_version" do
def described_method(lockfile)
Expand Down
2 changes: 1 addition & 1 deletion bundler/spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def self.use_bundler_2?
end

def self.bundler_version
use_bundler_2? ? "2.3.12" : "1.17.3"
use_bundler_2? ? "2.3.10" : "1.17.3"
end

def self.bundler_major_version
Expand Down