gitlab-qa 6.10.0 → 6.10.1

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: e7b24a0d671a29568447a0db95b57a06c43ed750d220dc13a0ad8216b7ba6297
4
- data.tar.gz: 9e03938be0b67f4f9a522703156bfc1b191ac0b8b97661c5eb74b82bfd91c84f
3
+ metadata.gz: f7798682f401a1349003d47532109adc5523cca0d4dfb43a0036669d0432168f
4
+ data.tar.gz: eaa7d08e48b241b2d2a521f493543f40beebaef4dcb86e04584eb34cbfbba1c8
5
5
  SHA512:
6
- metadata.gz: 21ea402dd74ab453e9ac303303f50925a32a82e58b7e4ff0aa57721d4e8301717febc4da56b1b5b3c7141ad7f0e613b56fc7d47b7a25256b83f07ec53980db33
7
- data.tar.gz: e31d991f0f78bfc510dbaafb3a844126d95c2e46655b2d655c256dcdfda673ca8038085c33deb65caa00728effb63e75020e3f6c217ddc697e87ceaded1270ba
6
+ metadata.gz: fd9312eb0cf93c3ec671b1115d96ae3926fe977de8c11134817fa90cdfb431b88015ce0c28dab8009492f7a14cba173ec13ffca8e466115e37e1b547f5cbe56d
7
+ data.tar.gz: cd2810c3e560b25337835d9f8e324549bff222cd45529ae7bd372351284a7080c33aaa611bfe95605f2cb12b3a7c958f272436d2e587b98fa8a425cdfdccfd90
@@ -49,9 +49,9 @@ variables:
49
49
  QA_CAN_TEST_GIT_PROTOCOL_V2: "true"
50
50
  QA_CAN_TEST_PRAEFECT: "false"
51
51
  QA_TESTCASES_REPORTING_PROJECT: "gitlab-org/quality/testcases"
52
- QA_FAILURES_REPORTING_PROJECT: "gitlab-org/gitlab"
52
+ QA_FAILURES_REPORTING_PROJECT: "rymai/gitlab-qa-issues"
53
53
  # The --dry-run or --max-diff-ratio option can be set to modify the behavior of `exe/gitlab-qa-report --relate-failure-issue` without releasing a new gem version.
54
- QA_FAILURES_REPORTER_OPTIONS: "--dry-run"
54
+ QA_FAILURES_REPORTER_OPTIONS: ""
55
55
  QA_TESTCASE_SESSIONS_PROJECT: "gitlab-org/quality/testcase-sessions"
56
56
 
57
57
  .check-base:
@@ -109,6 +109,9 @@ module Gitlab
109
109
  pipeline = QA::Runtime::Env.pipeline_from_project_name
110
110
  channel = pipeline == "canary" ? "qa-production" : "qa-#{pipeline}"
111
111
  error_msg = warn_exception(e)
