gitlab-qa 7.24.3 → 7.24.6

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: e2b176f3463abe8bce6879fad13baf9053f8d51175ce9b4c2994b2ad72a308b5
4
- data.tar.gz: a93d60ad2678d98b2e94e89e2c97cc24c1a81b42e5e838f5eaa20285a92a92a1
3
+ metadata.gz: 1ab5663ab224b79f77ee02d363fa0e38d5a14f53e895b5135e87a79e91ebb89a
4
+ data.tar.gz: 0b42e0776e042612565fe7e55af86db3dd3559dcdce549e4d937948e55173f81
5
5
  SHA512:
6
- metadata.gz: a6739f73c98c6fc9e044915632a747d990d1f1bb354eaaf77bb0de4d6c6c5abbaffda10a8f60927757a16ca48affc3dca2b8aa8a6bf4f4e6b6977eda9c3b4c20
7
- data.tar.gz: 17379496d96c009b6c96ea8953a38bacb253eb6ac80006889557bb068a6270991100926601936dcddd92cf02dca6ea7c3159990a6f3264e601803d5460394259
6
+ metadata.gz: a9046b2ee0a0a41d289a3551c4fe5179198b86854bcda525b1bc25915f5cc43f1b2d43f7197f077b55a43dd92bd3e40cd38c5d672bff4aa8b3c166933f7bd941
7
+ data.tar.gz: c3b2491338c9a433cf3cf1ae83864484e1f769cc3626497e2ef2e3b37717b1a58b481aec74fe37024ed7a18e7cd80364f749f6d9cab481a761c81b16aaab2cd8
@@ -0,0 +1,13 @@
1
+ <!--
2
+ Before raising an issue to the GitLab issue tracker, please read through our guide for finding help to determine the best place to post:
3
+
4
+ * https://about.gitlab.com/getting-help/
5
+
6
+ If you are experiencing an issue when using GitLab.com, your first port of call should be the Community Forum. Your issue may have already been reported there by another user. Please check:
7
+
8
+ * https://forum.gitlab.com/
9
+
10
+ If you feel that your issue can be categorized as a reproducible bug or a feature proposal, please use one of the issue templates provided and include as much information as possible.
11
+
12
+ Thank you for helping to make GitLab a better product.
13
+ -->
@@ -0,0 +1,46 @@
1
+ ## What does this MR do and why?
2
+
3
+ _Describe in detail what your merge request does and why._
4
+
5
+ <!--
6
+ Please keep this description updated with any discussion that takes place so
7
+ that reviewers can understand your intent. Keeping the description updated is
8
+ especially important if they didn't participate in the discussion.
9
+ -->
10
+
11
+ ## Screenshots or screen recordings
12
+
13
+ _These are strongly recommended to assist reviewers and reduce the time to merge your change._
14
+
15
+ <!--
16
+ Please include any relevant screenshots or screen recordings that will assist
17
+ reviewers and future readers. If you need help visually verifying the change,
18
+ please leave a comment and ping a GitLab reviewer, maintainer, or MR coach.
19
+ -->
20
+
21
+ ## How to set up and validate locally
22
+
23
+ _Numbered steps to set up and validate the change are strongly suggested._
24
+
25
+ <!--
26
+ Example below:
27
+
28
+ 1. Enable the invite modal
29
+ ```ruby
30
+ Feature.enable(:invite_members_group_modal)
31
+ ```
32
+ 1. In rails console enable the experiment fully
33
+ ```ruby
34
+ Feature.enable(:member_areas_of_focus)
35
+ ```
36
+ 1. Visit any group or project member pages such as `http://127.0.0.1:3000/groups/flightjs/-/group_members`
37
+ 1. Click the `invite members` button.
38
+ -->
39
+
40
+ ## MR acceptance checklist
41
+
42
+ This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
43
+
44
+ * [ ] I have evaluated the [MR acceptance checklist](https://docs.gitlab.com/ee/development/code_review.html#acceptance-checklist) for this MR.
45
+
46
+ /label ~QA ~Quality
data/.gitlab-ci.yml CHANGED
@@ -820,7 +820,7 @@ ee:object_storage-quarantine:
820
820
  GITLAB_QA_OPTIONS_COMBINED: "$GITLAB_QA_OPTIONS --omnibus-config object_storage"
821
821
  QA_RSPEC_TAGS: "--tag quarantine --tag object_storage"
822
822
 
823
- ee:packages:
823
+ ee:packages-parallel:
824
824
  extends:
825
825
  - .rules:ee-never-when-triggered-by-feature-flag-definition-change
826
826
  - .test
@@ -828,6 +828,7 @@ ee:packages:
828
828
  - .ee-variables
829
829
  - .rspec-report-opts
830
830
  - .combined-gitlab-qa-options-script
831
+ parallel: 2
831
832
  variables:
832
833
  GITLAB_QA_OPTIONS_COMBINED: "$GITLAB_QA_OPTIONS --omnibus-config packages"
833
834
  QA_RSPEC_TAGS: "--tag packages"
@@ -1388,3 +1389,7 @@ include:
1388
1389
  - '/ci/gem-release.yml'
1389
1390
  - '/ci/allure-report.yml'
1390
1391
  - '/ci/knapsack-report.yml'
1392
+ - '/ci/danger-review.yml'
1393
+
1394
+ danger-review:
1395
+ stage: check
data/Dangerfile CHANGED
@@ -1,9 +1,7 @@
1
1
  require 'gitlab-dangerfiles'
2
2
 
3
3
  Gitlab::Dangerfiles.for_project(self) do |dangerfiles|
4
- # Import all plugins from the gem
5
4
  dangerfiles.import_plugins
6
5
 
7
- # Import only a subset of rules
8
- dangerfiles.import_dangerfiles(only: %w[changes_size commit_messages simple_roulette])
6
+ dangerfiles.import_dangerfiles(except: %w[changelog])
9
7
  end
data/gitlab-qa.gemspec CHANGED
@@ -21,7 +21,7 @@ Gem::Specification.new do |spec|
21
21
  spec.require_paths = ['lib']
22
22
 
23
23
  spec.add_development_dependency 'climate_control', '~> 1.0.1'
24
- spec.add_development_dependency 'gitlab-dangerfiles', '~> 2.10'
24
+ spec.add_development_dependency 'gitlab-dangerfiles', '~> 2.11'
25
25
  spec.add_development_dependency 'gitlab-styles', '~> 6.2.1'
26
26
  spec.add_development_dependency 'pry', '~> 0.11'
27
27
  spec.add_development_dependency 'rake', '~> 13.0'
@@ -77,12 +77,24 @@ module Gitlab
77
77
  end
78
78
  end
79
79
 
80
+ def find_issue_notes(iid:)
81
+ handle_gitlab_client_exceptions do
82
+ Gitlab.issue_notes(project, iid, order_by: 'created_at', sort: 'asc').auto_paginate
83
+ end
84
+ end
85
+
80
86
  def create_issue_note(iid:, note:)
81
87
  handle_gitlab_client_exceptions do
82
88
  Gitlab.create_issue_note(project, iid, note)
83
89
  end
84
90
  end
85
91
 
92
+ def edit_issue_note(issue_iid:, note_id:, note:)
93
+ handle_gitlab_client_exceptions do
94
+ Gitlab.edit_issue_note(project, issue_iid, note_id, note)
95
+ end
96
+ end
97
+
86
98
  def add_note_to_issue_discussion_as_thread(iid:, discussion_id:, body:)
87
99
  handle_gitlab_client_exceptions do
88
100
  Gitlab.add_note_to_issue_discussion_as_thread(project, iid, discussion_id, body: body)
@@ -61,7 +61,7 @@ module Gitlab
61
61
 
62
62
  if issue
63
63
  puts " => Found issue #{issue.web_url} for test '#{test.name}' with a diff ratio of #{(diff_ratio * 100).round(2)}%."
64
- @commented_issue_list.include?(issue.web_url) ? (puts " => Failure already commented on issue.") : post_failed_job_note(issue, test)
64
+ @commented_issue_list.include?(issue.web_url) ? (puts " => Failure already commented on issue.") : post_or_update_failed_job_note(issue, test)
65
65
  @commented_issue_list.add(issue.web_url)
66
66
  end
67
67
 
@@ -86,14 +86,16 @@ module Gitlab
86
86
  ld = Class.new.extend(Gem::Text).method(:levenshtein_distance)
87
87
  full_stacktrace = test.failures.first['message_lines'].join("\n")
88
88
  first_test_failure_stacktrace = sanitize_stacktrace(full_stacktrace, FAILURE_STACKTRACE_REGEX) || full_stacktrace
89
+ clean_first_test_failure_stacktrace = remove_unique_resource_names(first_test_failure_stacktrace)
89
90
 
90
91
  # Search with the `search` param returns 500 errors, so we filter by ~QA and then filter further in Ruby
91
92
  failure_issues(test).each_with_object({}) do |issue, memo|
92
93
  relevant_issue_stacktrace = find_issue_stacktrace(issue)
93
94
  next unless relevant_issue_stacktrace
94
95
 
95
- distance = ld.call(first_test_failure_stacktrace, relevant_issue_stacktrace)
96
- diff_ratio = distance.zero? ? 0.0 : (distance.to_f / first_test_failure_stacktrace.size).round(3)
96
+ clean_relevant_issue_stacktrace = remove_unique_resource_names(relevant_issue_stacktrace)
97
+ distance = ld.call(clean_first_test_failure_stacktrace, clean_relevant_issue_stacktrace)
98
+ diff_ratio = distance.zero? ? 0.0 : (distance.to_f / clean_first_test_failure_stacktrace.size).round(3)
97
99
 
98
100
  if diff_ratio <= max_diff_ratio
99
101
  puts " => [DEBUG] Issue #{issue.web_url} has an acceptable diff ratio of #{(diff_ratio * 100).round(2)}%."
@@ -128,6 +130,10 @@ module Gitlab
128
130
  end
129
131
  end
130
132
 
133
+ def remove_unique_resource_names(stacktrace)
134
+ stacktrace.gsub(/qa-(test|user)-[a-z0-9-]+/, '<unique-test-resource>').gsub(/(?:-|_)(?:\d+[a-z]|[a-z]+\d)[a-z\d]{4,}/, '<unique-hash>')
135
+ end
136
+
131
137
  def find_failure_issue(test)
132
138
  relevant_issues = find_relevant_failure_issues(test)
133
139
 
@@ -164,14 +170,30 @@ module Gitlab
164
170
  super << pipeline_name_label
165
171
  end
166
172
 
167
- def post_failed_job_note(issue, test)
168
- gitlab.create_issue_note(iid: issue.iid, note: "Failure occurred in #{pipeline} pipeline: #{test.ci_job_url}")
173
+ def post_or_update_failed_job_note(issue, test)
174
+ current_note = "Failed most recently in #{pipeline} pipeline: #{test.ci_job_url}"
175
+ existing_note = existing_failure_note(issue)
176
+
177
+ if existing_note
178
+ gitlab.edit_issue_note(issue_iid: issue.iid, note_id: existing_note.id, note: current_note)
179
+ else
180
+ gitlab.create_issue_note(iid: issue.iid, note: current_note)
181
+ end
182
+
169
183
  puts " => Linked #{test.ci_job_url} to #{issue.web_url}."
170
184
  end
171
185
 
172
186
  def new_issue_title(test)
173
187
  "Failure in #{super}"
174
188
  end
189
+
190
+ def existing_failure_note(issue)
191
+ gitlab.find_issue_notes(iid: issue.iid).each do |note|
192
+ return note if note.body.include?('Failed most recently in')
193
+ end
194
+
195
+ false
196
+ end
175
197
  end
176
198
  end
177
199
  end
@@ -1,34 +1,17 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'logger'
4
3
  require 'forwardable'
5
- require'rainbow/refinement'
6
4
 
7
5
  module Gitlab
8
6
  module QA
9
7
  module Runtime
10
- module Logger
8
+ class Logger
11
9
  extend SingleForwardable
12
- using Rainbow
13
10
 
14
11
  def_delegators :logger, :debug, :info, :warn, :error, :fatal, :unknown
15
12
 
16
- singleton_class.module_eval do
17
- attr_writer :logger
18
-
19
- def logger
20
- Rainbow.enabled = Runtime::Env.colorized_logs?
21
-
22
- @logger ||= ::Logger.new($stdout).tap do |logger|
23
- logger.level = Runtime::Env.debug? ? ::Logger::DEBUG : ::Logger::INFO
24
-
25
- logger.formatter = proc do |severity, datetime, progname, msg|
26
- date_format = datetime.strftime("%Y-%m-%d %H:%M:%S")
27
-
28
- "[date=#{date_format} from=GitLab QA] #{severity.ljust(5)}-- ".yellow + "#{msg}\n"
29
- end
30
- end
31
- end
13
+ def self.logger
14
+ @logger ||= QA::TestLogger.logger(level: Runtime::Env.debug? ? ::Logger::DEBUG : ::Logger::INFO)
32
15
  end
33
16
  end
34
17
  end
@@ -0,0 +1,35 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'logger'
4
+ require 'rainbow'
5
+
6
+ module Gitlab
7
+ module QA
8
+ # Common test logger implementation
9
+ #
10
+ class TestLogger
11
+ LEVEL_COLORS = {
12
+ "DEBUG" => :magenta,
13
+ "INFO" => :green,
14
+ "WARN" => :yellow,
15
+ "ERROR" => :red,
16
+ "FATAL" => :indianred
17
+ }.freeze
18
+
19
+ Rainbow.enabled = Runtime::Env.colorized_logs?
20
+
21
+ def self.logger(level: ::Logger::INFO, source: 'Gitlab QA')
22
+ ::Logger.new($stdout).tap do |logger|
23
+ logger.level = level
24
+
25
+ logger.formatter = proc do |severity, datetime, progname, msg|
26
+ date_format = datetime.strftime("%Y-%m-%d %H:%M:%S")
27
+ msg_prefix = "[date=#{date_format} from=#{source}] #{severity.ljust(5)} -- "
28
+
29
+ Rainbow(msg_prefix).public_send(LEVEL_COLORS.fetch(severity, :silver)) + "#{msg}\n" # rubocop:disable GitlabSecurity/PublicSend
30
+ end
31
+ end
32
+ end
33
+ end
34
+ end
35
+ end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Gitlab
4
4
  module QA
5
- VERSION = '7.24.3'
5
+ VERSION = '7.24.6'
6
6
  end
7
7
  end
data/lib/gitlab/qa.rb CHANGED
@@ -3,6 +3,7 @@ module Gitlab
3
3
  autoload :Release, 'gitlab/qa/release'
4
4
  autoload :Reporter, 'gitlab/qa/reporter'
5
5
  autoload :Runner, 'gitlab/qa/runner'
6
+ autoload :TestLogger, 'gitlab/qa/test_logger'
6
7
 
7
8
  module Runtime
8
9
  autoload :Env, 'gitlab/qa/runtime/env'
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: 7.24.3
4
+ version: 7.24.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - GitLab Quality
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-03-11 00:00:00.000000000 Z
11
+ date: 2022-03-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: climate_control
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '2.10'
33
+ version: '2.11'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '2.10'
40
+ version: '2.11'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: gitlab-styles
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -218,8 +218,9 @@ files:
218
218
  - ".dockerignore"
219
219
  - ".gitignore"
220
220
  - ".gitlab-ci.yml"
221
- - ".gitlab/ci/danger.gitlab-ci.yml"
222
221
  - ".gitlab/ci/rules.gitlab-ci.yml"
222
+ - ".gitlab/issue_templates/Default.md"
223
+ - ".gitlab/merge_request_templates/Default.md"
223
224
  - ".gitlab/merge_request_templates/Release.md"
224
225
  - ".rspec"
225
226
  - ".rubocop.yml"
@@ -356,6 +357,7 @@ files:
356
357
  - lib/gitlab/qa/support/get_request.rb
357
358
  - lib/gitlab/qa/support/http_request.rb
358
359
  - lib/gitlab/qa/support/invalid_response_error.rb
360
+ - lib/gitlab/qa/test_logger.rb
359
361
  - lib/gitlab/qa/version.rb
360
362
  - tls_certificates/authority/ca.crt
361
363
  - tls_certificates/authority/ca.key
@@ -1,25 +0,0 @@
1
- danger-review:
2
- image: ruby:3.0
3
- stage: check
4
- rules:
5
- - if: '$CI_MERGE_REQUEST_IID'
6
- needs: []
7
- retry:
8
- max: 2
9
- when:
10
- - unknown_failure
11
- - api_failure
12
- - runner_system_failure
13
- - stuck_or_timeout_failure
14
- before_script:
15
- - bundle install
16
- script:
17
- - >
18
- if [ -z "$DANGER_GITLAB_API_TOKEN" ]; then
19
- # Force danger to skip CI source GitLab and fallback to "local only git repo".
20
- unset GITLAB_CI
21
- # We need the base SHA of the merge request diff to help danger determine the base commit for this shallow clone.
22
- bundle exec danger dry_run --fail-on-errors=true --verbose --base='$CI_MERGE_REQUEST_DIFF_BASE_SHA' --head='${CI_MERGE_REQUEST_SOURCE_BRANCH_SHA:-$CI_COMMIT_SHA}'
23
- else
24
- bundle exec danger --fail-on-errors=true --verbose
25
- fi