Skip to content
Merged
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
31 changes: 30 additions & 1 deletion tasks/github.rake
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,20 @@ namespace :github do
tasks.each do |task|
env = { 'BUNDLE_GEMFILE' => task['gemfile'] }
cmd = 'bundle check || bundle install'
Bundler.with_unbundled_env { sh(env, cmd) }

if RUBY_PLATFORM == 'java' && RUBY_ENGINE_VERSION.start_with?('9.2')
# For JRuby 9.2, the `bundle install` command failed ocassionally with the NameError.
#
# Mitigate the flakiness by retrying the command up to 3 times.
#
# https://github.com/jruby/jruby/issues/7508
# https://github.com/jruby/jruby/issues/3656
with_retry do
Bundler.with_unbundled_env { sh(env, cmd) }
end
else
Bundler.with_unbundled_env { sh(env, cmd) }
end
end
end

Expand All @@ -369,5 +382,21 @@ namespace :github do
Bundler.with_unbundled_env { sh(env, cmd) }
end
end

def with_retry(&block)
retries = 0
begin
yield
rescue StandardError => e
rake_output_message(
"Bundle install failure (Attempt: #{retries + 1}): #{e.class.name}: #{e.message}, \
Source:\n#{Array(e.backtrace).join("\n")}"
)
sleep(2**retries)
retries += 1
retry if retries < 3
raise
end
end
end
# rubocop:enable Metrics/BlockLength
Loading