Commit d49a6e7a authored by Stan Hu's avatar Stan Hu

Merge branch 'gitaly_install_env_fix' into 'master'

Fix gitaly install on systems where env doesn't support the -u flag

See merge request gitlab-org/gitlab!30791
parents 74c3997e ce5b43cd
...@@ -15,8 +15,7 @@ Usage: rake "gitlab:gitaly:install[/installation/dir,/storage/path]") ...@@ -15,8 +15,7 @@ Usage: rake "gitlab:gitaly:install[/installation/dir,/storage/path]")
checkout_or_clone_version(version: version, repo: args.repo, target_dir: args.dir) checkout_or_clone_version(version: version, repo: args.repo, target_dir: args.dir)
command = %w[/usr/bin/env -u RUBYOPT -u BUNDLE_GEMFILE] command = []
_, status = Gitlab::Popen.popen(%w[which gmake]) _, status = Gitlab::Popen.popen(%w[which gmake])
command << (status.zero? ? 'gmake' : 'make') command << (status.zero? ? 'gmake' : 'make')
...@@ -31,7 +30,7 @@ Usage: rake "gitlab:gitaly:install[/installation/dir,/storage/path]") ...@@ -31,7 +30,7 @@ Usage: rake "gitlab:gitaly:install[/installation/dir,/storage/path]")
Dir.chdir(args.dir) do Dir.chdir(args.dir) do
# In CI we run scripts/gitaly-test-build instead of this command # In CI we run scripts/gitaly-test-build instead of this command
unless ENV['CI'].present? unless ENV['CI'].present?
Bundler.with_original_env { run_command!(command) } Bundler.with_original_env { Gitlab::Popen.popen(command, nil, { "RUBYOPT" => nil, "BUNDLE_GEMFILE" => nil }) }
end end
end end
end end
......
...@@ -53,8 +53,6 @@ describe 'gitlab:gitaly namespace rake task' do ...@@ -53,8 +53,6 @@ describe 'gitlab:gitaly namespace rake task' do
end end
describe 'gmake/make' do describe 'gmake/make' do
let(:command_preamble) { %w[/usr/bin/env -u RUBYOPT -u BUNDLE_GEMFILE] }
before do before do
stub_env('CI', false) stub_env('CI', false)
FileUtils.mkdir_p(clone_path) FileUtils.mkdir_p(clone_path)
...@@ -69,7 +67,7 @@ describe 'gitlab:gitaly namespace rake task' do ...@@ -69,7 +67,7 @@ describe 'gitlab:gitaly namespace rake task' do
it 'calls gmake in the gitaly directory' do it 'calls gmake in the gitaly directory' do
expect(Gitlab::Popen).to receive(:popen).with(%w[which gmake]).and_return(['/usr/bin/gmake', 0]) expect(Gitlab::Popen).to receive(:popen).with(%w[which gmake]).and_return(['/usr/bin/gmake', 0])
expect(main_object).to receive(:run_command!).with(command_preamble + %w[gmake]).and_return(true) expect(Gitlab::Popen).to receive(:popen).with(%w[gmake], nil, { "BUNDLE_GEMFILE" => nil, "RUBYOPT" => nil }).and_return(true)
subject subject
end end
...@@ -82,7 +80,7 @@ describe 'gitlab:gitaly namespace rake task' do ...@@ -82,7 +80,7 @@ describe 'gitlab:gitaly namespace rake task' do
end end
it 'calls make in the gitaly directory' do it 'calls make in the gitaly directory' do
expect(main_object).to receive(:run_command!).with(command_preamble + %w[make]).and_return(true) expect(Gitlab::Popen).to receive(:popen).with(%w[make], nil, { "BUNDLE_GEMFILE" => nil, "RUBYOPT" => nil }).and_return(true)
subject subject
end end
...@@ -99,7 +97,7 @@ describe 'gitlab:gitaly namespace rake task' do ...@@ -99,7 +97,7 @@ describe 'gitlab:gitaly namespace rake task' do
end end
it 'calls make in the gitaly directory with --no-deployment flag for bundle' do it 'calls make in the gitaly directory with --no-deployment flag for bundle' do
expect(main_object).to receive(:run_command!).with(command_preamble + command).and_return(true) expect(Gitlab::Popen).to receive(:popen).with(command, nil, { "BUNDLE_GEMFILE" => nil, "RUBYOPT" => nil }).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