[Rails5] Fix params passed to MergeWorker
1 unresolved thread
1 unresolved thread
Compare changes
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)>'
No.
No.
package-and-qa
manual pipeline job)