Skip to content

Commit

Permalink
Revert "Reintroduce bundler 2.4 (#14995)"
Browse files Browse the repository at this point in the history
This reverts commit 0df07d3.
  • Loading branch information
jsvd committed Jun 15, 2023
1 parent a098912 commit 8dfce4a
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 9 deletions.
2 changes: 1 addition & 1 deletion lib/bootstrap/bundler.rb
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ def execute_bundler_with_retry(options)
begin
execute_bundler(options)
break
rescue ::Bundler::SolveFailure => e
rescue ::Bundler::VersionConflict => e
$stderr.puts("Plugin version conflict, aborting")
raise(e)
rescue ::Bundler::GemNotFound => e
Expand Down
4 changes: 0 additions & 4 deletions rakelib/plugins-metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -424,10 +424,6 @@
"default-plugins": true,
"skip-list": false
},
"logstash-input-cloudwatch": {
"default-plugins": false,
"skip-list": true
},
"logstash-output-cloudwatch": {
"default-plugins": false,
"skip-list": true
Expand Down
11 changes: 9 additions & 2 deletions rakelib/plugins_docs_dependencies.rake
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ class PluginVersionWorking
end

def try_plugin(plugin, successful_dependencies)
Bundler::DepProxy.__clear!
builder = Bundler::Dsl.new
gemfile = LogStash::Gemfile.new(File.new(LogStash::Environment::GEMFILE_PATH, "r+")).load
gemfile.update(plugin)
Expand All @@ -135,8 +136,6 @@ class PluginVersionWorking
definition.resolve_remotely!
from = PLUGIN_METADATA.fetch(plugin, {}).fetch("default-plugins", false) ? :default : :missing
extract_versions(definition, successful_dependencies, from)
builder.instance_eval { @sources = [] }
builder.instance_eval { @dependencies = [] }
end

def extract_versions(definition, dependencies, from)
Expand Down Expand Up @@ -205,6 +204,14 @@ task :generate_plugins_version do
end
end
end
DepProxy.class_eval do
# Bundler caches it's dep-proxy objects (which contain Gem::Dependency objects) from all resolutions.
# The Hash itself continues to grow between dependency resolutions and hold up a lot of memory, to avoid
# the issue we expose a way of clear-ing the cached objects before each plugin resolution.
def self.__clear!
@proxies.clear
end
end

Fetcher::CompactIndex.class_eval do
alias_method :__bundle_worker, :bundle_worker
Expand Down
4 changes: 2 additions & 2 deletions spec/unit/bootstrap/bundler_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@

context 'abort with an exception' do
it 'gem conflict' do
allow(::Bundler::CLI).to receive(:start).with(bundler_args) { raise ::Bundler::SolveFailure.new('conflict') }
expect { subject }.to raise_error(::Bundler::SolveFailure)
allow(::Bundler::CLI).to receive(:start).with(bundler_args) { raise ::Bundler::VersionConflict.new('conflict') }
expect { subject }.to raise_error(::Bundler::VersionConflict)
end

it 'gem is not found' do
Expand Down

0 comments on commit 8dfce4a

Please sign in to comment.