summaryrefslogtreecommitdiff
path: root/lib/tasks/gitlab/workhorse.rake
blob: a00b02188cfa26e2bd12c2b43b46b4f5d6f9d585 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
namespace :gitlab do
  namespace :workhorse do
    desc "GitLab | Install or upgrade gitlab-workhorse"
    task :install, [:dir] => :environment do |t, args|
      warn_user_is_not_gitlab
      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

      version = Gitlab::Workhorse.version
      repo = 'https://gitlab.com/gitlab-org/gitlab-workhorse.git'

      checkout_or_clone_version(version: version, repo: repo, target_dir: args.dir)

      _, status = Gitlab::Popen.popen(%w[which gmake])
      command = status.zero? ? 'gmake' : 'make'

      Dir.chdir(args.dir) do
        run_command!([command])
      end
    end
  end
end