112
+
113
+ return unless QA::Runtime::Env.ci_commit_ref_name == 'master'
114
+
112
115
  slack_options = {
113
116
  channel: channel,
114
117
  icon_emoji: ':ci_failing:',
@@ -10,7 +10,7 @@ module Gitlab
10
10
  # Uses the API to create or update GitLab issues with the results of tests from RSpec report files.
11
11
  class RelateFailureIssue < ReportAsIssue
12
12
  DEFAULT_MAX_DIFF_RATIO_FOR_DETECTION = 0.05
13
- STACKTRACE_REGEX = %r{### Stack trace\s*(```)\s*.*(Failure/Error: .+)(\1)}m.freeze
13
+ STACKTRACE_REGEX = %r{### Stack trace\s*(```)\s*.*(Failure/Error:.+)(\1)}m.freeze
14
14
  NEW_ISSUE_LABELS = Set.new(%w[QA Quality test failure::investigating priority::2]).freeze
15
15
 
16
16
  MultipleIssuesFound = Class.new(StandardError)
@@ -47,6 +47,7 @@ module Gitlab
47
47
  issue = find_or_create_issue(test)
48
48
  return unless issue
49
49
 
50
+ update_labels(issue, test)
50
51
  post_failed_job_note(issue, test)
51
52
  puts " => Marked #{issue.web_url} as related to #{test.testcase}."
52
53
  rescue MultipleIssuesFound => e
@@ -123,13 +124,38 @@ module Gitlab
123
124
  end
124
125
 
125
126
  def new_issue_description(test)
126
- super + "\n\n### Stack trace\n\n```\n#{test.failures.first['message_lines'].join("\n")}\n```"
127
+ super + [
128
+ "\n\n### Stack trace",
129
+ "```\n#{test.failures.first['message_lines'].join("\n")}\n```",
130
+ "First happened in #{test.ci_job_url}."
131
+ ].join("\n\n")
132
+ end
133
+
134
+ def deploy_environment_label
135
+ environment = Runtime::Env.deploy_environment
136
+
137
+ case environment
138
+ when 'production'
139
+ 'found:gitlab.com'
140
+ when 'canary', 'staging'
141
+ "found:#{environment}.gitlab.com"
142
+ when 'preprod'
143
+ 'found:pre.gitlab.com'
144
+ when 'staging-orchestrated', 'nightly', 'master'
145
+ "found:#{environment}"
146
+ else
147
+ raise "No `found:*` label for the `#{environment}` environment!"
148
+ end
127
149
  end
128
150
 
129
151
  def new_issue_labels(test)
130
152
  NEW_ISSUE_LABELS + up_to_date_labels(test: test)
131
153
  end
132
154
 
155
+ def up_to_date_labels(test:, issue: nil)
156
+ super << deploy_environment_label
157
+ end
158
+
133
159
  def post_failed_job_note(issue, test)
134
160
  gitlab.create_issue_note(iid: issue.iid, note: "/relate #{test.testcase}")
135
161
  end
@@ -25,8 +25,6 @@ module Gitlab
25
25
  end
26
26
 
27
27
  def report_test(test)
28
- return if test.skipped
29
-
30
28
  puts "Reporting test: #{test.file} | #{test.name}"
31
29
 
32
30
  issue = find_issue(test)
@@ -34,16 +32,19 @@ module Gitlab
34
32
  if issue
35
33
  puts "Found existing issue: #{issue.web_url}"
36
34
  else
35
+ # Don't create new issues for skipped tests
36
+ return if test.skipped
37
+
37
38
  issue = create_issue(test)
38
39
  puts "Created new issue: #{issue.web_url}"
39
40
  end
40
41
 
41
42
  test.testcase ||= issue.web_url
42
43
 
43
- update_labels(issue, test)
44
+ labels_updated = update_labels(issue, test)
44
45
  note_posted = note_status(issue, test)
45
46
 
46
- if note_posted
47
+ if labels_updated || note_posted
47
48
  puts "Issue updated."
48
49
  else
49
50
  puts "Test passed, no update needed."
@@ -83,6 +84,7 @@ module Gitlab
83
84
  end
84
85
 
85
86
  def note_status(issue, test)
87
+ return false if test.skipped
86
88
  return false if test.failures.empty?
87
89
 
88
90
  note = note_content(test)
@@ -139,6 +139,10 @@ module Gitlab
139
139
  ENV['CI_PROJECT_NAME']
140
140
  end
141
141
 
142
+ def ci_commit_ref_name
143
+ ENV['CI_COMMIT_REF_NAME']
144
+ end
145
+
142
146
  def pipeline_from_project_name
143
147
  if ci_project_name.to_s.start_with?('gitlab-qa')
144
148
  if ENV['TOP_UPSTREAM_SOURCE_JOB'].to_s.start_with?('https://ops.gitlab.net')
@@ -1,5 +1,5 @@
1
1
  module Gitlab
2
2
  module QA
3
- VERSION = '6.10.0'.freeze
3
+ VERSION = '6.10.1'.freeze
4
4
  end
5
5
  end
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: 6.10.0
4
+ version: 6.10.1
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-11-17 00:00:00.000000000 Z
11
+ date: 2020-11-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: climate_control