Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

method_missing': undefined method merge' #574

Closed
okainov opened this issue Jul 7, 2020 · 12 comments
Closed

method_missing': undefined method merge' #574

okainov opened this issue Jul 7, 2020 · 12 comments
Labels
bug Something isn't working

Comments

@okainov
Copy link

okainov commented Jul 7, 2020

Starting today, we've started to get failures while running Danger in our CI, error seems to be coming from gitlab gem. I see new release was out yesterday, so probably it has broken it, could you please take a look?


 $ danger --fail-on-errors=true --fail-if-no-pr=true
 /usr/local/bundle/gems/gitlab-4.16.0/lib/gitlab/objectified_hash.rb:37:in `method_missing': undefined method `merge' for #<Gitlab::ObjectifiedHash:0x000056044d9a94d8> (NoMethodError)
 	from /usr/local/bundle/gems/danger-8.0.2/lib/danger/request_sources/gitlab.rb:87:in `block (2 levels) in mr_comments'
 	from /usr/local/bundle/gems/danger-8.0.2/lib/danger/request_sources/gitlab.rb:87:in `map'
 	from /usr/local/bundle/gems/danger-8.0.2/lib/danger/request_sources/gitlab.rb:87:in `block in mr_comments'
 	from /usr/local/bundle/gems/danger-8.0.2/lib/danger/request_sources/gitlab.rb:87:in `each'
 	from /usr/local/bundle/gems/danger-8.0.2/lib/danger/request_sources/gitlab.rb:87:in `flat_map'
 	from /usr/local/bundle/gems/danger-8.0.2/lib/danger/request_sources/gitlab.rb:87:in `mr_comments'
 	from /usr/local/bundle/gems/danger-8.0.2/lib/danger/request_sources/gitlab.rb:180:in `update_pull_request_with_inline_comments!'
 	from /usr/local/bundle/gems/danger-8.0.2/lib/danger/request_sources/gitlab.rb:173:in `update_pull_request!'
 	from /usr/local/bundle/gems/danger-8.0.2/lib/danger/danger_core/dangerfile.rb:260:in `post_results'
 	from /usr/local/bundle/gems/danger-8.0.2/lib/danger/danger_core/dangerfile.rb:288:in `run'
 	from /usr/local/bundle/gems/danger-8.0.2/lib/danger/danger_core/executor.rb:29:in `run'
 	from /usr/local/bundle/gems/danger-8.0.2/lib/danger/commands/runner.rb:73:in `run'
 	from /usr/local/bundle/gems/claide-1.0.3/lib/claide/command.rb:334:in `run'
 	from /usr/local/bundle/gems/danger-8.0.2/bin/danger:5:in `<top (required)>'
 	from /usr/local/bundle/bin/danger:23:in `load'
 	from /usr/local/bundle/bin/danger:23:in `<main>'

Docker image ruby:2.7.1

gem install:

 $ gem install danger-gitlab
 Successfully installed claide-1.0.3
 Successfully installed open4-1.3.4
 Successfully installed colored2-3.1.2
 Successfully installed cork-0.3.0
 Successfully installed nap-1.1.0
 Successfully installed claide-plugins-0.9.2
 Successfully installed rchardet-1.8.0
 Successfully installed git-1.7.0
 Successfully installed multipart-post-2.1.1
 Successfully installed faraday-1.0.1
 Successfully installed faraday-http-cache-2.2.0
 Successfully installed kramdown-2.3.0
 Successfully installed kramdown-parser-gfm-1.1.0
 Successfully installed public_suffix-4.0.5
 Successfully installed addressable-2.7.0
 Successfully installed sawyer-0.8.2
 Successfully installed octokit-4.18.0
 Successfully installed unicode-display_width-1.7.0
 Successfully installed terminal-table-1.8.0
 Successfully installed no_proxy_fix-0.1.2
 Successfully installed danger-8.0.2
 Successfully installed multi_xml-0.6.0
 Successfully installed mime-types-data-3.2020.0512
 Successfully installed mime-types-3.3.1
 When you HTTParty, you must party hard!
 Successfully installed httparty-0.18.1
 Successfully installed gitlab-4.16.0
 Successfully installed danger-git
