allure-report-publisher 3.2.0 → 4.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +0 -2
- data/lib/allure_report_publisher/commands/upload.rb +2 -6
- data/lib/allure_report_publisher/lib/helpers/url_section_builder.rb +10 -15
- data/lib/allure_report_publisher/lib/providers/_provider.rb +0 -3
- data/lib/allure_report_publisher/lib/providers/gitlab.rb +9 -53
- data/lib/allure_report_publisher/lib/uploaders/s3.rb +25 -3
- data/lib/allure_report_publisher/version.rb +1 -1
- metadata +5 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 88a8af3196d423a0ee46ce8767c747d4cf4ba67619b68ae3bb828782ff2643c1
|
4
|
+
data.tar.gz: f91b7a7c58681a49c425bc37dca27e14c94b2fdd00d0c91253ec930ae79eab63
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 24ea145d15bc5968d653c4b1859f5870a8be44450fecad9c69779245e98ef9669f4ee920246f4279a5149888ac78e835396fa44e43cad948f43ac83a0578a6d4
|
7
|
+
data.tar.gz: e25c227fe4fdaddb073bf364fcbff7c71f7345449b336859b926f488d754c82aaf7f9d6a257fd74e341871f42b068823a8d4c3dc7b0e64a7c80551644b43eff9
|
data/README.md
CHANGED
@@ -5,7 +5,6 @@
|
|
5
5
|
![Workflow status](https://github.com/andrcuns/allure-report-publisher/workflows/Test/badge.svg)
|
6
6
|
[![Maintainability](https://api.codeclimate.com/v1/badges/210eaa4f74588fb08313/maintainability)](https://codeclimate.com/github/andrcuns/allure-report-publisher/maintainability)
|
7
7
|
[![Test Coverage](https://api.codeclimate.com/v1/badges/210eaa4f74588fb08313/test_coverage)](https://codeclimate.com/github/andrcuns/allure-report-publisher/test_coverage)
|
8
|
-
[![Test Report](https://img.shields.io/badge/report-allure-blue.svg)](https://storage.googleapis.com/allure-test-reports/allure-report-publisher/refs/heads/main/index.html)
|
9
8
|
|
10
9
|
Upload your report to a file storage of your choice.
|
11
10
|
|
@@ -57,7 +56,6 @@ Options:
|
|
57
56
|
--[no-]copy-latest # Keep copy of latest report at base prefix path, default: false
|
58
57
|
--[no-]color # Force color output
|
59
58
|
--[no-]ignore-missing-results # Ignore missing allure results, default: false
|
60
|
-
--[no-]unresolved-discussion-on-failure # Add an unresolved discussion comment on test failure. GitLab only, default: false
|
61
59
|
--[no-]debug # Print additional debug output, default: false
|
62
60
|
--help, -h # Print this help
|
63
61
|
|
@@ -76,10 +76,6 @@ module Publisher
|
|
76
76
|
type: :boolean,
|
77
77
|
default: false,
|
78
78
|
desc: "Ignore missing allure results"
|
79
|
-
option :unresolved_discussion_on_failure,
|
80
|
-
type: :boolean,
|
81
|
-
default: false,
|
82
|
-
desc: "Add an unresolved discussion comment on test failure. GitLab only"
|
83
79
|
option :debug,
|
84
80
|
type: :boolean,
|
85
81
|
default: false,
|
@@ -134,7 +130,6 @@ module Publisher
|
|
134
130
|
:collapse_summary,
|
135
131
|
:flaky_warning_status,
|
136
132
|
:summary_table_type,
|
137
|
-
:unresolved_discussion_on_failure,
|
138
133
|
:report_title
|
139
134
|
)
|
140
135
|
)
|
@@ -148,13 +143,14 @@ module Publisher
|
|
148
143
|
{
|
149
144
|
"s3" => Uploaders::S3,
|
150
145
|
"gcs" => Uploaders::GCS
|
151
|
-
}
|
146
|
+
}.fetch(uploader)
|
152
147
|
end
|
153
148
|
|
154
149
|
# Validate required args
|
155
150
|
#
|
156
151
|
# @return [void]
|
157
152
|
def validate_args
|
153
|
+
error("Unsupported cloud storage type! Supported types are: s3, gcs") unless %w[s3 gcs].include?(args[:type])
|
158
154
|
error("Missing argument --results-glob!") unless args[:results_glob]
|
159
155
|
error("Missing argument --bucket!") unless args[:bucket]
|
160
156
|
URI.parse(args[:base_url]) if args[:base_url]
|
@@ -4,7 +4,7 @@ module Publisher
|
|
4
4
|
#
|
5
5
|
class UrlSectionBuilder
|
6
6
|
DESCRIPTION_PATTERN = /<!-- allure -->[\s\S]+<!-- allurestop -->/
|
7
|
-
JOBS_PATTERN = /<!-- jobs
|
7
|
+
JOBS_PATTERN = /<!-- jobs -->(?<jobs>[\s\S]+)<!-- jobs -->/
|
8
8
|
|
9
9
|
# Url section builder
|
10
10
|
#
|
@@ -106,7 +106,7 @@ module Publisher
|
|
106
106
|
entry << "<summary>expand test summary</summary>\n" if collapse_summary
|
107
107
|
entry << summary.table if summary_type
|
108
108
|
entry << "</details>" if collapse_summary
|
109
|
-
entry << "<!-- #{build_name}
|
109
|
+
entry << "<!-- #{build_name} -->"
|
110
110
|
|
111
111
|
entry.join("\n")
|
112
112
|
end
|
@@ -116,36 +116,31 @@ module Publisher
|
|
116
116
|
#
|
117
117
|
# @return [RegExp]
|
118
118
|
def job_entry_pattern
|
119
|
-
@job_entry_pattern ||= /<!-- #{build_name}
|
119
|
+
@job_entry_pattern ||= /<!-- #{build_name} -->[\s\S]+<!-- #{build_name} -->/
|
120
120
|
end
|
121
121
|
|
122
122
|
# Allure report url section
|
123
123
|
#
|
124
124
|
# @return [String]
|
125
125
|
def url_section(job_entries: job_entry, separator: true)
|
126
|
-
|
127
|
-
<!-- allure
|
128
|
-
---
|
129
|
-
#{heading}
|
130
|
-
|
126
|
+
<<~BODY.strip
|
127
|
+
<!-- allure -->#{separator ? "\n---\n" : "\n"}#{heading}\n
|
131
128
|
<!-- jobs -->
|
132
129
|
#{job_entries}
|
133
130
|
<!-- jobs -->
|
134
131
|
<!-- allurestop -->
|
135
132
|
BODY
|
136
|
-
|
137
|
-
separator ? reports : reports.gsub("---\n", "")
|
138
133
|
end
|
139
134
|
|
140
135
|
# Return updated jobs section
|
141
136
|
#
|
142
|
-
# @param [String]
|
137
|
+
# @param [String] body
|
143
138
|
# @return [String]
|
144
|
-
def jobs_section(
|
145
|
-
jobs =
|
146
|
-
return jobs.gsub(job_entry_pattern, job_entry) if jobs.match?(job_entry_pattern)
|
139
|
+
def jobs_section(body)
|
140
|
+
jobs = body.match(JOBS_PATTERN)[:jobs]
|
141
|
+
return jobs.gsub(job_entry_pattern, job_entry).strip if jobs.match?(job_entry_pattern)
|
147
142
|
|
148
|
-
"#{jobs}\n#{job_entry}"
|
143
|
+
"#{jobs.strip}\n#{job_entry}"
|
149
144
|
end
|
150
145
|
end
|
151
146
|
end
|
@@ -33,7 +33,6 @@ module Publisher
|
|
33
33
|
# @option args [Symbol] :summary_table_type
|
34
34
|
# @option args [Boolean] :collapse_summay
|
35
35
|
# @option args [Boolean] :flaky_warning_status
|
36
|
-
# @option args [Boolean] :unresolved_discussion_on_failure
|
37
36
|
# @option args [String] :report_title
|
38
37
|
def initialize(**args)
|
39
38
|
@report_url = args[:report_url]
|
@@ -43,7 +42,6 @@ module Publisher
|
|
43
42
|
@summary_table_type = args[:summary_table_type]
|
44
43
|
@collapse_summary = args[:collapse_summary]
|
45
44
|
@flaky_warning_status = args[:flaky_warning_status]
|
46
|
-
@unresolved_discussion_on_failure = args[:unresolved_discussion_on_failure]
|
47
45
|
@report_title = args[:report_title]
|
48
46
|
end
|
49
47
|
|
@@ -65,7 +63,6 @@ module Publisher
|
|
65
63
|
:collapse_summary,
|
66
64
|
:summary_table_type,
|
67
65
|
:flaky_warning_status,
|
68
|
-
:unresolved_discussion_on_failure,
|
69
66
|
:report_title
|
70
67
|
|
71
68
|
# Current pull request description
|
@@ -38,23 +38,6 @@ module Publisher
|
|
38
38
|
@pr_description ||= client.merge_request(project, mr_iid).description
|
39
39
|
end
|
40
40
|
|
41
|
-
# Comment with alert text
|
42
|
-
#
|
43
|
-
# @return [Gitlab::ObjectifiedHash]
|
44
|
-
def alert_comment
|
45
|
-
@alert_comment ||= discussion&.notes&.detect do |note|
|
46
|
-
note.body.include?(alert_comment_text)
|
47
|
-
end
|
48
|
-
end
|
49
|
-
|
50
|
-
# Text for alert comment
|
51
|
-
#
|
52
|
-
# @return [String]
|
53
|
-
def alert_comment_text
|
54
|
-
@alert_comment_text ||=
|
55
|
-
env("ALLURE_FAILURE_ALERT_COMMENT") || "There are some test failures that need attention"
|
56
|
-
end
|
57
|
-
|
58
41
|
# Custom sha
|
59
42
|
#
|
60
43
|
# @return [String]
|
@@ -96,39 +79,19 @@ module Publisher
|
|
96
79
|
# @return [void]
|
97
80
|
def add_comment
|
98
81
|
create_or_update_comment
|
99
|
-
create_or_resolve_discussion
|
100
82
|
end
|
101
83
|
|
102
84
|
# Create or update comment with report url
|
103
85
|
#
|
104
86
|
# @return [void]
|
105
87
|
def create_or_update_comment
|
106
|
-
|
107
|
-
log_debug("
|
108
|
-
|
109
|
-
return client.edit_merge_request_note(
|
110
|
-
project,
|
111
|
-
mr_iid,
|
112
|
-
main_comment.id,
|
113
|
-
url_section_builder.comment_body(main_comment.body)
|
114
|
-
)
|
88
|
+
unless comment
|
89
|
+
log_debug("Creating comment with summary for mr !#{mr_iid}")
|
90
|
+
return client.create_merge_request_comment(project, mr_iid, url_section_builder.comment_body) unless comment
|
115
91
|
end
|
116
92
|
|
117
|
-
log_debug("Creating comment with summary for mr
|
118
|
-
client.
|
119
|
-
end
|
120
|
-
|
121
|
-
# Create or resolve comment discussion
|
122
|
-
#
|
123
|
-
# @return [void]
|
124
|
-
def create_or_resolve_discussion
|
125
|
-
@discussion = nil
|
126
|
-
|
127
|
-
if unresolved_discussion_on_failure && report_has_failures? && !alert_comment
|
128
|
-
client.create_merge_request_discussion_note(project, mr_iid, discussion.id, body: alert_comment_text)
|
129
|
-
elsif alert_comment && !report_has_failures?
|
130
|
-
client.delete_merge_request_discussion_note(project, mr_iid, discussion.id, alert_comment.id)
|
131
|
-
end
|
93
|
+
log_debug("Creating comment with summary for mr !#{mr_iid}")
|
94
|
+
client.edit_merge_request_note(project, mr_iid, comment.id, url_section_builder.comment_body(comment.body))
|
132
95
|
end
|
133
96
|
|
134
97
|
# Check if allure report has failures
|
@@ -138,21 +101,14 @@ module Publisher
|
|
138
101
|
main_comment&.body&.include?("❌")
|
139
102
|
end
|
140
103
|
|
141
|
-
# Existing
|
104
|
+
# Existing comment with allure urls
|
142
105
|
#
|
143
106
|
# @return [Gitlab::ObjectifiedHash]
|
144
|
-
def
|
145
|
-
|
146
|
-
|
107
|
+
def comment
|
108
|
+
client.merge_request_comments(project, mr_iid).auto_paginate.detect do |comment|
|
109
|
+
Helpers::UrlSectionBuilder.match?(comment.body)
|
147
110
|
end
|
148
111
|
end
|
149
|
-
|
150
|
-
# Comment/note with allure urls
|
151
|
-
#
|
152
|
-
# @return [Gitlab::ObjectifiedHash]
|
153
|
-
def main_comment
|
154
|
-
discussion&.notes&.detect { |note| Helpers::UrlSectionBuilder.match?(note.body) }
|
155
|
-
end
|
156
112
|
end
|
157
113
|
end
|
158
114
|
end
|
@@ -31,8 +31,8 @@ module Publisher
|
|
31
31
|
def client_args
|
32
32
|
@client_args ||= {
|
33
33
|
region: ENV["AWS_REGION"] || "us-east-1",
|
34
|
-
force_path_style:
|
35
|
-
endpoint:
|
34
|
+
force_path_style: path_style?,
|
35
|
+
endpoint: aws_endpoint
|
36
36
|
}.compact
|
37
37
|
end
|
38
38
|
|
@@ -43,6 +43,20 @@ module Publisher
|
|
43
43
|
@latest_report_url ||= url(prefix)
|
44
44
|
end
|
45
45
|
|
46
|
+
# Custom aws endpoint
|
47
|
+
#
|
48
|
+
# @return [<String, nil>]
|
49
|
+
def aws_endpoint
|
50
|
+
@aws_endpoint ||= ENV["AWS_ENDPOINT"]
|
51
|
+
end
|
52
|
+
|
53
|
+
# Force aws path style
|
54
|
+
#
|
55
|
+
# @return [Boolean]
|
56
|
+
def path_style?
|
57
|
+
ENV["AWS_FORCE_PATH_STYLE"] == "true"
|
58
|
+
end
|
59
|
+
|
46
60
|
# Add allure history
|
47
61
|
#
|
48
62
|
# @return [void]
|
@@ -143,7 +157,15 @@ module Publisher
|
|
143
157
|
# @param [String] path_prefix
|
144
158
|
# @return [String]
|
145
159
|
def url(path_prefix)
|
146
|
-
|
160
|
+
custom_base = if aws_endpoint
|
161
|
+
path_style? ? "#{aws_endpoint}/#{bucket_name}" : aws_endpoint
|
162
|
+
end
|
163
|
+
|
164
|
+
[
|
165
|
+
base_url || custom_base || "http://#{bucket_name}.s3.amazonaws.com",
|
166
|
+
path_prefix,
|
167
|
+
"index.html"
|
168
|
+
].compact.join("/")
|
147
169
|
end
|
148
170
|
|
149
171
|
# Get file content type
|
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:
|
4
|
+
version: 4.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrejs Cunskis
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-06-09 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.153.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.153.0
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
34
|
name: dry-cli
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
@@ -235,7 +235,6 @@ homepage: https://github.com/andrcuns/allure-report-uploader
|
|
235
235
|
licenses:
|
236
236
|
- MIT
|
237
237
|
metadata:
|
238
|
-
homepage_uri: https://github.com/andrcuns/allure-report-uploader
|
239
238
|
source_code_uri: https://github.com/andrcuns/allure-report-uploader
|
240
239
|
changelog_uri: https://github.com/andrcuns/allure-report-uploader/releases
|
241
240
|
documentation_uri: https://github.com/andrcuns/allure-report-uploader/blob/master/README.md
|
@@ -249,7 +248,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
249
248
|
requirements:
|
250
249
|
- - ">="
|
251
250
|
- !ruby/object:Gem::Version
|
252
|
-
version: '3.
|
251
|
+
version: '3.1'
|
253
252
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
254
253
|
requirements:
|
255
254
|
- - ">="
|