allure-report-publisher 1.6.2 → 1.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +6 -0
- data/lib/allure_report_publisher/lib/helpers/helpers.rb +1 -1
- data/lib/allure_report_publisher/lib/helpers/url_section_builder.rb +2 -2
- data/lib/allure_report_publisher/lib/parser.rb +59 -0
- data/lib/allure_report_publisher/lib/providers/_provider.rb +2 -1
- data/lib/allure_report_publisher/lib/report_generator.rb +17 -1
- data/lib/allure_report_publisher/lib/uploaders/_uploader.rb +9 -4
- data/lib/allure_report_publisher/version.rb +1 -1
- metadata +8 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4115ac96bf1ba67b88667f692f4d679badba58b771446fc6b31d814aee152367
|
4
|
+
data.tar.gz: 4d3b7cf9834063ee9ccac56bcb1c81fe0b690a369929230255b7715106b43bc2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f904533b0677eeb3222689567663e26c828d6f14410a91cb87b031dc5b66b83db3c71becc56049c7ff43f3ea6c09f14800544e8530134aad0283a8a34b66179d
|
7
|
+
data.tar.gz: 4cab5ad6c6965715e8a1a33a47cbe040bab2724f57225a3d7cd7fc99e7c1e8499f9eef7d8a4f671dc19468d988077f43b64fbaee77e1956ac9da95f8629f1519
|
data/README.md
CHANGED
@@ -63,6 +63,12 @@ Examples:
|
|
63
63
|
allure-report-publisher upload gcs --results-glob='paths/to/**/allure-results' --bucket=my-bucket --prefix=my-project/prs
|
64
64
|
```
|
65
65
|
|
66
|
+
## Environment variables
|
67
|
+
|
68
|
+
All named options can be configured via environment variables. Environment variables are prefixed with `ALLURE_REPORT_` and uppercased.
|
69
|
+
|
70
|
+
Example: `--results-glob` can be configured via `ALLURE_REPORT_RESULTS_GLOB`
|
71
|
+
|
66
72
|
# Storage providers
|
67
73
|
|
68
74
|
Multiple cloud storage providers are supported
|
@@ -123,7 +123,7 @@ module Publisher
|
|
123
123
|
|
124
124
|
unless status.success?
|
125
125
|
err_msg = "Command '#{loggable_command}' failed!\n#{output}"
|
126
|
-
err_msg =
|
126
|
+
err_msg = err_msg.gsub(mask, "***") if mask
|
127
127
|
raise(ShellCommandFailure, err_msg)
|
128
128
|
end
|
129
129
|
|
@@ -3,8 +3,8 @@ module Publisher
|
|
3
3
|
# Urls section builder
|
4
4
|
#
|
5
5
|
class UrlSectionBuilder
|
6
|
-
DESCRIPTION_PATTERN = /<!-- allure -->[\s\S]+<!-- allurestop
|
7
|
-
JOBS_PATTERN = /<!-- jobs -->\n([\s\S]+)\n<!-- jobs
|
6
|
+
DESCRIPTION_PATTERN = /<!-- allure -->[\s\S]+<!-- allurestop -->/
|
7
|
+
JOBS_PATTERN = /<!-- jobs -->\n([\s\S]+)\n<!-- jobs -->/
|
8
8
|
|
9
9
|
# Url section builder
|
10
10
|
#
|
@@ -0,0 +1,59 @@
|
|
1
|
+
module Dry
|
2
|
+
class CLI
|
3
|
+
# Parser overload to support loading all options from environment variables
|
4
|
+
#
|
5
|
+
module Parser
|
6
|
+
class InvalidEnvValue < StandardError; end
|
7
|
+
|
8
|
+
class << self
|
9
|
+
def call(command, arguments, prog_name)
|
10
|
+
original_arguments = arguments.dup
|
11
|
+
parsed_options = {}
|
12
|
+
|
13
|
+
OptionParser.new do |opts|
|
14
|
+
command.options.each do |option|
|
15
|
+
opts.on(*option.parser_options) do |value|
|
16
|
+
parsed_options[option.name.to_sym] = value
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
opts.on_tail("-h", "--help") do
|
21
|
+
return Result.help
|
22
|
+
end
|
23
|
+
end.parse!(arguments)
|
24
|
+
|
25
|
+
parsed_options = command
|
26
|
+
.default_params
|
27
|
+
.merge(load_options(command.options, parsed_options))
|
28
|
+
|
29
|
+
parse_required_params(command, arguments, prog_name, parsed_options)
|
30
|
+
rescue ::OptionParser::ParseError, InvalidEnvValue => e
|
31
|
+
return Result.failure(e.message) if e.is_a?(InvalidEnvValue)
|
32
|
+
|
33
|
+
Result.failure("ERROR: \"#{prog_name}\" was called with arguments \"#{original_arguments.join(' ')}\"")
|
34
|
+
end
|
35
|
+
|
36
|
+
private
|
37
|
+
|
38
|
+
def load_options(options, parsed_options)
|
39
|
+
options.each_with_object({}) do |option, opts|
|
40
|
+
parsed_opt = parsed_options[option.name.to_sym]
|
41
|
+
next opts[option.name.to_sym] = parsed_opt unless parsed_opt.nil?
|
42
|
+
|
43
|
+
opts[option.name.to_sym] = option_from_env(option)
|
44
|
+
end.compact
|
45
|
+
end
|
46
|
+
|
47
|
+
def option_from_env(option) # rubocop:disable Metrics/CyclomaticComplexity
|
48
|
+
name = "ALLURE_REPORT_#{option.name.to_s.upcase}"
|
49
|
+
value = ENV[name]
|
50
|
+
return if value.nil? || value.empty?
|
51
|
+
return if option.boolean? && !%w[true false].include?(value)
|
52
|
+
raise(InvalidEnvValue, "#{name} contains invalid value: '#{value}'") if option.values&.none?(value)
|
53
|
+
|
54
|
+
option.boolean? ? value == "true" : value
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
@@ -52,9 +52,25 @@ module Publisher
|
|
52
52
|
log_debug("Generating allure report")
|
53
53
|
cmd = "allure generate --clean --output #{report_path} #{common_info_path} #{result_paths}"
|
54
54
|
out = execute_shell(cmd)
|
55
|
-
log_debug("Generated allure report. #{out}")
|
55
|
+
log_debug("Generated allure report. #{out}".strip)
|
56
|
+
|
57
|
+
deduplicate_executors
|
56
58
|
rescue StandardError => e
|
57
59
|
raise(AllureError, e.message)
|
58
60
|
end
|
61
|
+
|
62
|
+
# Remove duplicate entries from executors widget
|
63
|
+
# This is a workaround for making history work with multiple result paths
|
64
|
+
# allure-report requires executors.json in every results folder but it will create duplicate entries
|
65
|
+
# in executors widget of the final report
|
66
|
+
#
|
67
|
+
# @return [void]
|
68
|
+
def deduplicate_executors
|
69
|
+
executors_file = File.join(report_path, "widgets", "executors.json")
|
70
|
+
executors_json = JSON.parse(File.read(executors_file)).uniq
|
71
|
+
|
72
|
+
log_debug("Removing duplicate entries in '#{executors_file}'")
|
73
|
+
File.write(executors_file, JSON.generate(executors_json))
|
74
|
+
end
|
59
75
|
end
|
60
76
|
end
|
@@ -238,11 +238,16 @@ module Publisher
|
|
238
238
|
def add_executor_info
|
239
239
|
return unless ci_provider
|
240
240
|
|
241
|
-
json_path = "#{common_info_path}/#{EXECUTOR_JSON}"
|
242
241
|
json = ci_provider.executor_info.to_json
|
243
|
-
log_debug("Saving ci executor info")
|
244
|
-
|
245
|
-
|
242
|
+
log_debug("Saving ci executor info:\n#{JSON.pretty_generate(ci_provider.executor_info)}")
|
243
|
+
# allure-report will fail to pick up reportUrl in history tab if executor.json is not present alongside results
|
244
|
+
[common_info_path, *result_paths].each do |path|
|
245
|
+
file = File.join(path, EXECUTOR_JSON)
|
246
|
+
next log_debug("Skipping '#{file}', executor info already exists") if File.exist?(file)
|
247
|
+
|
248
|
+
File.write(File.join(path, EXECUTOR_JSON), json)
|
249
|
+
log_debug("Saved ci executor info to '#{file}'")
|
250
|
+
end
|
246
251
|
end
|
247
252
|
|
248
253
|
# Fetch allure report history
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: allure-report-publisher
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.8.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrejs Cunskis
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-11-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aws-sdk-s3
|
@@ -19,7 +19,7 @@ dependencies:
|
|
19
19
|
version: 1.93.1
|
20
20
|
- - "<"
|
21
21
|
- !ruby/object:Gem::Version
|
22
|
-
version: 1.
|
22
|
+
version: 1.137.0
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -29,7 +29,7 @@ dependencies:
|
|
29
29
|
version: 1.93.1
|
30
30
|
- - "<"
|
31
31
|
- !ruby/object:Gem::Version
|
32
|
-
version: 1.
|
32
|
+
version: 1.137.0
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
34
|
name: dry-cli
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
@@ -121,7 +121,7 @@ dependencies:
|
|
121
121
|
version: '4.21'
|
122
122
|
- - "<"
|
123
123
|
- !ruby/object:Gem::Version
|
124
|
-
version: '
|
124
|
+
version: '9.0'
|
125
125
|
type: :runtime
|
126
126
|
prerelease: false
|
127
127
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -131,7 +131,7 @@ dependencies:
|
|
131
131
|
version: '4.21'
|
132
132
|
- - "<"
|
133
133
|
- !ruby/object:Gem::Version
|
134
|
-
version: '
|
134
|
+
version: '9.0'
|
135
135
|
- !ruby/object:Gem::Dependency
|
136
136
|
name: parallel
|
137
137
|
requirement: !ruby/object:Gem::Requirement
|
@@ -219,6 +219,7 @@ files:
|
|
219
219
|
- lib/allure_report_publisher/lib/helpers/spinner.rb
|
220
220
|
- lib/allure_report_publisher/lib/helpers/summary.rb
|
221
221
|
- lib/allure_report_publisher/lib/helpers/url_section_builder.rb
|
222
|
+
- lib/allure_report_publisher/lib/parser.rb
|
222
223
|
- lib/allure_report_publisher/lib/providers/_provider.rb
|
223
224
|
- lib/allure_report_publisher/lib/providers/github.rb
|
224
225
|
- lib/allure_report_publisher/lib/providers/gitlab.rb
|
@@ -245,7 +246,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
245
246
|
requirements:
|
246
247
|
- - ">="
|
247
248
|
- !ruby/object:Gem::Version
|
248
|
-
version:
|
249
|
+
version: '3.0'
|
249
250
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
250
251
|
requirements:
|
251
252
|
- - ">="
|