Welcome to mirror list, hosted at ThFree Co, Russian Federation.

metrics_exporter.rake « gitlab « tasks « lib - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: d9dd80b8eeb22b61faa181642a8b7aec1a738e9e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# frozen_string_literal: true
require_relative Rails.root.join('metrics_server', 'dependencies')
require_relative Rails.root.join('metrics_server', 'metrics_server')

namespace :gitlab do
  namespace :metrics_exporter do
    REPO = 'https://gitlab.com/gitlab-org/gitlab-metrics-exporter.git'

    desc "GitLab | Metrics Exporter | Install or upgrade gitlab-metrics-exporter"
    task :install, [:dir] => :gitlab_environment do |t, args|
      unless args.dir.present?
        abort %(Please specify the directory where you want to install the exporter
Usage: rake "gitlab:metrics_exporter:install[/installation/dir]")
      end

      version = ENV['GITLAB_METRICS_EXPORTER_VERSION'] || MetricsServer.version
      make = Gitlab::Utils.which('gmake') || Gitlab::Utils.which('make')

      abort "Couldn't find a 'make' binary" unless make

      checkout_or_clone_version(version: version, repo: REPO, target_dir: args.dir, clone_opts: %w[--depth 1])

      Dir.chdir(args.dir) { run_command!([make]) }
    end
  end
end