Skip to content

Disable RubyGems in gitlab-shell scripts for performance

Stan Hu requested to merge sh-disable-rubygems-for-gitlab-shell into master

By default, RubyGems is enabled, which causes the Ruby interpreter to load 600+ additional files at startup when gitlab-shell is designed not to use any external gems.

We tried to make this part of gitlab-shell source, but had to revert https://gitlab.com/gitlab-org/gitlab-shell/merge_requests/141 because it turns out Linux kernels don't allow shebangs with multiple arguments (e.g. #!/bin/env ruby --disable-gems). This is the simplest method to get it to work. Source installs will just be a bit slower unless this flag is set to the default via RUBYOPT or compiler flag.

Edited by Stan Hu

Merge request reports