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]") ...@@ -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]) 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 } storage_paths = { 'default' => args.storage_path }
Gitlab::SetupHelper::Gitaly.create_configuration(args.dir, storage_paths) 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 Dir.chdir(args.dir) do
# In CI we run scripts/gitaly-test-build instead of this command Bundler.with_original_env do
unless ENV['CI'].present? env = { "RUBYOPT" => nil, "BUNDLE_GEMFILE" => nil }
Bundler.with_original_env { Gitlab::Popen.popen(command, nil, { "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 end
end end
def make_cmd
_, status = Gitlab::Popen.popen(%w[which gmake])
status == 0 ? 'gmake' : 'make'
end
end end
end end
...@@ -41,6 +41,7 @@ RSpec.describe 'gitlab:gitaly namespace rake task' do ...@@ -41,6 +41,7 @@ RSpec.describe 'gitlab:gitaly namespace rake task' do
describe 'checkout or clone' do describe 'checkout or clone' do
before do before do
stub_env('CI', false)
expect(Dir).to receive(:chdir).with(clone_path) expect(Dir).to receive(:chdir).with(clone_path)
end end
...@@ -86,18 +87,14 @@ RSpec.describe 'gitlab:gitaly namespace rake task' do ...@@ -86,18 +87,14 @@ RSpec.describe 'gitlab:gitaly namespace rake task' do
end end
context 'when Rails.env is test' do context 'when Rails.env is test' do
let(:command) do let(:command) { %w[make] }
%W[make
BUNDLE_FLAGS=--no-deployment
GEM_HOME=#{Bundler.bundle_path}]
end
before do before do
stub_rails_env('test') stub_rails_env('test')
end end
it 'calls make in the gitaly directory with --no-deployment flag for bundle' do 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 }).and_return(true) 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 subject
end 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