@okainov
Copy link
Author

okainov commented Jul 7, 2020

Double-checked using fixed 4.15.0 version - no failure.

@fvelcker
Copy link

fvelcker commented Jul 7, 2020

Same here, all our pipelines are failing.
I compared the tags (v4.15.0...v4.16.0) and noticed I know nothing... So better off just leaving a comment...

@leolorenzoluis
Copy link

@okainov How did you specify to install 4.15.0 in the dependency graph when installing with gem install danger-gitlab?

@okainov
Copy link
Author

okainov commented Jul 8, 2020

@okainov How did you specify to install 4.15.0 in the dependency graph when installing with gem install danger-gitlab?

@leolorenzoluis, here you go ;)

gem install gitlab -v 4.15.0 && gem install danger-gitlab

@leolorenzoluis
Copy link

@okainov Thank you. I tried that, but it will still install 4.16.0 thus causing an error. This was my solution

gem uninstall gitlab -v 4.16.0 

@okainov
Copy link
Author

okainov commented Jul 8, 2020

@leolorenzoluis that's odd, as it works for us :)

$ gem install gitlab -v 4.15.0 && gem install danger-gitlab
 Successfully installed multi_xml-0.6.0
 Successfully installed mime-types-data-3.2020.0512
 Successfully installed mime-types-3.3.1
 When you HTTParty, you must party hard!
 Successfully installed httparty-0.18.1
 Successfully installed unicode-display_width-1.7.0
 Successfully installed terminal-table-1.8.0
 Successfully installed gitlab-4.15.0
 7 gems installed
 Successfully installed claide-1.0.3
 Successfully installed open4-1.3.4
 Successfully installed colored2-3.1.2
 Successfully installed cork-0.3.0
 Successfully installed nap-1.1.0
 Successfully installed claide-plugins-0.9.2
 Successfully installed rchardet-1.8.0
 Successfully installed git-1.7.0
 Successfully installed multipart-post-2.1.1
 Successfully installed faraday-1.0.1
 Successfully installed faraday-http-cache-2.2.0
 Successfully installed kramdown-2.3.0
 Successfully installed kramdown-parser-gfm-1.1.0
 Successfully installed public_suffix-4.0.5
 Successfully installed addressable-2.7.0
 Successfully installed sawyer-0.8.2
 Successfully installed octokit-4.18.0
 Successfully installed no_proxy_fix-0.1.2
 Successfully installed danger-8.0.2
 Successfully installed danger-gitlab-8.0.0
 20 gems installed

@brettha
Copy link

brettha commented Jul 9, 2020

Same issue here... Installed in gem file overriding v 4.16.0

gem 'gitlab', '4.15.0'

@philipqnguyen
Copy link

Same issue here in 4.16.0

       undefined method `merge' for #<Gitlab::ObjectifiedHash:0x0000000004b399e0>
     # ./bundle/ruby/2.5.0/gems/gitlab-4.16.0/lib/gitlab/objectified_hash.rb:37:in `method_missing'

@rymai
Copy link

rymai commented Jul 9, 2020

@NARKOZ I'm surprised Gitlab::ObjectifiedHash doesn't respond to #merge since it's a pretty valid use case, and I'm even more surprised that this is only discovered now. I've opened a MR to add support for Gitlab::ObjectifiedHash#merge if that's ok: #576

@smcgivern
Copy link

I think this happened for Danger specifically because it calls #merge on items inside an array: https://github.com/danger/danger/blob/v8.0.2/lib/danger/request_sources/gitlab.rb#L87

And #570 just made hashes inside an array an ObjectifiedHash, when before they weren't (which was a bug).

@NARKOZ
Copy link
Owner

NARKOZ commented Jul 12, 2020

Sorry for the breaking change introduced in 4.16.0.

This should be fixed in version 4.16.1 via 242cf2d

@rymai
Copy link

rymai commented Jul 13, 2020

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants