module TestBoosters::InsightsUploader

Public Instance Methods

insights_url() click to toggle source
# 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) click to toggle source
# File lib/test_boosters/insights_uploader.rb, line 5
def upload(booster_type, file)
  return unless ENV['TB_UPLOAD_INSIGHTS']

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

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