miq_bot icon indicating copy to clipboard operation
miq_bot copied to clipboard

Undocumented detail in the setup of settings.yml

Open europ opened this issue 7 years ago • 6 comments

NoMethodError: undefined method 'each' for nil:NilClass

at

https://github.com/ManageIQ/miq_bot/blob/ca62968398d181fa6155264cda053ec06c56159d/app/workers/commit_monitor_handlers/commit_range/path_based_labeler.rb#L21

2018-02-21T07:42:11.405Z 24598 TID-gnaf0hvnk WARN: NoMethodError: undefined method `each' for nil:NilClass
2018-02-21T07:42:11.405Z 24598 TID-gnaf0hvnk WARN: /root/miq_bot/app/workers/commit_monitor_handlers/commit_range/path_based_labeler.rb:21:in `process_branch'
/root/miq_bot/app/workers/commit_monitor_handlers/commit_range/path_based_labeler.rb:14:in `perform'
/root/.rbenv/versions/2.3.6/lib/ruby/gems/2.3.0/gems/sidekiq-4.1.4/lib/sidekiq/processor.rb:152:in `execute_job'
...

due to uninitialized variable

https://github.com/ManageIQ/miq_bot/blob/ca62968398d181fa6155264cda053ec06c56159d/config/settings.yml#L28

Example how to solve:

...

# Worker settings
diff_content_checker:
  offenses: {}
merge_target_titler:
  included_repos: []
path_based_labeler:
  rules:
    organization/repository: []
travis_build_killer:
  included_repos: []

europ avatar Feb 27 '18 13:02 europ

strange...how is this working in production? We definitely don't have rules for every repo, and according to https://github.com/ManageIQ/miq_bot/blob/8bbabd9c3dc8c7dd6755d3b7128b3ad3426713d4/app/workers/commit_monitor_handlers/commit_range/path_based_labeler.rb#L31 a missing repo will return nil.

Fryguy avatar Mar 21 '18 20:03 Fryguy

a missing repo will return nil.

Yeah but returning nil, means https://github.com/ManageIQ/miq_bot/blob/master/app/workers/commit_monitor_handlers/commit_range/path_based_labeler.rb#L21 blows up.

juliancheal avatar Mar 22 '19 13:03 juliancheal

Right, so I can't understand how's it's working in production presently. It should be blowing up constantly.

Fryguy avatar Mar 22 '19 15:03 Fryguy

What are the rules in production?

path_based_labeler:
  rules:

I always faced this NoMethodError until I added some empty fake org/repo into rules to make them non-empty.

europ avatar Mar 22 '19 20:03 europ

yeah, it turns out it's a coincidence that it's working in production...the settings are:

path_based_labeler:
  included_repos:
  - ManageIQ/manageiq
  - ManageIQ/manageiq-ui-classic
  rules:
    ManageIQ/manageiq:
    - ...
    ManageIQ/manageiq-ui-classic:
    - ...

So, we happen to set the included_repos as well as the rules which ensures only those valid repos are even called.

Fryguy avatar Mar 27 '19 19:03 Fryguy

This issue has been automatically marked as stale because it has not been updated for at least 3 months.

If you can still reproduce this issue on the current release or on master, please reply with all of the information you have about it in order to keep the issue open.

Thank you for all your contributions! More information about the ManageIQ triage process can be found in the traige process documentation.

miq-bot avatar Jun 11 '20 22:06 miq-bot