gitlab-qa 7.17.0 → 7.19.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitlab-ci.yml +37 -18
- data/docs/what_tests_can_be_run.md +5 -0
- data/gitlab-qa.gemspec +2 -1
- 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 +9 -4
- data/lib/gitlab/qa/docker/shellout.rb +5 -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/instance/image.rb +1 -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 +3 -1
- data/lib/gitlab/qa.rb +1 -0
- metadata +19 -4
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 7314a9036c9aeacae478aaf82d13baee97c53c94bf5aabe800ec0e9f98b5234d
|
|
4
|
+
data.tar.gz: 83fe883428323a6edc87c1993564de31dcd5afc79aada90798ea07d93a1b09fb
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 7e3d05561762175dae31c8298ef4411595287f516f3fc809457e842c368a7ea712c6c2f697a1c1849c1ff26b060b68220327e5d3cb5e5792426bb886881a233a
|
|
7
|
+
data.tar.gz: 062b24dfdf48a7da1d309b0282f4972d1f6e72dbb2ad4a44f2ad8c2c352f3684ff0b423390070dcc83c9228b19597bc0ddfee94aef017810f5283c673511e472
|
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|
|
|
@@ -703,6 +704,9 @@ in the GitLab project).
|
|
|
703
704
|
|
|
704
705
|
**Required environment variables:**
|
|
705
706
|
|
|
707
|
+
- `GITLAB_QA_USER_AGENT`: The browser user-agent to use instead of the default Chrome user-agent.
|
|
708
|
+
This is needed for the automated tests to bypass the WAF
|
|
709
|
+
|
|
706
710
|
- `GITLAB_QA_ACCESS_TOKEN`: A valid personal access token with the `api` scope.
|
|
707
711
|
This is used to retrieve the version that staging is currently running.
|
|
708
712
|
This can be found in the shared 1Password vault.
|
|
@@ -718,6 +722,7 @@ in the GitLab project).
|
|
|
718
722
|
Example:
|
|
719
723
|
|
|
720
724
|
```
|
|
725
|
+
$ export GITLAB_QA_USER_AGENT="$GITLAB_QA_USER_AGENT"
|
|
721
726
|
$ export GITLAB_QA_ACCESS_TOKEN=your_api_access_token
|
|
722
727
|
$ export GITLAB_QA_DEV_ACCESS_TOKEN=your_dev_registry_access_token
|
|
723
728
|
$ export GITLAB_USERNAME="gitlab-qa"
|
data/gitlab-qa.gemspec
CHANGED
|
@@ -28,8 +28,9 @@ Gem::Specification.new do |spec|
|
|
|
28
28
|
spec.add_development_dependency 'solargraph', '~> 0.41'
|
|
29
29
|
spec.add_development_dependency 'webmock', '3.7.0'
|
|
30
30
|
spec.add_runtime_dependency 'activesupport', '~> 6.1'
|
|
31
|
-
spec.add_runtime_dependency 'gitlab', '~> 4.
|
|
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
|
|
@@ -8,7 +8,7 @@ module Gitlab
|
|
|
8
8
|
# the `qa/` directory located in GitLab CE / EE repositories.
|
|
9
9
|
#
|
|
10
10
|
class Specs < Scenario::Template
|
|
11
|
-
attr_accessor :suite, :release, :network, :args, :volumes, :env, :runner_network
|
|
11
|
+
attr_accessor :suite, :release, :network, :args, :volumes, :env, :runner_network, :hostname
|
|
12
12
|
|
|
13
13
|
def initialize
|
|
14
14
|
@docker = Docker::Engine.new
|
|
@@ -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
|
|
|
@@ -45,6 +45,11 @@ module Gitlab
|
|
|
45
45
|
@docker.run(image: qa_image, args: [suite, *args_with_flags(args, feature_flag_set)]) do |command|
|
|
46
46
|
command << "-t --rm --net=#{network || 'bridge'}"
|
|
47
47
|
|
|
48
|
+
unless hostname.nil?
|
|
49
|
+
command << "--hostname #{hostname}"
|
|
50
|
+
command.env('QA_HOSTNAME', hostname)
|
|
51
|
+
end
|
|
52
|
+
|
|
48
53
|
env.merge(Runtime::Env.variables).each do |key, value|
|
|
49
54
|
command.env(key, value)
|
|
50
55
|
end
|
|
@@ -66,7 +71,7 @@ module Gitlab
|
|
|
66
71
|
def args_with_flags(args, feature_flag_set)
|
|
67
72
|
return args if feature_flag_set.empty?
|
|
68
73
|
|
|
69
|
-
|
|
74
|
+
Runtime::Logger.info("Running with feature flag: #{feature_flag_set.join(' ')}")
|
|
70
75
|
|
|
71
76
|
args_with_f = args.dup
|
|
72
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,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
|
|
@@ -19,6 +19,7 @@ module Gitlab
|
|
|
19
19
|
gitlab.instance do
|
|
20
20
|
Component::Specs.perform do |specs|
|
|
21
21
|
specs.suite = 'Test::Instance::All'
|
|
22
|
+
specs.hostname = "qa-e2e-specs.#{gitlab.network}"
|
|
22
23
|
specs.release = gitlab.release
|
|
23
24
|
specs.network = gitlab.network
|
|
24
25
|
specs.args = [gitlab.address, *rspec_args]
|
|
@@ -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.19.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
|
|
@@ -128,14 +128,14 @@ dependencies:
|
|
|
128
128
|
requirements:
|
|
129
129
|
- - "~>"
|
|
130
130
|
- !ruby/object:Gem::Version
|
|
131
|
-
version: 4.
|
|
131
|
+
version: 4.18.0
|
|
132
132
|
type: :runtime
|
|
133
133
|
prerelease: false
|
|
134
134
|
version_requirements: !ruby/object:Gem::Requirement
|
|
135
135
|
requirements:
|
|
136
136
|
- - "~>"
|
|
137
137
|
- !ruby/object:Gem::Version
|
|
138
|
-
version: 4.
|
|
138
|
+
version: 4.18.0
|
|
139
139
|
- !ruby/object:Gem::Dependency
|
|
140
140
|
name: http
|
|
141
141
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -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
|