allure-report-publisher 0.3.0 → 0.3.5
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 420438541bb271acbd5087eeb32afa461f9970d6fea36bd8b7394ac7392a5364
|
4
|
+
data.tar.gz: 762b5f3cdc21a57aa4dcfca924bac0cb5138ecb85c6bd154bffc9d92c24bc8bc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b348c695ea4c51981aa0c02f1a7172ec10789109adfb9ad11262612e394694b0d15ef82fbfaba85e4fe3c7d8e2407b6a17afce78eeeabe94e41b271da62de983
|
7
|
+
data.tar.gz: 39fa239c54ea236ae902e1cf203bbb643495c94f140d2d06e8e3a1c37b408b2c8dac1ff6acc839fe4fa30cc7ef1ebcc5a69c7f47e4096949d88dd6c7592abeaa
|
data/README.md
CHANGED
@@ -50,6 +50,7 @@ Options:
|
|
50
50
|
--update-pr=VALUE # Add report url to PR via comment or description update. Required: false: (comment/description)
|
51
51
|
--[no-]copy-latest # Keep copy of latest report at base prefix path, default: false
|
52
52
|
--[no-]color # Toggle color output, default: false
|
53
|
+
--[no-]ignore-missing-results # Ignore missing allure results, default: false
|
53
54
|
--help, -h # Print this help
|
54
55
|
|
55
56
|
Examples:
|
@@ -65,6 +66,12 @@ Multiple cloud storage providers are supported
|
|
65
66
|
|
66
67
|
Requires environment variables `AWS_ACCESS_KEY_ID`, `AWS_SECRET_ACCESS_KEY` or credentials file `~/.aws/credentials`
|
67
68
|
|
69
|
+
Additional configuration:
|
70
|
+
|
71
|
+
- `AWS_REGION`: configure s3 region, default: `us-east-1`
|
72
|
+
- `AWS_FORCE_PATH_STYLE`: when set to true, the bucket name is always left in the request URI and never moved to the host as a sub-domain, default: `false`
|
73
|
+
- `AWS_ENDPOINT`: custom s3 endpoint when used with other s3 compatible storage
|
74
|
+
|
68
75
|
## Google Cloud Storage
|
69
76
|
|
70
77
|
Requires on of the following environment variables.
|
@@ -31,6 +31,10 @@ module Publisher
|
|
31
31
|
type: :boolean,
|
32
32
|
default: false,
|
33
33
|
desc: "Toggle color output"
|
34
|
+
option :ignore_missing_results,
|
35
|
+
type: :boolean,
|
36
|
+
default: false,
|
37
|
+
desc: "Ignore missing allure results"
|
34
38
|
|
35
39
|
example [
|
36
40
|
"s3 --results-glob='path/to/allure-result/**/*' --bucket=my-bucket",
|
@@ -38,10 +42,11 @@ module Publisher
|
|
38
42
|
]
|
39
43
|
|
40
44
|
def call(**args)
|
41
|
-
validate_args(args)
|
42
|
-
validate_result_files(args[:results_glob])
|
43
45
|
Helpers.pastel(force_color: args[:color] || nil)
|
44
46
|
|
47
|
+
validate_args(args)
|
48
|
+
validate_result_files(args[:results_glob], args[:ignore_missing_results])
|
49
|
+
|
45
50
|
uploader = uploaders(args[:type]).new(**args.slice(:results_glob, :bucket, :prefix, :copy_latest, :update_pr))
|
46
51
|
|
47
52
|
log("Generating allure report")
|
@@ -82,8 +87,11 @@ module Publisher
|
|
82
87
|
#
|
83
88
|
# @param [String] results_glob
|
84
89
|
# @return [void]
|
85
|
-
def validate_result_files(results_glob)
|
86
|
-
Dir.glob(results_glob).empty?
|
90
|
+
def validate_result_files(results_glob, ignore)
|
91
|
+
return unless Dir.glob(results_glob).empty?
|
92
|
+
|
93
|
+
log("Glob '#{results_glob}' did not match any files!", ignore ? :yellow : :red)
|
94
|
+
exit(ignore ? 0 : 1)
|
87
95
|
end
|
88
96
|
end
|
89
97
|
end
|
@@ -74,11 +74,11 @@ module Publisher
|
|
74
74
|
# @return [Gitlab::Client]
|
75
75
|
def client
|
76
76
|
@client ||= begin
|
77
|
-
raise("Missing GITLAB_AUTH_TOKEN environment variable!") unless
|
77
|
+
raise("Missing GITLAB_AUTH_TOKEN environment variable!") unless env("GITLAB_AUTH_TOKEN")
|
78
78
|
|
79
79
|
::Gitlab::Client.new(
|
80
80
|
endpoint: "#{server_url}/api/v4",
|
81
|
-
private_token:
|
81
|
+
private_token: env("GITLAB_AUTH_TOKEN")
|
82
82
|
)
|
83
83
|
end
|
84
84
|
end
|
@@ -87,67 +87,77 @@ module Publisher
|
|
87
87
|
#
|
88
88
|
# @return [String]
|
89
89
|
def allure_project
|
90
|
-
@allure_project ||=
|
90
|
+
@allure_project ||= env("ALLURE_PROJECT_PATH")
|
91
91
|
end
|
92
92
|
|
93
93
|
# Custom mr iid name
|
94
94
|
#
|
95
95
|
# @return [String]
|
96
96
|
def allure_mr_iid
|
97
|
-
@allure_mr_iid ||=
|
97
|
+
@allure_mr_iid ||= env("ALLURE_MERGE_REQUEST_IID")
|
98
98
|
end
|
99
99
|
|
100
100
|
# Custom sha
|
101
101
|
#
|
102
102
|
# @return [String]
|
103
103
|
def allure_sha
|
104
|
-
@allure_sha ||=
|
104
|
+
@allure_sha ||= env("ALLURE_COMMIT_SHA")
|
105
105
|
end
|
106
106
|
|
107
107
|
# Gitlab project path
|
108
108
|
#
|
109
109
|
# @return [String]
|
110
110
|
def project
|
111
|
-
@project ||= allure_project ||
|
111
|
+
@project ||= allure_project || env("CI_MERGE_REQUEST_PROJECT_PATH") || env("CI_PROJECT_PATH")
|
112
112
|
end
|
113
113
|
|
114
114
|
# Merge request iid
|
115
115
|
#
|
116
116
|
# @return [Integer]
|
117
117
|
def mr_iid
|
118
|
-
@mr_iid ||= allure_mr_iid ||
|
118
|
+
@mr_iid ||= allure_mr_iid || env("CI_MERGE_REQUEST_IID")
|
119
119
|
end
|
120
120
|
|
121
121
|
# Server url
|
122
122
|
#
|
123
123
|
# @return [String]
|
124
124
|
def server_url
|
125
|
-
@server_url ||=
|
125
|
+
@server_url ||= env("CI_SERVER_URL")
|
126
126
|
end
|
127
127
|
|
128
128
|
# Build url
|
129
129
|
#
|
130
130
|
# @return [String]
|
131
131
|
def build_url
|
132
|
-
@build_url ||=
|
132
|
+
@build_url ||= env("CI_PIPELINE_URL")
|
133
133
|
end
|
134
134
|
|
135
135
|
# Job name
|
136
136
|
#
|
137
137
|
# @return [String]
|
138
138
|
def build_name
|
139
|
-
@build_name ||=
|
139
|
+
@build_name ||= env(ALLURE_JOB_NAME) || env("CI_JOB_NAME")
|
140
140
|
end
|
141
141
|
|
142
142
|
# Commit sha url
|
143
143
|
#
|
144
144
|
# @return [String]
|
145
145
|
def sha_url
|
146
|
-
sha = allure_sha ||
|
146
|
+
sha = allure_sha || env("CI_MERGE_REQUEST_SOURCE_BRANCH_SHA") || env("CI_COMMIT_SHA")
|
147
147
|
short_sha = sha[0..7]
|
148
148
|
|
149
149
|
"[#{short_sha}](#{server_url}/#{project}/-/merge_requests/#{mr_iid}/diffs?commit_id=#{sha})"
|
150
150
|
end
|
151
|
+
|
152
|
+
# Return non empty environment variable value
|
153
|
+
#
|
154
|
+
# @param [String] name
|
155
|
+
# @return [String, nil]
|
156
|
+
def env(name)
|
157
|
+
return unless ENV[name] && !ENV[name].empty?
|
158
|
+
|
159
|
+
ENV[name]
|
160
|
+
end
|
151
161
|
end
|
152
162
|
end
|
153
163
|
end
|
@@ -11,7 +11,7 @@ module Publisher
|
|
11
11
|
#
|
12
12
|
# @return [Aws::S3::Client]
|
13
13
|
def client
|
14
|
-
@client ||= Aws::S3::Client.new(
|
14
|
+
@client ||= Aws::S3::Client.new(client_args)
|
15
15
|
rescue Aws::Sigv4::Errors::MissingCredentialsError
|
16
16
|
raise(<<~MSG.strip)
|
17
17
|
missing aws credentials, provide credentials with one of the following options:
|
@@ -20,6 +20,14 @@ module Publisher
|
|
20
20
|
MSG
|
21
21
|
end
|
22
22
|
|
23
|
+
def client_args
|
24
|
+
@client_args ||= {
|
25
|
+
region: ENV["AWS_REGION"] || "us-east-1",
|
26
|
+
force_path_style: ENV["AWS_FORCE_PATH_STYLE"] == "true",
|
27
|
+
endpoint: ENV["AWS_ENDPOINT"]
|
28
|
+
}.compact
|
29
|
+
end
|
30
|
+
|
23
31
|
# Report url
|
24
32
|
#
|
25
33
|
# @return [String]
|
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: 0.3.
|
4
|
+
version: 0.3.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrejs Cunskis
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-07-02 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.97.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.97.0
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
34
|
name: dry-cli
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|