2017-03-13 10:04:46 -04:00
|
|
|
namespace :gitlab do
|
|
|
|
namespace :gitaly do
|
|
|
|
desc "GitLab | Install or upgrade gitaly"
|
2018-08-09 01:08:09 -04:00
|
|
|
task :install, [:dir, :storage_path, :repo] => :gitlab_environment do |t, args|
|
2017-03-13 10:04:46 -04:00
|
|
|
warn_user_is_not_gitlab
|
2018-01-11 11:34:01 -05:00
|
|
|
|
2018-08-09 01:08:09 -04:00
|
|
|
unless args.dir.present? && args.storage_path.present?
|
|
|
|
abort %(Please specify the directory where you want to install gitaly and the path for the default storage
|
|
|
|
Usage: rake "gitlab:gitaly:install[/installation/dir,/storage/path]")
|
2017-03-13 10:04:46 -04:00
|
|
|
end
|
2018-01-11 11:34:01 -05:00
|
|
|
|
2017-05-02 12:58:37 -04:00
|
|
|
args.with_defaults(repo: 'https://gitlab.com/gitlab-org/gitaly.git')
|
2017-03-13 10:04:46 -04:00
|
|
|
|
2017-04-10 19:15:48 -04:00
|
|
|
version = Gitlab::GitalyClient.expected_server_version
|
2017-03-13 10:04:46 -04:00
|
|
|
|
2017-05-02 12:58:37 -04:00
|
|
|
checkout_or_clone_version(version: version, repo: args.repo, target_dir: args.dir)
|
2017-03-13 10:04:46 -04:00
|
|
|
|
2017-11-21 12:45:36 -05:00
|
|
|
command = %w[/usr/bin/env -u RUBYOPT -u BUNDLE_GEMFILE]
|
|
|
|
|
2017-03-13 10:04:46 -04:00
|
|
|
_, status = Gitlab::Popen.popen(%w[which gmake])
|
2017-11-21 12:45:36 -05:00
|
|
|
command << (status.zero? ? 'gmake' : 'make')
|
2017-08-10 12:24:44 -04:00
|
|
|
|
2018-01-23 12:21:57 -05:00
|
|
|
if Rails.env.test?
|
|
|
|
command.push(
|
|
|
|
'BUNDLE_FLAGS=--no-deployment',
|
|
|
|
"BUNDLE_PATH=#{Bundler.bundle_path}")
|
|
|
|
end
|
2017-03-13 10:04:46 -04:00
|
|
|
|
2018-08-09 01:08:09 -04:00
|
|
|
storage_paths = { 'default' => args.storage_path }
|
|
|
|
Gitlab::SetupHelper.create_gitaly_configuration(args.dir, storage_paths)
|
2017-03-13 10:04:46 -04:00
|
|
|
Dir.chdir(args.dir) do
|
2017-07-31 09:17:14 -04:00
|
|
|
# In CI we run scripts/gitaly-test-build instead of this command
|
|
|
|
unless ENV['CI'].present?
|
2017-11-21 12:45:36 -05:00
|
|
|
Bundler.with_original_env { run_command!(command) }
|
2017-07-31 09:17:14 -04:00
|
|
|
end
|
2017-03-13 10:04:46 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|