Module: TestBoosters::InsightsUploader

Defined in:
lib/test_boosters/insights_uploader.rb

Class Method Summary collapse

Class Method Details

.insights_urlObject



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

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
# File 'lib/test_boosters/insights_uploader.rb', line 5

def upload(booster_type, file)
  cmd = "http POST '#{insights_url}' #{booster_type}:=@#{file}"

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