gitlab-qa 7.24.1 → 7.24.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitlab/ci/danger.gitlab-ci.yml +25 -0
- data/.gitlab-ci.yml +4 -5
- data/Dangerfile +9 -0
- data/gitlab-qa.gemspec +1 -0
- data/lib/gitlab/qa/component/base.rb +2 -0
- data/lib/gitlab/qa/component/gitlab.rb +26 -8
- data/lib/gitlab/qa/component/ldap.rb +38 -12
- data/lib/gitlab/qa/report/report_as_issue.rb +8 -6
- data/lib/gitlab/qa/report/results_in_issues.rb +0 -1
- data/lib/gitlab/qa/report/results_in_testcases.rb +22 -1
- data/lib/gitlab/qa/report/test_result.rb +8 -0
- data/lib/gitlab/qa/runtime/env.rb +7 -5
- data/lib/gitlab/qa/runtime/logger.rb +3 -20
- data/lib/gitlab/qa/test_logger.rb +35 -0
- data/lib/gitlab/qa/version.rb +1 -1
- data/lib/gitlab/qa.rb +1 -0
- metadata +19 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 86868c3764df21242c8600de6406579ebb747a7d8efcb1aa04393e49af8cf10d
|
4
|
+
data.tar.gz: bb659bc291814572d6fdb6f73b77ef6c8a57eb52d10d2412f96b8998f5ba166a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f4e796a110f8044e5eed1b99154672b6371ebb23c41b055e7302295bf2c1cfc5ea8c043c23040385a46340ad02bc07372d307e38e28f1585027047663a824be6
|
7
|
+
data.tar.gz: e77ffb360b79a845d000411b55748efa3e7bb4c0bdebfe725ee40dafddc75102cd9cdb86d2e0570c04edb9cad6fbe04193c55a84f35f1304697a505415e32ea6
|
@@ -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:
|
1388
|
-
|
1389
|
-
|
1390
|
-
|
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'
|
@@ -18,9 +18,7 @@ module Gitlab
|
|
18
18
|
|
19
19
|
def_delegators :release, :tag, :image, :edition
|
20
20
|
|
21
|
-
|
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
|
-
@
|
35
|
-
@volumes[AUTHORITY_CERTIFICATES_PATH] = TRUSTED_PATH
|
32
|
+
@omnibus_configuration = Runtime::OmnibusConfiguration.new(Runtime::Scenario.omnibus_configuration)
|
36
33
|
|
37
|
-
@
|
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(
|
81
|
-
@volumes[
|
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'
|
20
|
-
DOCKER_IMAGE_TAG = 'latest'
|
21
|
-
LDAP_USER = 'tanuki'
|
22
|
-
LDAP_PASSWORD = 'password'
|
23
|
-
BOOTSTRAP_LDIF = '/container/service/slapd/assets/config/bootstrap/ldif/custom'
|
24
|
-
FIXTURE_PATH = File.expand_path('../../../../fixtures/ldap'
|
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
|
@@ -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 <<
|
110
|
-
|
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
|
-
"
|
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.
|
152
|
+
qa_variables = ENV.each_with_object({}) do |(name, value), vars|
|
153
|
+
next unless name.start_with?('QA_')
|
153
154
|
|
154
|
-
|
155
|
-
|
156
|
-
|
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?
|
@@ -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
|
-
|
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
|
-
|
17
|
-
|
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
|
data/lib/gitlab/qa/version.rb
CHANGED
data/lib/gitlab/qa.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: 7.24.
|
4
|
+
version: 7.24.4
|
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
|
+
date: 2022-03-14 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
|
@@ -340,6 +356,7 @@ files:
|
|
340
356
|
- lib/gitlab/qa/support/get_request.rb
|
341
357
|
- lib/gitlab/qa/support/http_request.rb
|
342
358
|
- lib/gitlab/qa/support/invalid_response_error.rb
|
359
|
+
- lib/gitlab/qa/test_logger.rb
|
343
360
|
- lib/gitlab/qa/version.rb
|
344
361
|
- tls_certificates/authority/ca.crt
|
345
362
|
- tls_certificates/authority/ca.key
|