Class: Semaphore::InsightsUploader

Inherits:
Object
  • Object
show all
Defined in:
lib/test_boosters/insights_uploader.rb

Instance Method Summary collapse

Constructor Details

#initializeInsightsUploader

Returns a new instance of InsightsUploader.



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

def initialize
  @project_hash_id = ENV["SEMAPHORE_PROJECT_UUID"]
  @build_hash_id = ENV["SEMAPHORE_EXECUTABLE_UUID"]
  @job_hash_id = ENV["SEMAPHORE_JOB_UUID"]
end

Instance Method Details

#upload(booster_type, file) ⇒ Object



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

def upload(booster_type, file)
  url = "https://insights-receiver.semaphoreci.com/job_reports" +
        "?job_hash_id=#{@job_hash_id}" +
        "&build_hash_id=#{@build_hash_id}" +
        "&project_hash_id=#{@project_hash_id}"
  cmd = "http POST '#{url}' #{booster_type}:=@#{file}"

  Semaphore.execute(cmd)
end