gitlab-qa 5.2.0 → 5.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/gitlab/qa/report/results_in_issues.rb +37 -3
- data/lib/gitlab/qa/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7e9cf3fd69ecf574cc318f194a49e715050b7fe6708327c1555264c589722de3
|
4
|
+
data.tar.gz: 695c6e1e0b2f49615b42b83765353c80c0613b832636231bad0022dbddb2efcb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2cc293bccacd51527427585000e3058fc2853254c890f4965d3cb0245395b0e12455cbf57f50b1555414a7dd74b375d6f6061a2a7be24d0ecc3dc59360e732eb
|
7
|
+
data.tar.gz: 4b4de8b9fdb59f1ac502a9d5c0d25184bf80121aea31a549cb8577c578ea7fbaa8166803b886872f59a5873eee430c0435a70641d4d20c87d90febca1ff372a1
|
@@ -5,10 +5,18 @@ require 'gitlab'
|
|
5
5
|
require 'active_support/core_ext/enumerable'
|
6
6
|
|
7
7
|
module Gitlab
|
8
|
-
# Monkey patch the Gitlab client to use the correct API path
|
8
|
+
# Monkey patch the Gitlab client to use the correct API path and add required methods
|
9
9
|
class Client
|
10
10
|
def team_member(project, id)
|
11
|
-
get("/projects/#{url_encode
|
11
|
+
get("/projects/#{url_encode(project)}/members/all/#{id}")
|
12
|
+
end
|
13
|
+
|
14
|
+
def issue_discussions(project, issue_id, options = {})
|
15
|
+
get("/projects/#{url_encode(project)}/issues/#{issue_id}/discussions", query: options)
|
16
|
+
end
|
17
|
+
|
18
|
+
def add_note_to_issue_discussion_as_thread(project, issue_id, discussion_id, options = {})
|
19
|
+
post("/projects/#{url_encode(project)}/issues/#{issue_id}/discussions/#{discussion_id}/notes", query: options)
|
12
20
|
end
|
13
21
|
end
|
14
22
|
|
@@ -141,6 +149,16 @@ module Gitlab
|
|
141
149
|
def note_status(issue, test)
|
142
150
|
return if failures(test).empty?
|
143
151
|
|
152
|
+
note = note_content(test)
|
153
|
+
|
154
|
+
Gitlab.issue_discussions(project, issue.iid, order_by: 'created_at', sort: 'asc').each do |discussion|
|
155
|
+
return add_note_to_discussion(issue.iid, discussion.id) if new_note_matches_discussion?(note, discussion)
|
156
|
+
end
|
157
|
+
|
158
|
+
Gitlab.create_issue_note(project, issue.iid, note)
|
159
|
+
end
|
160
|
+
|
161
|
+
def note_content(test)
|
144
162
|
errors = failures(test).each_with_object([]) do |failure, text|
|
145
163
|
text << <<~TEXT
|
146
164
|
Error:
|
@@ -155,7 +173,23 @@ module Gitlab
|
|
155
173
|
TEXT
|
156
174
|
end.join("\n\n")
|
157
175
|
|
158
|
-
|
176
|
+
"#{failure_summary}\n\n#{errors}"
|
177
|
+
end
|
178
|
+
|
179
|
+
def failure_summary
|
180
|
+
":x: ~\"#{pipeline}::failed\" in job `#{Runtime::Env.ci_job_name}` in #{Runtime::Env.ci_job_url}"
|
181
|
+
end
|
182
|
+
|
183
|
+
def new_note_matches_discussion?(note, discussion)
|
184
|
+
error_and_stack_trace(note) == error_and_stack_trace(discussion.notes.first['body'])
|
185
|
+
end
|
186
|
+
|
187
|
+
def error_and_stack_trace(text)
|
188
|
+
text.strip[/Error:(.*)/, 1]
|
189
|
+
end
|
190
|
+
|
191
|
+
def add_note_to_discussion(issue_iid, discussion_id)
|
192
|
+
Gitlab.add_note_to_issue_discussion_as_thread(project, issue_iid, discussion_id, body: failure_summary)
|
159
193
|
end
|
160
194
|
|
161
195
|
def update_labels(issue, test)
|
data/lib/gitlab/qa/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gitlab-qa
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.
|
4
|
+
version: 5.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Grzegorz Bizon
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-03-
|
11
|
+
date: 2020-03-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: climate_control
|