gitlab-qa 7.17.1 → 7.20.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitlab-ci.yml +37 -18
- data/docs/what_tests_can_be_run.md +1 -0
- data/gitlab-qa.gemspec +1 -0
- data/lib/gitlab/qa/component/base.rb +1 -1
- data/lib/gitlab/qa/component/gitlab.rb +13 -2
- data/lib/gitlab/qa/component/minio.rb +1 -1
- data/lib/gitlab/qa/component/specs.rb +3 -3
- data/lib/gitlab/qa/docker/shellout.rb +5 -2
- data/lib/gitlab/qa/report/results_in_issues.rb +4 -0
- data/lib/gitlab/qa/report/results_in_testcases.rb +24 -1
- data/lib/gitlab/qa/report/results_reporter_shared.rb +7 -2
- data/lib/gitlab/qa/runtime/env.rb +50 -24
- data/lib/gitlab/qa/runtime/logger.rb +36 -0
- data/lib/gitlab/qa/scenario/test/integration/actioncable.rb +1 -1
- data/lib/gitlab/qa/scenario/test/integration/client_ssl.rb +1 -1
- data/lib/gitlab/qa/scenario/test/integration/elasticsearch.rb +1 -1
- data/lib/gitlab/qa/scenario/test/integration/geo.rb +1 -1
- data/lib/gitlab/qa/scenario/test/integration/gitaly_cluster.rb +1 -1
- data/lib/gitlab/qa/scenario/test/integration/jira.rb +1 -1
- data/lib/gitlab/qa/scenario/test/integration/ldap.rb +1 -1
- data/lib/gitlab/qa/scenario/test/integration/mtls.rb +1 -1
- data/lib/gitlab/qa/scenario/test/integration/saml.rb +1 -1
- data/lib/gitlab/qa/scenario/test/integration/smtp.rb +1 -1
- data/lib/gitlab/qa/support/get_request.rb +1 -1
- data/lib/gitlab/qa/version.rb +1 -1
- data/lib/gitlab/qa.rb +1 -0
- metadata +17 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f7b10d593ddaeee4b4e931904d7332f845b1fb8f816e5e42d3c79e22634ff680
|
4
|
+
data.tar.gz: 93b081c8de2108f2b9f17462319b3ac5467671a3b775ab597fbe317b0f7646aa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1f590d463f6fea2e69dba2ad64ac15274011a63863db9c8d9544e24e07c91a683a92709b96f0628d114da4d825bc5a4e5104bdf9c6bbd57750ef2b3f20007ee8
|
7
|
+
data.tar.gz: 681dd9b8d51cc491a75a4beba08391ffecbb7ecef6218c9db51854d452e4a7a2bf9e9fe36e7e9603608be4d5468d6ecf0462951004eb1f68155715d2a9497216
|
data/.gitlab-ci.yml
CHANGED
@@ -77,7 +77,7 @@ rspec:
|
|
77
77
|
when: always
|
78
78
|
expire_in: 10d
|
79
79
|
paths:
|
80
|
-
-
|
80
|
+
- gitlab-qa-run-*
|
81
81
|
reports:
|
82
82
|
junit: gitlab-qa-run-*/**/rspec-*.xml
|
83
83
|
script:
|
@@ -125,12 +125,6 @@ rspec:
|
|
125
125
|
- 7gb
|
126
126
|
- triggered-packages
|
127
127
|
|
128
|
-
.knapsack-variables:
|
129
|
-
variables:
|
130
|
-
KNAPSACK_REPORT_PATH: "knapsack/master_report.json"
|
131
|
-
KNAPSACK_TEST_FILE_PATTERN: "qa/specs/features/**/*_spec.rb"
|
132
|
-
KNAPSACK_GENERATE_REPORT: "true"
|
133
|
-
|
134
128
|
.rspec-report-opts:
|
135
129
|
variables:
|
136
130
|
FILE_SAFE_JOB_NAME: $(echo $CI_JOB_NAME | sed 's/[ /]/_/g')
|
@@ -174,7 +168,6 @@ ce:custom-parallel:
|
|
174
168
|
- .rspec-report-opts
|
175
169
|
- .no-issue-report-script
|
176
170
|
- .ce-variables
|
177
|
-
|
178
171
|
allow_failure: true
|
179
172
|
parallel: 10
|
180
173
|
|
@@ -195,7 +188,6 @@ ce:instance-parallel:
|
|
195
188
|
- .test
|
196
189
|
- .high-capacity
|
197
190
|
- .ce-variables
|
198
|
-
- .knapsack-variables
|
199
191
|
- .rspec-report-opts
|
200
192
|
parallel: 5
|
201
193
|
|
@@ -224,7 +216,6 @@ ee:instance-parallel:
|
|
224
216
|
- .test
|
225
217
|
- .high-capacity
|
226
218
|
- .ee-variables
|
227
|
-
- .knapsack-variables
|
228
219
|
- .rspec-report-opts
|
229
220
|
parallel: 5
|
230
221
|
|
@@ -253,7 +244,6 @@ ce:relative_url-parallel:
|
|
253
244
|
- .test
|
254
245
|
- .high-capacity
|
255
246
|
- .ce-variables
|
256
|
-
- .knapsack-variables
|
257
247
|
- .rspec-report-opts
|
258
248
|
parallel: 5
|
259
249
|
variables:
|
@@ -287,7 +277,6 @@ ee:relative_url-parallel:
|
|
287
277
|
- .test
|
288
278
|
- .high-capacity
|
289
279
|
- .ee-variables
|
290
|
-
- .knapsack-variables
|
291
280
|
- .rspec-report-opts
|
292
281
|
parallel: 5
|
293
282
|
variables:
|
@@ -381,7 +370,6 @@ ce:update-parallel:
|
|
381
370
|
- .high-capacity
|
382
371
|
- .ce-variables
|
383
372
|
- .rspec-report-opts
|
384
|
-
- .knapsack-variables
|
385
373
|
- .update-scenario-script
|
386
374
|
parallel: 5
|
387
375
|
|
@@ -413,7 +401,6 @@ ee:update-parallel:
|
|
413
401
|
- .high-capacity
|
414
402
|
- .ee-variables
|
415
403
|
- .rspec-report-opts
|
416
|
-
- .knapsack-variables
|
417
404
|
- .update-scenario-script
|
418
405
|
parallel: 10
|
419
406
|
|
@@ -446,7 +433,6 @@ ce:upgrade-parallel:
|
|
446
433
|
- .test
|
447
434
|
- .high-capacity
|
448
435
|
- .rspec-report-opts
|
449
|
-
- .knapsack-variables
|
450
436
|
parallel: 5
|
451
437
|
|
452
438
|
ce:upgrade:
|
@@ -549,7 +535,7 @@ ee:service_ping_disabled:
|
|
549
535
|
variables:
|
550
536
|
QA_SCENARIO: "Test::Integration::ServicePingDisabled"
|
551
537
|
|
552
|
-
# Disabling geo jobs temporarily due to https://gitlab.com/gitlab-org/
|
538
|
+
# Disabling geo jobs temporarily due to https://gitlab.com/gitlab-org/quality/team-tasks/-/issues/774
|
553
539
|
# ee:geo:
|
554
540
|
# extends:
|
555
541
|
# - .test
|
@@ -1011,7 +997,6 @@ ce:praefect-parallel:
|
|
1011
997
|
- .test
|
1012
998
|
- .high-capacity
|
1013
999
|
- .ce-variables
|
1014
|
-
- .knapsack-variables
|
1015
1000
|
- .rspec-report-opts
|
1016
1001
|
parallel: 5
|
1017
1002
|
variables:
|
@@ -1048,7 +1033,6 @@ ee:praefect-parallel:
|
|
1048
1033
|
- .test
|
1049
1034
|
- .high-capacity
|
1050
1035
|
- .ee-variables
|
1051
|
-
- .knapsack-variables
|
1052
1036
|
- .rspec-report-opts
|
1053
1037
|
parallel: 10
|
1054
1038
|
variables:
|
@@ -1225,6 +1209,33 @@ ee:large-setup:
|
|
1225
1209
|
variables:
|
1226
1210
|
QA_RSPEC_TAGS: "--tag can_use_large_setup"
|
1227
1211
|
|
1212
|
+
ee:cloud-activation:
|
1213
|
+
before_script:
|
1214
|
+
- unset EE_LICENSE
|
1215
|
+
- !reference [default, before_script]
|
1216
|
+
extends:
|
1217
|
+
- .rules:ee-never-when-triggered-by-feature-flag-definition-change
|
1218
|
+
- .test
|
1219
|
+
- .high-capacity
|
1220
|
+
- .ee-variables
|
1221
|
+
- .rspec-report-opts
|
1222
|
+
variables:
|
1223
|
+
QA_RSPEC_TAGS: "--tag cloud_activation"
|
1224
|
+
|
1225
|
+
ee:cloud-activation-quarantine:
|
1226
|
+
before_script:
|
1227
|
+
- unset EE_LICENSE
|
1228
|
+
- !reference [default, before_script]
|
1229
|
+
extends:
|
1230
|
+
- .rules:ee-never-when-triggered-by-feature-flag-definition-change
|
1231
|
+
- .test
|
1232
|
+
- .high-capacity
|
1233
|
+
- .ee-variables
|
1234
|
+
- .quarantine
|
1235
|
+
- .rspec-report-opts
|
1236
|
+
variables:
|
1237
|
+
QA_RSPEC_TAGS: "--tag cloud_activation"
|
1238
|
+
|
1228
1239
|
# This job requires the `GITLAB_QA_ACCESS_TOKEN` and `GITLAB_QA_DEV_ACCESS_TOKEN`
|
1229
1240
|
# variable to be passed when triggered.
|
1230
1241
|
staging:
|
@@ -1348,9 +1359,17 @@ generate-allure-report:
|
|
1348
1359
|
- if: '$TOP_UPSTREAM_SOURCE_PROJECT && $TOP_UPSTREAM_SOURCE_SHA'
|
1349
1360
|
when: always
|
1350
1361
|
|
1362
|
+
generate-knapsack-report:
|
1363
|
+
extends: .generate-knapsack-report-base
|
1364
|
+
image:
|
1365
|
+
name: ${QA_IMAGE}
|
1366
|
+
stage: report
|
1367
|
+
|
1351
1368
|
include:
|
1352
1369
|
- local: .gitlab/ci/*.gitlab-ci.yml
|
1353
1370
|
- project: 'gitlab-org/quality/pipeline-common'
|
1354
1371
|
file: '/ci/gem-release.yml'
|
1355
1372
|
- project: 'gitlab-org/quality/pipeline-common'
|
1356
1373
|
file: '/ci/allure-report.yml'
|
1374
|
+
- project: 'gitlab-org/quality/pipeline-common'
|
1375
|
+
file: '/ci/knapsack-report.yml'
|
@@ -59,6 +59,7 @@ All environment variables used by GitLab QA should be defined in [`lib/gitlab/qa
|
|
59
59
|
| `GITLAB_QA_ADMIN_ACCESS_TOKEN` |- | A valid personal access token with the `api` scope from a user with admin access. Used for API access as an admin during tests. | No|
|
60
60
|
| `GITLAB_QA_CONTAINER_REGISTRY_ACCESS_TOKEN` | - | A valid personal access token with the `read_registry` scope. Used to [access the container registry on `registry.gitlab.com` when tests run in a CI job that _is not_ triggered via another pipeline](https://gitlab.com/gitlab-org/gitlab-qa/-/blob/364addb83e7b136ff0f9d8719ca9553d290aa9ab/lib/gitlab/qa/release.rb#L152). For example, if you manually run a [new Staging pipeline](https://ops.gitlab.net/gitlab-org/quality/staging/-/pipelines/new), this token will be used. | No |
|
61
61
|
| `EE_LICENSE` |- | Enterprise Edition license. | No|
|
62
|
+
| `QA_EE_ACTIVATION_CODE` |- | Cloud activation code to enable Enterprise Edition features. | No|
|
62
63
|
| `QA_ARTIFACTS_DIR` |`/tmp/gitlab-qa`| Path to a directory where artifacts (logs and screenshots) for failing tests will be saved. | No|
|
63
64
|
| `DOCKER_HOST` |`http://localhost`| Docker host to run tests against. | No|
|
64
65
|
| `WEBDRIVER_HEADLESS` |- | When running locally, set to `false` to allow Chrome tests to be visible - watch your tests being run. | No|
|
data/gitlab-qa.gemspec
CHANGED
@@ -31,5 +31,6 @@ Gem::Specification.new do |spec|
|
|
31
31
|
spec.add_runtime_dependency 'gitlab', '~> 4.18.0'
|
32
32
|
spec.add_runtime_dependency 'http', '~> 5.0'
|
33
33
|
spec.add_runtime_dependency 'nokogiri', '~> 1.10'
|
34
|
+
spec.add_runtime_dependency 'rainbow', '~> 3.0.0'
|
34
35
|
spec.add_runtime_dependency 'table_print', '1.5.7'
|
35
36
|
end
|
@@ -12,7 +12,7 @@ module Gitlab
|
|
12
12
|
class Gitlab < Base
|
13
13
|
extend Forwardable
|
14
14
|
|
15
|
-
attr_reader :release, :omnibus_configuration
|
15
|
+
attr_reader :release, :omnibus_configuration, :omnibus_gitlab_rails_env
|
16
16
|
attr_accessor :tls, :skip_availability_check, :runner_network
|
17
17
|
attr_writer :name, :relative_path
|
18
18
|
|
@@ -29,6 +29,7 @@ module Gitlab
|
|
29
29
|
super
|
30
30
|
|
31
31
|
@skip_availability_check = false
|
32
|
+
@omnibus_gitlab_rails_env = {}
|
32
33
|
|
33
34
|
@volumes[GITLAB_CERTIFICATES_PATH] = SSL_PATH
|
34
35
|
@volumes[AUTHORITY_CERTIFICATES_PATH] = TRUSTED_PATH
|
@@ -41,7 +42,14 @@ module Gitlab
|
|
41
42
|
def set_formless_login_token
|
42
43
|
return if Runtime::Env.gitlab_qa_formless_login_token.to_s.strip.empty?
|
43
44
|
|
44
|
-
@
|
45
|
+
@omnibus_gitlab_rails_env['GITLAB_QA_FORMLESS_LOGIN_TOKEN'] = Runtime::Env.gitlab_qa_formless_login_token
|
46
|
+
end
|
47
|
+
|
48
|
+
def set_license_mode
|
49
|
+
return unless Runtime::Env.test_license_mode?
|
50
|
+
|
51
|
+
@omnibus_gitlab_rails_env['GITLAB_LICENSE_MODE'] = 'test'
|
52
|
+
@omnibus_gitlab_rails_env['CUSTOMER_PORTAL_URL'] = 'https://customers.staging.gitlab.com'
|
45
53
|
end
|
46
54
|
|
47
55
|
def elastic_url=(url)
|
@@ -95,6 +103,9 @@ module Gitlab
|
|
95
103
|
|
96
104
|
def prepare_gitlab_omnibus_config
|
97
105
|
set_formless_login_token
|
106
|
+
set_license_mode
|
107
|
+
|
108
|
+
@omnibus_configuration << "gitlab_rails['env'] = #{@omnibus_gitlab_rails_env}" unless omnibus_gitlab_rails_env.empty?
|
98
109
|
end
|
99
110
|
|
100
111
|
def start # rubocop:disable Metrics/AbcSize
|
@@ -17,7 +17,7 @@ module Gitlab
|
|
17
17
|
end
|
18
18
|
|
19
19
|
def perform
|
20
|
-
return
|
20
|
+
return Runtime::Logger.info("Skipping tests.") if skip_tests?
|
21
21
|
|
22
22
|
raise ArgumentError unless [suite, release].all?
|
23
23
|
|
@@ -25,7 +25,7 @@ module Gitlab
|
|
25
25
|
|
26
26
|
@docker.pull(image: qa_image) unless Runtime::Env.skip_pull?
|
27
27
|
|
28
|
-
|
28
|
+
Runtime::Logger.info("Running test suite `#{suite}` for #{release.project_name}")
|
29
29
|
|
30
30
|
name = "#{release.project_name}-qa-#{SecureRandom.hex(4)}"
|
31
31
|
|
@@ -71,7 +71,7 @@ module Gitlab
|
|
71
71
|
def args_with_flags(args, feature_flag_set)
|
72
72
|
return args if feature_flag_set.empty?
|
73
73
|
|
74
|
-
|
74
|
+
Runtime::Logger.info("Running with feature flag: #{feature_flag_set.join(' ')}")
|
75
75
|
|
76
76
|
args_with_f = args.dup
|
77
77
|
args_with_f.insert(1, *feature_flag_set)
|
@@ -1,16 +1,19 @@
|
|
1
1
|
require 'open3'
|
2
|
+
require 'rainbow/refinement'
|
2
3
|
|
3
4
|
module Gitlab
|
4
5
|
module QA
|
5
6
|
module Docker
|
6
7
|
class Shellout
|
8
|
+
using Rainbow
|
7
9
|
StatusError = Class.new(StandardError)
|
8
10
|
|
9
11
|
def initialize(command)
|
10
12
|
@command = command
|
11
13
|
@output = []
|
12
14
|
|
13
|
-
|
15
|
+
Rainbow.enabled = Runtime::Env.colorized_logs?
|
16
|
+
Runtime::Logger.info("Docker shell command: `#{@command.mask_secrets}`".cyan)
|
14
17
|
end
|
15
18
|
|
16
19
|
def execute! # rubocop:disable Metrics/AbcSize
|
@@ -28,7 +31,7 @@ module Gitlab
|
|
28
31
|
end
|
29
32
|
|
30
33
|
if wait.value.exited? && wait.value.exitstatus.nonzero? # rubocop:disable Style/IfUnlessModifier
|
31
|
-
raise StatusError, "Docker command `#{@command.mask_secrets}` failed!"
|
34
|
+
raise StatusError, "Docker command `#{@command.mask_secrets}` failed! ✘"
|
32
35
|
end
|
33
36
|
end
|
34
37
|
|
@@ -1,5 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require 'erb'
|
4
|
+
|
3
5
|
module Gitlab
|
4
6
|
module QA
|
5
7
|
module Report
|
@@ -59,7 +61,28 @@ module Gitlab
|
|
59
61
|
end
|
60
62
|
|
61
63
|
def new_issue_description(test)
|
62
|
-
"#{super}#{
|
64
|
+
"#{super}\n\n#{execution_graph_section(test)}"
|
65
|
+
end
|
66
|
+
|
67
|
+
def execution_graph_section(test)
|
68
|
+
formatted_title = ERB::Util.url_encode(test.name)
|
69
|
+
|
70
|
+
<<~MKDOWN.strip
|
71
|
+
### Executions
|
72
|
+
|
73
|
+
package-and-qa:
|
74
|
+
<img src="https://dashboards.quality.gitlab.net/render/d-solo/cW0UMgv7k/spec-health?orgId=1&var-run_type=package-and-qa&var-name=#{formatted_title}&panelId=4&width=1000&height=500" />
|
75
|
+
MKDOWN
|
76
|
+
end
|
77
|
+
|
78
|
+
def updated_description(testcase, test)
|
79
|
+
historical_results_section = testcase.description.match(/### DO NOT EDIT BELOW THIS LINE[\s\S]+/)
|
80
|
+
|
81
|
+
"#{new_issue_description(test)}\n\n#{historical_results_section}"
|
82
|
+
end
|
83
|
+
|
84
|
+
def issue_title_needs_updating?(testcase, test)
|
85
|
+
super || !testcase.description.include?(execution_graph_section(test)) && !%w[canary production preprod release].include?(pipeline)
|
63
86
|
end
|
64
87
|
end
|
65
88
|
end
|
@@ -47,9 +47,14 @@ module Gitlab
|
|
47
47
|
end
|
48
48
|
|
49
49
|
def update_issue_title(issue, test)
|
50
|
-
|
50
|
+
old_title = issue.title.strip
|
51
|
+
new_title = title_from_test(test)
|
51
52
|
|
52
|
-
|
53
|
+
warn(%(#{issue_type} title needs to be updated from '#{old_title}' to '#{new_title}'))
|
54
|
+
|
55
|
+
new_description = updated_description(issue, test)
|
56
|
+
|
57
|
+
gitlab.edit_issue(iid: issue.iid, options: { title: new_title, description: new_description })
|
53
58
|
end
|
54
59
|
|
55
60
|
private
|
@@ -1,10 +1,13 @@
|
|
1
|
+
require 'active_support/core_ext/object/blank'
|
1
2
|
require 'securerandom'
|
3
|
+
require 'rainbow/refinement'
|
2
4
|
|
3
5
|
module Gitlab
|
4
6
|
module QA
|
5
7
|
module Runtime
|
6
8
|
module Env
|
7
9
|
extend self
|
10
|
+
using Rainbow
|
8
11
|
|
9
12
|
# Variables that are used in tests and are passed through to the docker container that executes the tests.
|
10
13
|
# These variables should be listed in /docs/what_tests_can_be_run.md#supported-gitlab-environment-variables
|
@@ -33,6 +36,7 @@ module Gitlab
|
|
33
36
|
'QA_SLOW_CONNECTION_LATENCY_MS' => :qa_slow_connection_latency_ms,
|
34
37
|
'QA_SLOW_CONNECTION_THROUGHPUT_KBPS' => :qa_slow_connection_throughput_kbps,
|
35
38
|
'QA_GENERATE_ALLURE_REPORT' => :generate_allure_report,
|
39
|
+
'QA_EE_ACTIVATION_CODE' => :ee_activation_code,
|
36
40
|
'QA_EXPORT_TEST_METRICS' => :qa_export_test_metrics,
|
37
41
|
'QA_INFLUXDB_URL' => :qa_influxdb_url,
|
38
42
|
'QA_INFLUXDB_TOKEN' => :qa_influxdb_token,
|
@@ -76,6 +80,7 @@ module Gitlab
|
|
76
80
|
'KNAPSACK_REPORT_PATH' => :knapsack_report_path,
|
77
81
|
'KNAPSACK_TEST_FILE_PATTERN' => :knapsack_test_file_pattern,
|
78
82
|
'KNAPSACK_TEST_DIR' => :knapsack_test_dir,
|
83
|
+
'QA_KNAPSACK_REPORT_GCS_CREDENTIALS' => :qa_knapsack_report_gcs_credentials,
|
79
84
|
'CI' => :ci,
|
80
85
|
'CI_COMMIT_REF_NAME' => :ci_commit_ref_name,
|
81
86
|
'CI_JOB_NAME' => :ci_job_name,
|
@@ -124,14 +129,15 @@ module Gitlab
|
|
124
129
|
'GCS_BUCKET_NAME' => :gcs_bucket_name,
|
125
130
|
'SMOKE_ONLY' => :smoke_only,
|
126
131
|
'NO_ADMIN' => :no_admin,
|
127
|
-
'CHROME_DISABLE_DEV_SHM' => :chrome_disable_dev_shm
|
132
|
+
'CHROME_DISABLE_DEV_SHM' => :chrome_disable_dev_shm,
|
133
|
+
'COLORIZED_LOGS' => :colorized_logs
|
128
134
|
}.freeze
|
129
135
|
|
130
136
|
ENV_VARIABLES.each do |env_name, method_name|
|
131
137
|
attr_writer(method_name)
|
132
138
|
|
133
139
|
define_method(method_name) do
|
134
|
-
|
140
|
+
env_var_value_if_defined(env_name) || (instance_variable_get("@#{method_name}") if instance_variable_defined?("@#{method_name}"))
|
135
141
|
end
|
136
142
|
end
|
137
143
|
|
@@ -141,36 +147,40 @@ module Gitlab
|
|
141
147
|
ENV_VARIABLES.each do |name, attribute|
|
142
148
|
# Variables that are overridden in the environment take precedence
|
143
149
|
# over the defaults specified by the QA runtime.
|
144
|
-
value =
|
150
|
+
value = env_var_name_if_defined(name) || send(attribute) # rubocop:disable GitlabSecurity/PublicSend
|
145
151
|
vars[name] = value if value
|
146
152
|
end
|
147
153
|
|
148
154
|
vars
|
149
155
|
end
|
150
156
|
|
157
|
+
def debug?
|
158
|
+
enabled?(ENV['QA_DEBUG'], default: true)
|
159
|
+
end
|
160
|
+
|
151
161
|
def default_branch
|
152
|
-
|
162
|
+
env_var_value_if_defined('QA_DEFAULT_BRANCH') || 'main'
|
153
163
|
end
|
154
164
|
|
155
165
|
def gitlab_availability_timeout
|
156
|
-
|
166
|
+
(env_var_value_if_defined('GITLAB_QA_AVAILABILITY_TIMEOUT') || 360).to_i
|
157
167
|
end
|
158
168
|
|
159
169
|
def gitlab_username
|
160
|
-
|
170
|
+
env_var_value_if_defined('GITLAB_USERNAME') || 'gitlab-qa'
|
161
171
|
end
|
162
172
|
|
163
173
|
def gitlab_dev_username
|
164
|
-
|
174
|
+
env_var_value_if_defined('GITLAB_DEV_USERNAME') || 'gitlab-qa-bot'
|
165
175
|
end
|
166
176
|
|
167
177
|
def gitlab_api_base
|
168
|
-
|
178
|
+
env_var_value_if_defined('GITLAB_API_BASE') || 'https://gitlab.com/api/v4'
|
169
179
|
end
|
170
180
|
|
171
181
|
def pipeline_from_project_name
|
172
182
|
if ci_project_name.to_s.start_with?('gitlab-qa')
|
173
|
-
if
|
183
|
+
if env_var_value_if_defined('TOP_UPSTREAM_SOURCE_JOB').to_s.start_with?('https://ops.gitlab.net')
|
174
184
|
'staging-orchestrated'
|
175
185
|
else
|
176
186
|
QA::Runtime::Env.default_branch
|
@@ -184,24 +194,28 @@ module Gitlab
|
|
184
194
|
@run_id ||= "gitlab-qa-run-#{Time.now.strftime('%Y-%m-%d-%H-%M-%S')}-#{SecureRandom.hex(4)}"
|
185
195
|
end
|
186
196
|
|
197
|
+
def colorized_logs?
|
198
|
+
enabled?(ENV['COLORIZED_LOGS'], default: false)
|
199
|
+
end
|
200
|
+
|
187
201
|
def dev_access_token_variable
|
188
|
-
|
202
|
+
env_var_name_if_defined('GITLAB_QA_DEV_ACCESS_TOKEN')
|
189
203
|
end
|
190
204
|
|
191
205
|
def initial_root_password
|
192
|
-
|
206
|
+
env_var_value_if_defined('GITLAB_INITIAL_ROOT_PASSWORD') || '5iveL!fe'
|
193
207
|
end
|
194
208
|
|
195
209
|
def deploy_environment
|
196
|
-
|
210
|
+
env_var_value_if_defined('DEPLOY_ENVIRONMENT') || pipeline_from_project_name
|
197
211
|
end
|
198
212
|
|
199
213
|
def host_artifacts_dir
|
200
|
-
@host_artifacts_dir ||= File.join(
|
214
|
+
@host_artifacts_dir ||= File.join(env_var_value_if_defined('QA_ARTIFACTS_DIR') || '/tmp/gitlab-qa', Runtime::Env.run_id)
|
201
215
|
end
|
202
216
|
|
203
217
|
def elastic_version
|
204
|
-
|
218
|
+
env_var_value_if_defined('ELASTIC_VERSION') || '6.4.2'.freeze
|
205
219
|
end
|
206
220
|
|
207
221
|
def require_license!
|
@@ -217,25 +231,25 @@ module Gitlab
|
|
217
231
|
end
|
218
232
|
|
219
233
|
def require_qa_access_token!
|
220
|
-
return unless
|
234
|
+
return unless env_var_value_if_defined('GITLAB_QA_ACCESS_TOKEN').to_s.strip.empty?
|
221
235
|
|
222
236
|
raise ArgumentError, "Please provide GITLAB_QA_ACCESS_TOKEN"
|
223
237
|
end
|
224
238
|
|
225
239
|
def require_qa_dev_access_token!
|
226
|
-
return unless
|
240
|
+
return unless env_var_value_if_defined('GITLAB_QA_DEV_ACCESS_TOKEN').to_s.strip.empty?
|
227
241
|
|
228
242
|
raise ArgumentError, "Please provide GITLAB_QA_DEV_ACCESS_TOKEN"
|
229
243
|
end
|
230
244
|
|
231
245
|
def require_slack_qa_channel!
|
232
|
-
return unless
|
246
|
+
return unless env_var_value_if_defined('SLACK_QA_CHANNEL').to_s.strip.empty?
|
233
247
|
|
234
248
|
raise ArgumentError, "Please provide SLACK_QA_CHANNEL"
|
235
249
|
end
|
236
250
|
|
237
251
|
def require_ci_slack_webhook_url!
|
238
|
-
return unless
|
252
|
+
return unless env_var_value_if_defined('CI_SLACK_WEBHOOK_URL').to_s.strip.empty?
|
239
253
|
|
240
254
|
raise ArgumentError, "Please provide CI_SLACK_WEBHOOK_URL"
|
241
255
|
end
|
@@ -265,7 +279,7 @@ module Gitlab
|
|
265
279
|
end
|
266
280
|
|
267
281
|
def require_initial_password!
|
268
|
-
return unless
|
282
|
+
return unless env_var_value_if_defined('GITLAB_INITIAL_ROOT_PASSWORD').to_s.strip.empty?
|
269
283
|
|
270
284
|
raise(
|
271
285
|
ArgumentError,
|
@@ -289,11 +303,15 @@ module Gitlab
|
|
289
303
|
end
|
290
304
|
|
291
305
|
def skip_pull?
|
292
|
-
enabled?(
|
306
|
+
enabled?(env_var_value_if_defined('QA_SKIP_PULL'), default: false)
|
293
307
|
end
|
294
308
|
|
295
309
|
def geo_failover?
|
296
|
-
enabled?(
|
310
|
+
enabled?(env_var_value_if_defined('GEO_FAILOVER'), default: false)
|
311
|
+
end
|
312
|
+
|
313
|
+
def test_license_mode?
|
314
|
+
enabled?(env_var_value_if_defined('TEST_LICENSE_MODE'), default: false)
|
297
315
|
end
|
298
316
|
|
299
317
|
private
|
@@ -304,9 +322,17 @@ module Gitlab
|
|
304
322
|
(value =~ /^(false|no|0)$/i) != 0
|
305
323
|
end
|
306
324
|
|
307
|
-
def
|
308
|
-
|
309
|
-
|
325
|
+
def env_var_value_valid?(variable)
|
326
|
+
!ENV[variable].blank?
|
327
|
+
end
|
328
|
+
|
329
|
+
def env_var_value_if_defined(variable)
|
330
|
+
return ENV[variable] if env_var_value_valid?(variable)
|
331
|
+
end
|
332
|
+
|
333
|
+
def env_var_name_if_defined(variable)
|
334
|
+
# Pass through the variables if they are defined and not empty in the environment
|
335
|
+
return "$#{variable}" if env_var_value_valid?(variable)
|
310
336
|
end
|
311
337
|
end
|
312
338
|
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'logger'
|
4
|
+
require 'forwardable'
|
5
|
+
require'rainbow/refinement'
|
6
|
+
|
7
|
+
module Gitlab
|
8
|
+
module QA
|
9
|
+
module Runtime
|
10
|
+
module Logger
|
11
|
+
extend SingleForwardable
|
12
|
+
using Rainbow
|
13
|
+
|
14
|
+
def_delegators :logger, :debug, :info, :warn, :error, :fatal, :unknown
|
15
|
+
|
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
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -12,7 +12,7 @@ module Gitlab
|
|
12
12
|
gitlab.omnibus_configuration << "actioncable['enable'] = true"
|
13
13
|
|
14
14
|
gitlab.instance do
|
15
|
-
|
15
|
+
Runtime::Logger.info('Running actioncable specs!')
|
16
16
|
|
17
17
|
rspec_args << "--" unless rspec_args.include?('--')
|
18
18
|
rspec_args << %w[--tag actioncable]
|
@@ -64,7 +64,7 @@ module Gitlab
|
|
64
64
|
prepare; start; reconfigure; process_exec_commands
|
65
65
|
|
66
66
|
# shellout to instance specs
|
67
|
-
|
67
|
+
Runtime::Logger.info('Running Geo primary / secondary specs!')
|
68
68
|
|
69
69
|
Component::Specs.perform do |specs|
|
70
70
|
specs.suite = 'QA::EE::Scenario::Test::Geo'
|
@@ -50,7 +50,7 @@ module Gitlab
|
|
50
50
|
|
51
51
|
gitlab.omnibus_configuration << gitlab_omnibus_configuration
|
52
52
|
gitlab.instance do
|
53
|
-
|
53
|
+
Runtime::Logger.info('Running Gitaly Cluster specs!')
|
54
54
|
|
55
55
|
if @tag
|
56
56
|
rspec_args << "--" unless rspec_args.include?('--')
|
@@ -47,7 +47,7 @@ module Gitlab
|
|
47
47
|
|
48
48
|
retry_count += 1
|
49
49
|
wait_seconds = response["retry-after"].to_i
|
50
|
-
|
50
|
+
Runtime::Logger.debug("Received 429 - Too many requests. Waiting for #{wait_seconds} seconds.")
|
51
51
|
sleep wait_seconds
|
52
52
|
end
|
53
53
|
|
data/lib/gitlab/qa/version.rb
CHANGED
data/lib/gitlab/qa.rb
CHANGED
@@ -9,6 +9,7 @@ module Gitlab
|
|
9
9
|
autoload :Scenario, 'gitlab/qa/runtime/scenario'
|
10
10
|
autoload :TokenFinder, 'gitlab/qa/runtime/token_finder'
|
11
11
|
autoload :OmnibusConfiguration, 'gitlab/qa/runtime/omnibus_configuration'
|
12
|
+
autoload :Logger, 'gitlab/qa/runtime/logger'
|
12
13
|
|
13
14
|
module OmnibusConfigurations
|
14
15
|
autoload :Default, 'gitlab/qa/runtime/omnibus_configurations/default'
|
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.
|
4
|
+
version: 7.20.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- GitLab Quality
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-01-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: climate_control
|
@@ -164,6 +164,20 @@ dependencies:
|
|
164
164
|
- - "~>"
|
165
165
|
- !ruby/object:Gem::Version
|
166
166
|
version: '1.10'
|
167
|
+
- !ruby/object:Gem::Dependency
|
168
|
+
name: rainbow
|
169
|
+
requirement: !ruby/object:Gem::Requirement
|
170
|
+
requirements:
|
171
|
+
- - "~>"
|
172
|
+
- !ruby/object:Gem::Version
|
173
|
+
version: 3.0.0
|
174
|
+
type: :runtime
|
175
|
+
prerelease: false
|
176
|
+
version_requirements: !ruby/object:Gem::Requirement
|
177
|
+
requirements:
|
178
|
+
- - "~>"
|
179
|
+
- !ruby/object:Gem::Version
|
180
|
+
version: 3.0.0
|
167
181
|
- !ruby/object:Gem::Dependency
|
168
182
|
name: table_print
|
169
183
|
requirement: !ruby/object:Gem::Requirement
|
@@ -266,6 +280,7 @@ files:
|
|
266
280
|
- lib/gitlab/qa/reporter.rb
|
267
281
|
- lib/gitlab/qa/runner.rb
|
268
282
|
- lib/gitlab/qa/runtime/env.rb
|
283
|
+
- lib/gitlab/qa/runtime/logger.rb
|
269
284
|
- lib/gitlab/qa/runtime/omnibus_configuration.rb
|
270
285
|
- lib/gitlab/qa/runtime/omnibus_configurations/default.rb
|
271
286
|
- lib/gitlab/qa/runtime/omnibus_configurations/license_mode.rb
|