gitlab-qa 7.24.0 → 7.24.3

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: 667197342275f6df37533b1873c6d0cfc7ae66d43bc600af2baa1eca89dc3891
4
- data.tar.gz: 0fa801cb8ba230a40864cc6106edcbaaf1a5190b5e24bf1f2e89a36c2bcf99a3
3
+ metadata.gz: e2b176f3463abe8bce6879fad13baf9053f8d51175ce9b4c2994b2ad72a308b5
4
+ data.tar.gz: a93d60ad2678d98b2e94e89e2c97cc24c1a81b42e5e838f5eaa20285a92a92a1
5
5
  SHA512:
6
- metadata.gz: 0a02f18c341ce5fa7f3435b890db6c2d6b9afba8c501fe818b15f75640840b6cb1bc4af29802007fce8af76390aed2cfa53328ab9861307cda87773add8b730f
7
- data.tar.gz: 85fec2a1eb1184e5b519c7af38853759a78bc54366b8b164d8de133833e9a1cf9c35b4670c24c7bca5a4872704f64f940e652fc246998dd933d2984f5208d47c
6
+ metadata.gz: a6739f73c98c6fc9e044915632a747d990d1f1bb354eaaf77bb0de4d6c6c5abbaffda10a8f60927757a16ca48affc3dca2b8aa8a6bf4f4e6b6977eda9c3b4c20
7
+ data.tar.gz: 17379496d96c009b6c96ea8953a38bacb253eb6ac80006889557bb068a6270991100926601936dcddd92cf02dca6ea7c3159990a6f3264e601803d5460394259
@@ -0,0 +1,25 @@
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
data/.gitlab-ci.yml CHANGED
@@ -1384,8 +1384,7 @@ generate-knapsack-report:
1384
1384
  include:
