allure-report-publisher 1.7.0 → 1.8.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5cb9687cfe5fe4cacc4b499e4db1837f336013d2636af2d25e332c31d2ebd43c
4
- data.tar.gz: 3f095d105ba5380a7be579a0497c3759e0eacc5097df618f5c7e891626c12b52
3
+ metadata.gz: 4115ac96bf1ba67b88667f692f4d679badba58b771446fc6b31d814aee152367
4
+ data.tar.gz: 4d3b7cf9834063ee9ccac56bcb1c81fe0b690a369929230255b7715106b43bc2
5
5
  SHA512:
6
- metadata.gz: ea513f8420524a5e4da5fcd1a1045d9111b64ad40ccf7d6d42e079855fbfa108ae97896159b8cff71d82a582b904122f7d9d74458707ada1ce21f982debc8607
7
- data.tar.gz: f353025f1f65daa48427001d5126ad7aa8e2f5ed4a14293d2fc3a002d6565a1be6fb4244d462cd243b0718cc48123fa7c3fc15d4f63c46f45c915ef5e8555759
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
@@ -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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Publisher
4
- VERSION = "1.7.0"
4
+ VERSION = "1.8.0"
5
5
  end
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.7.0
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-10-29 00:00:00.000000000 Z
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
@@ -121,7 +121,7 @@ dependencies:
121
121
  version: '4.21'
122
122
  - - "<"
123
123
  - !ruby/object:Gem::Version
124
- version: '8.0'
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: '8.0'
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