Commit 1c8bac85 authored by Rémy Coutable's avatar Rémy Coutable

Merge branch 'alberts-keep-gitaly-bundle-path' into 'master'

Fix gitaly bundle install flags

See merge request gitlab-org/gitlab!58217
parents 979bf45b 77f41fff
......@@ -17,24 +17,29 @@ Usage: rake "gitlab:gitaly:install[/installation/dir,/storage/path]")
checkout_or_clone_version(version: version, repo: args.repo, target_dir: args.dir, clone_opts: %w[--depth 1])
command = []
_, status = Gitlab::Popen.popen(%w[which gmake])
command << (status == 0 ? 'gmake' : 'make')
if Rails.env.test?
command.push(
'BUNDLE_FLAGS=--no-deployment',
"GEM_HOME=#{Bundler.bundle_path}")
end
storage_paths = { 'default' => args.storage_path }
Gitlab::SetupHelper::Gitaly.create_configuration(args.dir, storage_paths)
# In CI we run scripts/gitaly-test-build
next if ENV['CI'].present?
Dir.chdir(args.dir) do
# In CI we run scripts/gitaly-test-build instead of this command
unless ENV['CI'].present?
Bundler.with_original_env { Gitlab::Popen.popen(command, nil, { "RUBYOPT" => nil, "BUNDLE_GEMFILE" => nil }) }
Bundler.with_original_env do
env = { "RUBYOPT" => nil, "BUNDLE_GEMFILE" => nil }
if Rails.env.test?
env["GEM_HOME"] = Bundler.bundle_path.to_s
env["BUNDLE_DEPLOYMENT"] = 'false'
end
Gitlab::Popen.popen([make_cmd], nil, env)
end
end
end
def make_cmd
_, status = Gitlab::Popen.popen(%w[which gmake])
status == 0 ? 'gmake' : 'make'
end
end
end
......@@ -41,6 +41,7 @@ RSpec.describe 'gitlab:gitaly namespace rake task' do
describe 'checkout or clone' do
before do
stub_env('CI', false)
expect(Dir).to receive(:chdir).with(clone_path)
end
......@@ -86,18 +87,14 @@ RSpec.describe 'gitlab:gitaly namespace rake task' do
end
context 'when Rails.env is test' do
let(:command) do
%W[make
BUNDLE_FLAGS=--no-deployment
GEM_HOME=#{Bundler.bundle_path}]
end
let(:command) { %w[make] }
before do
stub_rails_env('test')
end
it 'calls make in the gitaly directory with --no-deployment flag for bundle' do
expect(Gitlab::Popen).to receive(:popen).with(command, nil, { "BUNDLE_GEMFILE" => nil, "RUBYOPT" => nil }).and_return(true)
it 'calls make in the gitaly directory with BUNDLE_DEPLOYMENT and GEM_HOME variables' do
expect(Gitlab::Popen).to receive(:popen).with(command, nil, { "BUNDLE_GEMFILE" => nil, "RUBYOPT" => nil, "BUNDLE_DEPLOYMENT" => 'false', "GEM_HOME" => Bundler.bundle_path.to_s }).and_return(true)
subject
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment