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, 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, 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)


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

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]
end

Instance Method Details

#executevoid

This method returns an undefined value.

Execute allure report generation and upload



46
47
48
49
# File 'lib/allure_report_publisher/lib/uploaders/_uploader.rb', line 46

def execute
  generate_report
  upload
end

#generate_reportvoid

This method returns an undefined value.

Generate allure report



54
55
56
57
58
59
# File 'lib/allure_report_publisher/lib/uploaders/_uploader.rb', line 54

def generate_report
  add_history
  add_executor_info

  report_generator.generate
end

#report_urlString

Report url

Returns:

  • (String)


85
86
87
# File 'lib/allure_report_publisher/lib/uploaders/_uploader.rb', line 85

def report_url
  raise("Not Implemented!")
end

#report_urlsHash<String, String>

Uploaded report urls

Returns:

  • (Hash<String, String>)

    uploaded report urls



73
74
75
76
77
78
# File 'lib/allure_report_publisher/lib/uploaders/_uploader.rb', line 73

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



64
65
66
67
68
# File 'lib/allure_report_publisher/lib/uploaders/_uploader.rb', line 64

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