Ensure examples file is opened from Rails.root
What does this MR do and why?
!134118 (merged) loads
ee/lib/code_suggestions/prompts/code_completion/examples.yml
, but
this broke GitLab Omnibus startup because the working directory of
Puma and Sidekiq is not Rails.root
.
To fix this issue, we need to use an absolute path with Rails.root.
How to set up and validate locally
- Install the latest GitLab EE build. I used
16.5.202310191605-3236057bf51.2a3cd5fa09a
. - Watch as CPU goes to 100% as
puma
andsidekiq
spin. In/var/log/gitlab/puma/current
:
2023-10-19_19:21:11.12761 bundler: failed to load command: puma (/opt/gitlab/embedded/bin/puma)
2023-10-19_19:21:11.12903 /opt/gitlab/embedded/service/gitlab-rails/ee/lib/code_suggestions/programming_language.rb:82:in `read': No such file or directory @ rb_sysopen - ee/lib/code_suggestions/prompts/code_completion/examples.yml (Errno::ENOENT)
2023-10-19_19:21:11.12904 from /opt/gitlab/embedded/service/gitlab-rails/ee/lib/code_suggestions/programming_language.rb:82:in `<class:ProgrammingLanguage>'
2023-10-19_19:21:11.12904 from /opt/gitlab/embedded/service/gitlab-rails/ee/lib/code_suggestions/programming_language.rb:4:in `<module:CodeSuggestions>'
2023-10-19_19:21:11.12904 from /opt/gitlab/embedded/service/gitlab-rails/ee/lib/code_suggestions/programming_language.rb:3:in `<top (required)>'
- Apply this patch in
/opt/gitlab/embedded/service/gitlab-rails/ee/lib/code_suggestions/programming_language.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