gitlab-shell hooks not run with --disable-rubygems
I noticed while stracing the ruby/gitlab-shell/hooks
that --disable-rubygems
does not appear to be used (omnibus-gitlab!1707 (merged)). I noticed that hundreds of files are being opened after:
2488 execve("/opt/gitlab/embedded/bin/ruby", ["ruby", "/opt/gitlab/embedded/service/gitaly-ruby/gitlab-shell/hooks/update", "refs/heads/sh-stanhu-test2", "a4085b9023ebf0efcee1daef71f08cc5d
d75128f", "53adc2283646faedcc9da6863adb738991e94780"], 0x7ffc5f42ed50 /* 24 vars */) = 0
We may be able to solve this in Omnibus by just replacing the shebang:
#!/opt/gitlab/embedded/bin/ruby --disable-gems
Note that this does NOT work because Linux doesn't support multiple arguments in a shebang:
#!/usr/bin/env ruby --disable-gems
This may not be necessary once we move the hooks to Golang, though, but this is an immediate performance win.