Fix Ruby 2.7 use of Hash#transform_keys in bulk update call
What does this MR do and why?
!111729 (merged) introduced the use of Hash#transform_keys with a Hash parameter (https://ruby-doc.org/core-3.1.0/Hash.html), which is only available in Ruby 3. To ensure backwards compatibility,
use a more verbose implementation.
This fixes the Ruby 2.7 job failure in https://gitlab.com/gitlab-org/gitlab/-/jobs/3797297862.
How to set up and validate locally
- Apply this diff:
diff --git a/.tool-versions b/.tool-versions
index ecddbdfeadce..0442b347209d 100644
--- a/.tool-versions
+++ b/.tool-versions
@@ -2,6 +2,6 @@ minio 2022-07-15T03-44-22Z
nodejs 16.15.0
postgres 12.13 13.9
redis 6.2.7
-ruby 3.0.5
+ruby 2.7.7
rust 1.65.0
yarn 1.22.19
diff --git a/spec/support/helpers/gitaly_setup.rb b/spec/support/helpers/gitaly_setup.rb
index 398a2a20f2fa..e7e920a1220e 100644
--- a/spec/support/helpers/gitaly_setup.rb
+++ b/spec/support/helpers/gitaly_setup.rb
@@ -199,7 +199,10 @@ def check_gitaly_config!
LOGGER.debug "Checking gitaly-ruby bundle...\n"
out = ENV['CI'] ? $stdout : '/dev/null'
- abort 'bundle check failed' unless system(env, 'bundle', 'check', out: out, chdir: gemfile_dir)
+
+ unless system(env, 'bundle', 'check', out: out, chdir: gemfile_dir)
+ system(env, 'bundle', 'install', out: out, chdir: gemfile_dir)
+ end
end
def connect_proc(toml)
- Run
bundle exec rspec ./spec/requests/api/graphql/mutations/issues/bulk_update_spec.rb.
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Edited by Stan Hu