Module: TestBoosters::InsightsUploader

Defined in:
lib/test_boosters/insights_uploader.rb

Class Method Summary collapse

Class Method Details

.insights_urlObject



13
14
15
16
17
18
19
20
21
# File 'lib/test_boosters/insights_uploader.rb', line 13

def insights_url
  params = {
    :project_hash_id => ENV["SEMAPHORE_PROJECT_UUID"],
    :build_hash_id => ENV["SEMAPHORE_EXECUTABLE_UUID"],
    :job_hash_id => ENV["SEMAPHORE_JOB_UUID"]
  }

  "https://insights-receiver.semaphoreci.com/job_reports?#{::URI.encode_www_form(params)}"
end

.upload(booster_type, file) ⇒ Object



5
6
7
8
9
10
11
# File 'lib/test_boosters/insights_uploader.rb', line 5

def upload(booster_type, file)
  return unless File.exist?(file)

  cmd = "http POST '#{insights_url}' #{booster_type}:=@#{file}"

  TestBoosters::Shell.execute("#{cmd} > ~/insights_uploader.log", :silent => true)
end