1385
1385
  - local: .gitlab/ci/*.gitlab-ci.yml
1386
1386
  - project: 'gitlab-org/quality/pipeline-common'
1387
- file: '/ci/gem-release.yml'
1388
- - project: 'gitlab-org/quality/pipeline-common'
1389
- file: '/ci/allure-report.yml'
1390
- - project: 'gitlab-org/quality/pipeline-common'
1391
- file: '/ci/knapsack-report.yml'
1387
+ file:
1388
+ - '/ci/gem-release.yml'
1389
+ - '/ci/allure-report.yml'
1390
+ - '/ci/knapsack-report.yml'
data/Dangerfile ADDED
@@ -0,0 +1,9 @@
1
+ require 'gitlab-dangerfiles'
2
+
3
+ Gitlab::Dangerfiles.for_project(self) do |dangerfiles|
4
+ # Import all plugins from the gem
5
+ dangerfiles.import_plugins
6
+
7
+ # Import only a subset of rules
8
+ dangerfiles.import_dangerfiles(only: %w[changes_size commit_messages simple_roulette])
9
+ end
data/gitlab-qa.gemspec CHANGED
@@ -21,6 +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
25
  spec.add_development_dependency 'gitlab-styles', '~> 6.2.1'
25
26
  spec.add_development_dependency 'pry', '~> 0.11'
26
27
  spec.add_development_dependency 'rake', '~> 13.0'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Gitlab
2
4
  module QA
3
5
  module Component
@@ -18,9 +18,7 @@ module Gitlab
18
18
 
19
19
  def_delegators :release, :tag, :image, :edition
20
20
 
21
- AUTHORITY_CERTIFICATES_PATH = File.expand_path('../../../../tls_certificates/authority', __dir__)
22
- GITLAB_CERTIFICATES_PATH = File.expand_path('../../../../tls_certificates/gitlab', __dir__)
23
- GITALY_CERTIFICATES_PATH = File.expand_path('../../../../tls_certificates/gitaly', __dir__)
21
+ CERTIFICATES_PATH = File.expand_path('../../../../tls_certificates', __dir__)
24
22
 
25
23
  SSL_PATH = '/etc/gitlab/ssl'
26
24
  TRUSTED_PATH = '/etc/gitlab/trusted-certs'
@@ -31,10 +29,15 @@ module Gitlab
31
29
  @skip_availability_check = false
32
30
  @omnibus_gitlab_rails_env = {}
33
31
 
34
- @volumes[GITLAB_CERTIFICATES_PATH] = SSL_PATH
35
- @volumes[AUTHORITY_CERTIFICATES_PATH] = TRUSTED_PATH
32
+ @omnibus_configuration = Runtime::OmnibusConfiguration.new(Runtime::Scenario.omnibus_configuration)
36
33
 
37
- @omnibus_configuration ||= Runtime::OmnibusConfiguration.new(Runtime::Scenario.omnibus_configuration)
34
+ @working_dir_tmp_cert_path = Dir.mktmpdir('certs', FileUtils.mkdir_p("#{Dir.pwd}/tmp"))
35
+ @authority_cert_path = "#{@working_dir_tmp_cert_path}/authority"
36
+ @gitlab_cert_path = "#{@working_dir_tmp_cert_path}/gitlab"
37
+ @gitaly_cert_path = "#{@working_dir_tmp_cert_path}/gitaly"
38
+
39
+ @volumes[@gitlab_cert_path] = SSL_PATH
40
+ @volumes[@authority_cert_path] = TRUSTED_PATH
38
41
 
39
42
  self.release = 'CE'
40
43
  end
@@ -77,8 +80,8 @@ module Gitlab
77
80
  end
78
81
 
79
82
  def gitaly_tls
80
- @volumes.delete(GITLAB_CERTIFICATES_PATH)
81
- @volumes[GITALY_CERTIFICATES_PATH] = SSL_PATH
83
+ @volumes.delete(@gitlab_cert_path)
84
+ @volumes[@gitaly_cert_path] = SSL_PATH
82
85
  end
83
86
 
84
87
  def relative_path
@@ -91,6 +94,13 @@ module Gitlab
91
94
 
92
95
  def prepare
93
96
  prepare_gitlab_omnibus_config
97
+ copy_certificates
98
+
99
+ super
100
+ end
101
+
102
+ def teardown!
103
+ FileUtils.rm_rf(@working_dir_tmp_cert_path)
94
104
 
95
105
  super
96
106
  end
@@ -168,6 +178,14 @@ module Gitlab
168
178
 
169
179
  private
170
180
 
181
+ # Copy certs to a temporary directory in current working directory.
182
+ # This is needed for docker-in-docker ci environments where mount points outside of build dir are not accessible
183
+ #
184
+ # @return [void]
185
+ def copy_certificates
186
+ FileUtils.cp_r("#{CERTIFICATES_PATH}/.", @working_dir_tmp_cert_path)
187
+ end
188
+
171
189
  def ensure_configured!
172
190
  raise 'Please configure an instance first!' unless [name, release, network].all?
173
191
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'securerandom'
2
4
 
3
5
  # This component sets up the docker-openldap (https://github.com/osixia/docker-openldap)
@@ -16,18 +18,12 @@ module Gitlab
16
18
  module QA
17
19
  module Component
18
20
  class LDAP < Base
19
- DOCKER_IMAGE = 'osixia/openldap'.freeze
20
- DOCKER_IMAGE_TAG = 'latest'.freeze
21
- LDAP_USER = 'tanuki'.freeze
22
- LDAP_PASSWORD = 'password'.freeze
23
- BOOTSTRAP_LDIF = '/container/service/slapd/assets/config/bootstrap/ldif/custom'.freeze
24
- FIXTURE_PATH = File.expand_path('../../../../fixtures/ldap'.freeze, __dir__)
25
-
26
- def initialize
27
- super
28
-
29
- @volumes[FIXTURE_PATH] = BOOTSTRAP_LDIF
30
- end
21
+ DOCKER_IMAGE = 'osixia/openldap'
22
+ DOCKER_IMAGE_TAG = 'latest'
23
+ LDAP_USER = 'tanuki'
24
+ LDAP_PASSWORD = 'password'
25
+ BOOTSTRAP_LDIF = '/container/service/slapd/assets/config/bootstrap/ldif/custom'
26
+ FIXTURE_PATH = File.expand_path('../../../../fixtures/ldap', __dir__)
31
27
 
32
28
  # LDAP_TLS is true by default
33
29
  def tls=(status)
@@ -59,6 +55,19 @@ module Gitlab
59
55
  super
60
56
  end
61
57
 
58
+ def prepare
59
+ copy_fixtures
60
+ @volumes["#{working_dir_tmp_fixture_path}/ldap"] = BOOTSTRAP_LDIF
61
+
62
+ super
63
+ end
64
+
65
+ def teardown!
66
+ FileUtils.rm_rf(working_dir_tmp_fixture_path)
67
+
68
+ super
69
+ end
70
+
62
71
  # rubocop:disable Metrics/AbcSize
63
72
  def start
64
73
  # copy-service needed for bootstraping LDAP user:
@@ -88,6 +97,23 @@ module Gitlab
88
97
  ::Gitlab::QA::Runtime::Env.ldap_username = username
89
98
  ::Gitlab::QA::Runtime::Env.ldap_password = password
90
99
  end
100
+
101
+ private
102
+
103
+ # Temporary fixture dir in working directory
104
+ #
105
+ # @return [String]
106
+ def working_dir_tmp_fixture_path
107
+ @local_fixture_path ||= Dir.mktmpdir('ldap', FileUtils.mkdir_p("#{Dir.pwd}/tmp"))
108
+ end
109
+
110
+ # Copy fixtures to current working directory
111
+ # This is needed for docker-in-docker ci environments where mount points outside of build dir are not accessible
112
+ #
113
+ # @return [void]
114
+ def copy_fixtures
115
+ FileUtils.cp_r(FIXTURE_PATH, working_dir_tmp_fixture_path)
116
+ end
91
117
  end
92
118
  end
93
119
  end
@@ -20,6 +20,7 @@ module Gitlab
20
20
  super
21
21
  @max_diff_ratio = max_diff_ratio.to_f
22
22
  @issue_type = 'issue'
23
+ @commented_issue_list = Set.new
23
24
  end
24
25
 
25
26
  private
@@ -60,7 +61,8 @@ module Gitlab
60
61
 
61
62
  if issue
62
63
  puts " => Found issue #{issue.web_url} for test '#{test.name}' with a diff ratio of #{(diff_ratio * 100).round(2)}%."
63
- post_failed_job_note(issue, test)
64
+ @commented_issue_list.include?(issue.web_url) ? (puts " => Failure already commented on issue.") : post_failed_job_note(issue, test)
65
+ @commented_issue_list.add(issue.web_url)
64
66
  end
65
67
 
66
68
  issue
@@ -106,8 +106,14 @@ module Gitlab
106
106
  def up_to_date_labels(test:, issue: nil, new_labels: Set.new)
107
107
  labels = issue_labels(issue)
108
108
  labels |= new_labels
109
- ee_test?(test) ? labels << "Enterprise Edition" : labels.delete("Enterprise Edition")
110
- quarantine_job? ? labels << "quarantine" : labels.delete("quarantine")
109
+ ee_test?(test) ? labels << 'Enterprise Edition' : labels.delete('Enterprise Edition')
110
+
111
+ if test.quarantine?
112
+ labels << 'quarantine'
113
+ labels << "quarantine::#{test.quarantine_type}"
114
+ else
115
+ labels.delete_if { |label| label.include?('quarantine') }
116
+ end
111
117
 
112
118
  labels
113
119
  end
@@ -133,10 +139,6 @@ module Gitlab
133
139
  test.file =~ %r{features/ee/(api|browser_ui)}
134
140
  end
135
141
 
136
- def quarantine_job?
137
- Runtime::Env.ci_job_name&.include?('quarantine')
138
- end
139
-
140
142
  def partial_file_path(path)
141
143
  path.match(/((api|browser_ui).*)/i)[1]
142
144
  end
@@ -100,7 +100,6 @@ module Gitlab
100
100
 
101
101
  def failure_summary
102
102
  summary = [":x: ~\"#{pipeline}::failed\""]
103
- summary << "~\"quarantine\"" if quarantine_job?
104
103
  summary << "in job `#{Runtime::Env.ci_job_name}` in #{Runtime::Env.ci_job_url}"
105
104
  summary.join(' ')
106
105
  end
@@ -30,6 +30,7 @@ module Gitlab
30
30
 
31
31
  def update_testcase(testcase, test)
32
32
  puts "Test case labels updated." if update_labels(testcase, test)
33
+ puts "Test case quarantine section updated." if update_quarantine_link(testcase, test)
33
34
  end
34
35
 
35
36
  private
@@ -61,7 +62,9 @@ module Gitlab
61
62
  end
62
63
 
63
64
  def new_issue_description(test)
64
- "#{super}\n\n#{execution_graph_section(test)}"
65
+ quarantine_section = test.quarantine? && test.quarantine_issue ? "\n\n### Quarantine issue\n\n#{test.quarantine_issue}" : ''
66
+
67
+ "#{super}#{quarantine_section}\n\n#{execution_graph_section(test)}"
65
68
  end
66
69
 
67
70
  def execution_graph_section(test)
@@ -84,6 +87,24 @@ module Gitlab
84
87
  def issue_title_needs_updating?(testcase, test)
85
88
  super || !testcase.description.include?(execution_graph_section(test)) && !%w[canary production preprod release].include?(pipeline)
86
89
  end
90
+
91
+ def quarantine_link_needs_updating?(testcase, test)
92
+ if test.quarantine? && test.quarantine_issue
93
+ return false if testcase.description.include?(test.quarantine_issue)
94
+ else
95
+ return false unless testcase.description.include?('Quarantine issue')
96
+ end
97
+
98
+ true
99
+ end
100
+
101
+ def update_quarantine_link(testcase, test)
102
+ return unless quarantine_link_needs_updating?(testcase, test)
103
+
104
+ new_description = updated_description(testcase, test)
105
+
106
+ gitlab.edit_issue(iid: testcase.iid, options: { description: new_description })
107
+ end
87
108
  end
88
109
  end
89
110
  end
@@ -87,6 +87,14 @@ module Gitlab
87
87
  report['quarantine'].present?
88
88
  end
89
89
 
90
+ def quarantine_type
91
+ report['quarantine']['type'] if quarantine?
92
+ end
93
+
94
+ def quarantine_issue
95
+ report['quarantine']['issue'] if quarantine?
96
+ end
97
+
90
98
  private
91
99
 
92
100
  # rubocop:disable Metrics/AbcSize
@@ -149,12 +149,14 @@ module Gitlab
149
149
  value = env_var_name_if_defined(name) || send(attribute) # rubocop:disable GitlabSecurity/PublicSend
150
150
  vars[name] = value if value
151
151
  end
152
- qa_variables = ENV.select { |k, _v| k.start_with?('QA_') }
152
+ qa_variables = ENV.each_with_object({}) do |(name, value), vars|
153
+ next unless name.start_with?('QA_')
153
154
 
154
- {
155
- **qa_variables,
156
- **defined_variables
157
- }
155
+ var_name = env_var_name_if_defined(name)
156
+ vars[name] = var_name if var_name
157
+ end
158
+
159
+ qa_variables.merge(defined_variables)
158
160
  end
159
161
 
160
162
  def debug?
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Gitlab
4
4
  module QA
5
- VERSION = '7.24.0'
5
+ VERSION = '7.24.3'
6
6
  end
7
7
  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: 7.24.0
4
+ version: 7.24.3
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-01 00:00:00.000000000 Z
11
+ date: 2022-03-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: climate_control
@@ -24,6 +24,20 @@ dependencies:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: 1.0.1
27
+ - !ruby/object:Gem::Dependency
28
+ name: gitlab-dangerfiles
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '2.10'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '2.10'
27
41
  - !ruby/object:Gem::Dependency
28
42
  name: gitlab-styles
29
43
  requirement: !ruby/object:Gem::Requirement
@@ -204,12 +218,14 @@ files:
204
218
  - ".dockerignore"
205
219
  - ".gitignore"
206
220
  - ".gitlab-ci.yml"
221
+ - ".gitlab/ci/danger.gitlab-ci.yml"
207
222
  - ".gitlab/ci/rules.gitlab-ci.yml"
208
223
  - ".gitlab/merge_request_templates/Release.md"
209
224
  - ".rspec"
210
225
  - ".rubocop.yml"
211
226
  - ".rubocop_todo.yml"
212
227
  - CONTRIBUTING.md
228
+ - Dangerfile
213
229
  - Gemfile
214
230
  - LICENSE
215
231
  - README.md