debian-mirror-gitlab/lib/tasks/gitlab/gitaly.rake

52 lines
1.7 KiB
Ruby
Raw Normal View History

2017-08-17 22:00:37 +05:30
namespace :gitlab do
namespace :gitaly do
desc "GitLab | Install or upgrade gitaly"
2018-03-17 18:26:18 +05:30
task :install, [:dir, :repo] => :gitlab_environment do |t, args|
2017-08-17 22:00:37 +05:30
require 'toml'
warn_user_is_not_gitlab
2018-03-17 18:26:18 +05:30
2017-08-17 22:00:37 +05:30
unless args.dir.present?
abort %(Please specify the directory where you want to install gitaly:\n rake "gitlab:gitaly:install[/home/git/gitaly]")
end
2018-03-17 18:26:18 +05:30
2017-08-17 22:00:37 +05:30
args.with_defaults(repo: 'https://gitlab.com/gitlab-org/gitaly.git')
version = Gitlab::GitalyClient.expected_server_version
checkout_or_clone_version(version: version, repo: args.repo, target_dir: args.dir)
2018-03-17 18:26:18 +05:30
command = %w[/usr/bin/env -u RUBYOPT -u BUNDLE_GEMFILE]
2017-08-17 22:00:37 +05:30
_, status = Gitlab::Popen.popen(%w[which gmake])
2018-03-17 18:26:18 +05:30
command << (status.zero? ? 'gmake' : 'make')
if Rails.env.test?
command.push(
'BUNDLE_FLAGS=--no-deployment',
"BUNDLE_PATH=#{Bundler.bundle_path}")
end
2017-08-17 22:00:37 +05:30
2018-03-17 18:26:18 +05:30
Gitlab::SetupHelper.create_gitaly_configuration(args.dir)
2017-08-17 22:00:37 +05:30
Dir.chdir(args.dir) do
2017-09-10 17:25:29 +05:30
# In CI we run scripts/gitaly-test-build instead of this command
unless ENV['CI'].present?
2018-03-17 18:26:18 +05:30
Bundler.with_original_env { run_command!(command) }
2017-09-10 17:25:29 +05:30
end
2017-08-17 22:00:37 +05:30
end
end
desc "GitLab | Print storage configuration in TOML format"
task storage_config: :environment do
require 'toml'
puts "# Gitaly storage configuration generated from #{Gitlab.config.source} on #{Time.current.to_s(:long)}"
puts "# This is in TOML format suitable for use in Gitaly's config.toml file."
2017-09-10 17:25:29 +05:30
# Exclude gitaly-ruby configuration because that depends on the gitaly
# installation directory.
2018-03-17 18:26:18 +05:30
puts Gitlab::SetupHelper.gitaly_configuration_toml('', gitaly_ruby: false)
2017-08-17 22:00:37 +05:30
end
end
end