Skip to content

Speed up operations performed by gitlab-shell

Stan Hu requested to merge sh-optimize-project-creation into master

In gitlab-org/gitlab-ce#34533, we observed that shelling out to gitlab-shell would be really slow because gitlab-shell would take 1+ seconds to search the GEM_PATH to load dependencies. However, this work is totally unnecessary since gitlab-shell is designed to be self-contained and not rely on gems.

The key change here is to use Bundler.with_original_env to give gitlab-shell a clean environment, not one inherited by unicorn. We use Bundler.with_clean_env in lib/gitlab/git/hook.rb, but according to https://github.com/bundler/bundler/blob/master/lib/bundler.rb#L258, that method is now deprecated.

The result of this change is that gitlab-shell project creation that used to take 1+ seconds on a local disk now takes 200 ms.

Edited by Stan Hu

Merge request reports