[Rails5] Fix params passed to MergeWorker
What does this MR do?
In Rails 5 the params
is no longer a Hash, it is an ActionController::Parameters object.
When this object is passed to a sidekiq's worker, it gets serialized by sidekiq to a JSON string.
The string doesn't support the with_indifferent_access
method which is called in the app/workers/merge_worker.rb
.
This MR adds explicit transformation of params
to hash before passing it to the worker.
Also the Gemfile.rails5.lock
is updated.
Example of an error is:
32) Projects::MergeRequestsController POST merge when the sha parameter matches the source SHA returns :success
Failure/Error: params = params.with_indifferent_access
NoMethodError:
undefined method `with_indifferent_access' for #<String:0x0000563f60217190>
# ./app/workers/merge_worker.rb:5:in `perform'
# ./lib/gitlab/sidekiq_status/server_middleware.rb:5:in `call'
# ./config/initializers/forbid_sidekiq_in_transactions.rb:35:in `block (2 levels) in <module:NoEnqueueingFromTransactions>'
# ./app/models/merge_request.rb:326:in `merge_async'
# ./app/controllers/projects/merge_requests_controller.rb:306:in `merge!'
# ./app/controllers/projects/merge_requests_controller.rb:155:in `merge'
# ./lib/gitlab/i18n.rb:50:in `with_locale'
# ./lib/gitlab/i18n.rb:56:in `with_user_locale'
# ./app/controllers/application_controller.rb:328:in `set_locale'
# ./spec/controllers/projects/merge_requests_controller_spec.rb:319:in `merge_with_sha'
# ./spec/controllers/projects/merge_requests_controller_spec.rb:323:in `block (4 levels) in <top (required)>'
Are there points in the code the reviewer needs to double check?
No.
Why was this MR needed?
Screenshots (if relevant)
No.
Does this MR meet the acceptance criteria?
-
Changelog entry added, if necessary -
Documentation created/updated -
API support added -
Tests added for this feature/bug - Review
-
Has been reviewed by UX -
Has been reviewed by Frontend -
Has been reviewed by Backend -
Has been reviewed by Database
-
-
Conform by the merge request performance guides -
Conform by the style guides -
Squashed related commits together -
Internationalization required/considered -
End-to-end tests pass ( package-and-qa
manual pipeline job)