2017-08-17 22:00:37 +05:30
|
|
|
namespace :gitlab do
|
|
|
|
namespace :workhorse do
|
2020-03-13 15:44:24 +05:30
|
|
|
desc "GitLab | Workhorse | Install or upgrade gitlab-workhorse"
|
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
|
|
|
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 gitlab-workhorse:\n rake "gitlab:workhorse:install[/home/git/gitlab-workhorse]")
|
|
|
|
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/gitlab-workhorse.git')
|
|
|
|
|
|
|
|
version = Gitlab::Workhorse.version
|
|
|
|
|
2020-05-24 23:13:21 +05:30
|
|
|
checkout_or_clone_version(version: version, repo: args.repo, target_dir: args.dir, clone_opts: %w[--depth 1])
|
2017-08-17 22:00:37 +05:30
|
|
|
|
|
|
|
_, status = Gitlab::Popen.popen(%w[which gmake])
|
|
|
|
command = status.zero? ? 'gmake' : 'make'
|
|
|
|
|
|
|
|
Dir.chdir(args.dir) do
|
|
|
|
run_command!([command])
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|