git-linguist not working in 14.5.0
Summary
git-linguist fails to run in Charts 14.5.0 with:
Gitlab::Git::CommandError (13:language stats: waiting for linguist: exit status 1.)
I reproduced this on master
as well.
Note that master-ubi8
does not have this problem because we fixed a similar issue in gitlab-org/build/CNG!808 (merged).
Steps to reproduce
k -n gitlab exec -it gitlab-toolbox-8457dc9f8-zsg8t -- /srv/gitlab/bin/rails console
--------------------------------------------------------------------------------
Ruby: ruby 2.7.4p191 (2021-07-07 revision a21a3b7d23) [x86_64-linux]
GitLab: 14.5.0-ee (490a8efda84) EE
GitLab Shell: 13.22.0
PostgreSQL: 12.7
--------------------------------------------------------------------------------
irb(main):004:0> ::Projects::DetectRepositoryLanguagesService.new(Project.find_by_full_path('some/projjct'))).execute
Traceback (most recent call last):
10: from (irb):1
9: from (irb):2:in `rescue in irb_binding'
8: from app/services/projects/detect_repository_languages_service.rb:12:in `execute'
7: from app/services/projects/detect_repository_languages_service.rb:40:in `ensure_programming_languages'
6: from lib/gitlab/language_detection.rb:13:in `languages'
5: from lib/gitlab/language_detection.rb:64:in `detection'
4: from app/models/repository.rb:302:in `languages'
3: from lib/gitlab/git/repository.rb:770:in `languages'
2: from lib/gitlab/git/wraps_gitaly_errors.rb:6:in `wrapped_gitaly_errors'
1: from lib/gitlab/git/wraps_gitaly_errors.rb:15:in `rescue in wrapped_gitaly_errors'
Gitlab::Git::CommandError (13:language stats: waiting for linguist: exit status 1.)
The Gitaly logs show:
{
"args":[
"env",
"PATH=/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
"/usr/bin/bundle",
"exec",
"bin/ruby-cd",
"/home/git/repositories/@hashed/d4/73/d4735e3a265e16eee03f59718b9b5d03019c07d8b6c51f90da3a666eec13ab35.git",
"git-linguist",
"--commit=60557ff8941e09080d042b680a8b4760f72a57d7",
"stats"
],
"command.cpu_time_ms":217.793,
"command.exitCode":1,
"command.inblock":0,
"command.maxrss":148648,
"command.oublock":0,
"command.real_time_ms":218.02375199999997,
"command.system_time_ms":16.132,
"command.user_time_ms":201.661,
"correlation_id":"01FPHN2ZN7G8CTATATYSJNNBCN",
"grpc.meta.auth_version":"v2",
"grpc.meta.client_name":"gitlab-web",
"grpc.meta.deadline_type":"unknown",
"grpc.meta.method_type":"unary",
"grpc.method":"CommitLanguages",
"grpc.request.deadline":"2021-12-10T13:49:26.823",
"grpc.request.fullMethod":"/gitaly.CommitService/CommitLanguages",
"grpc.request.glProjectPath":"root/test",
"grpc.request.glRepository":"project-2",
"grpc.request.repoPath":"@hashed/d4/73/d4735e3a265e16eee03f59718b9b5d03019c07d8b6c51f90da3a666eec13ab35.git",
"grpc.request.repoStorage":"default",
"grpc.service":"gitaly.CommitService",
"grpc.start_time":"2021-12-10T07:49:26.823",
"level":"error",
"msg":"PID 708 BUNDLE_GEMFILE=/srv/gitaly-ruby/Gemfile\nbundler: failed to load command: bin/ruby-cd (bin/ruby-cd)\nbin/ruby-cd:8:in `exec': No such file or directory - git-linguist (Errno::ENOENT)\n\tfrom bin/ruby-cd:8:in `\u003ctop (required)\u003e'\n\tfrom /usr/lib/ruby/gems/2.7.0/gems/bundler-2.2.19/lib/bundler/cli/exec.rb:63:in `load'\n\tfrom /usr/lib/ruby/gems/2.7.0/gems/bundler-2.2.19/lib/bundler/cli/exec.rb:63:in `kernel_load'\n\tfrom /usr/lib/ruby/gems/2.7.0/gems/bundler-2.2.19/lib/bundler/cli/exec.rb:28:in `run'\n\tfrom /usr/lib/ruby/gems/2.7.0/gems/bundler-2.2.19/lib/bundler/cli.rb:474:in `exec'\n\tfrom /usr/lib/ruby/gems/2.7.0/gems/bundler-2.2.19/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'\n\tfrom /usr/lib/ruby/gems/2.7.0/gems/bundler-2.2.19/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'\n\tfrom /usr/lib/ruby/gems/2.7.0/gems/bundler-2.2.19/lib/bundler/vendor/thor/lib/thor.rb:392:in `dispatch'\n\tfrom /usr/lib/ruby/gems/2.7.0/gems/bundler-2.2.19/lib/bundler/cli.rb:30:in `dispatch'\n\tfrom /usr/lib/ruby/gems/2.7.0/gems/bundler-2.2.19/lib/bundler/vendor/thor/lib/thor/base.rb:485:in `start'\n\tfrom /usr/lib/ruby/gems/2.7.0/gems/bundler-2.2.19/lib/bundler/cli.rb:24:in `start'\n\tfrom /usr/lib/ruby/gems/2.7.0/gems/bundler-2.2.19/exe/bundle:49:in `block in \u003ctop (required)\u003e'\n\tfrom /usr/lib/ruby/gems/2.7.0/gems/bundler-2.2.19/lib/bundler/friendly_errors.rb:130:in `with_friendly_errors'\n\tfrom /usr/lib/ruby/gems/2.7.0/gems/bundler-2.2.19/exe/bundle:37:in `\u003ctop (required)\u003e'\n\tfrom /usr/bin/bundle:23:in `load'\n\tfrom /usr/bin/bundle:23:in `\u003cmain\u003e'\n",
"path":"/usr/bin/env",
"peer.address":"192.168.0.251:49226",
"pid":708,
"span.kind":"server",
"system":"grpc",
"time":"2021-12-10T07:49:27.044Z"
}