Class: Publisher::Uploaders::Uploader

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Includes:
Helpers
Defined in:
lib/allure_report_publisher/lib/uploaders/_uploader.rb

Overview

Uploader implementation

Direct Known Subclasses

GCS, GitlabArtifacts, S3

Constant Summary collapse

EXECUTOR_JSON =
"executor.json".freeze
HISTORY =
[
  "categories-trend.json",
  "duration-trend.json",
  "history-trend.json",
  "history.json",
  "retry-trend.json"
].freeze

Instance Method Summary collapse

Methods included from Helpers

allure_cli?, colorize, debug_io, #env, #env_int, error, execute_shell, log, log_debug, logger, pastel, path, reset_debug_io!

Constructor Details

#initialize(**args) ⇒ Uploader

Uploader instance

Parameters:

  • args (Hash)

Options Hash (**args):

  • :result_paths (Array)
  • :bucket (String)
  • :prefix (String)
  • :base_url (String)
  • :copy_latest (String)
  • :report_name (String)
  • :parallel (Integer)
  • :output (String)


34
35
36
37
38
39
40
41
42
43
# File 'lib/allure_report_publisher/lib/uploaders/_uploader.rb', line 34

def initialize(**args)
  @result_paths = args[:result_paths]
  @bucket_name = args[:bucket]
  @prefix = args[:prefix]
  @base_url = args[:base_url]
  @copy_latest = ci_info && args[:copy_latest] # copy latest for ci only
  @report_name = args[:report_name]
  @parallel = args[:parallel]
  @report_path = args[:output]
end

Instance Method Details

#generate_report(extra_arguments = []) ⇒ void

This method returns an undefined value.

Generate allure report



48
49
50
51
52
53
# File 'lib/allure_report_publisher/lib/uploaders/_uploader.rb', line 48

def generate_report(extra_arguments = [])
  add_history
  add_executor_info

  report_generator.generate(extra_arguments)
end

#report_urlString

Report url

Returns:

  • (String)


79
80
81
# File 'lib/allure_report_publisher/lib/uploaders/_uploader.rb', line 79

def report_url
  raise("Not Implemented!")
end

#report_urlsHash<String, String>

Uploaded report urls

Returns:

  • (Hash<String, String>)

    uploaded report urls



67
68
69
70
71
72
# File 'lib/allure_report_publisher/lib/uploaders/_uploader.rb', line 67

def report_urls
  urls = { "Report url" => report_url }
  urls["Latest report url"] = latest_report_url if copy_latest

  urls
end

#uploadvoid

This method returns an undefined value.

Upload report to storage provider



58
59
60
61
62
# File 'lib/allure_report_publisher/lib/uploaders/_uploader.rb', line 58

def upload
  upload_history unless !run_id || copy_latest
  upload_report
  upload_latest_copy if copy_latest
end