gitlab-qa 7.25.1 → 7.27.1
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/jobs/ci_decomposition.gitlab-ci.yml +25 -0
- data/.gitlab/ci/jobs/cloud_activation.gitlab-ci.yml +2 -2
- data/.gitlab/issue_templates/Default.md +2 -0
- data/.gitlab/merge_request_templates/Default.md +2 -0
- data/.gitlab-ci.yml +2 -3
- data/docs/configuring_omnibus.md +4 -4
- data/docs/what_tests_can_be_run.md +10 -0
- data/lib/gitlab/qa/component/base.rb +17 -5
- data/lib/gitlab/qa/component/elasticsearch.rb +1 -0
- data/lib/gitlab/qa/component/gitlab.rb +17 -7
- data/lib/gitlab/qa/report/gitlab_issue_client.rb +12 -0
- data/lib/gitlab/qa/report/relate_failure_issue.rb +28 -4
- data/lib/gitlab/qa/report/test_result.rb +8 -0
- data/lib/gitlab/qa/report/update_screenshot_path.rb +28 -6
- data/lib/gitlab/qa/runner.rb +7 -0
- data/lib/gitlab/qa/runtime/omnibus_configuration.rb +1 -1
- data/lib/gitlab/qa/runtime/omnibus_configurations/ci_decomposition.rb +32 -0
- data/lib/gitlab/qa/scenario/test/instance/deployment_base.rb +5 -0
- data/lib/gitlab/qa/scenario/test/instance/image.rb +3 -1
- data/lib/gitlab/qa/scenario/test/integration/geo.rb +2 -1
- data/lib/gitlab/qa/scenario/test/integration/gitaly_cluster.rb +2 -0
- data/lib/gitlab/qa/scenario/test/integration/mtls.rb +1 -0
- data/lib/gitlab/qa/scenario/test/omnibus/update.rb +1 -0
- data/lib/gitlab/qa/scenario/test/omnibus/upgrade.rb +1 -0
- data/lib/gitlab/qa/version.rb +1 -1
- data/lib/gitlab/qa.rb +1 -0
- data/scripts/generate-qa-jobs.rb +1 -0
- data/support/data/admin_access_token_seed.rb +24 -0
- metadata +5 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: d08b53ffc75578165d38ea6c735882e0fdf9059ece88c1aa91ecdac67df8fa1d
|
|
4
|
+
data.tar.gz: 35091d5ab69c1a88a21ffe839c73d7fc23744517e28f4d6d193c92a7c1bb3252
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 56119714620bfa55ed88e9136d4e5a35e72606996c6bab5e0a613ea16e14653dc50055a54cc4302d26dbd01ceb614ebbf85bca1d8237ffc5f402e36586e6e37e
|
|
7
|
+
data.tar.gz: 47ba7c6b6603cc8982b5fb5a54732550d13c40eea076f0fd46054a104093c2c97016d3e84a468e073e925ed1633f83085414667740230a2b6511ce2d3836b9c8
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
ce:ci_decomposition:
|
|
2
|
+
extends:
|
|
3
|
+
- .rules:ce-never-when-triggered-by-feature-flag-definition-change
|
|
4
|
+
- .rules:ce-never-when-qa-tests-specified
|
|
5
|
+
- .test
|
|
6
|
+
- .high-capacity
|
|
7
|
+
- .ce-variables
|
|
8
|
+
- .rspec-report-opts
|
|
9
|
+
- .combined-gitlab-qa-options-script
|
|
10
|
+
parallel: 5
|
|
11
|
+
variables:
|
|
12
|
+
GITLAB_QA_OPTIONS_COMBINED: "$GITLAB_QA_OPTIONS --omnibus-config ci_decomposition"
|
|
13
|
+
|
|
14
|
+
ee:ci_decomposition:
|
|
15
|
+
extends:
|
|
16
|
+
- .rules:ee-never-when-triggered-by-feature-flag-definition-change
|
|
17
|
+
- .rules:ee-never-when-qa-tests-specified
|
|
18
|
+
- .test
|
|
19
|
+
- .ee-variables
|
|
20
|
+
- .high-capacity
|
|
21
|
+
- .rspec-report-opts
|
|
22
|
+
- .combined-gitlab-qa-options-script
|
|
23
|
+
parallel: 5
|
|
24
|
+
variables:
|
|
25
|
+
GITLAB_QA_OPTIONS_COMBINED: "$GITLAB_QA_OPTIONS --omnibus-config ci_decomposition"
|
|
@@ -11,7 +11,7 @@ ee:cloud-activation:
|
|
|
11
11
|
- .combined-gitlab-qa-options-script
|
|
12
12
|
variables:
|
|
13
13
|
QA_RSPEC_TAGS: "--tag cloud_activation"
|
|
14
|
-
GITLAB_QA_OPTIONS_COMBINED: "$GITLAB_QA_OPTIONS --seed-db license*.rb"
|
|
14
|
+
GITLAB_QA_OPTIONS_COMBINED: "$GITLAB_QA_OPTIONS --no-admin-token --seed-db license*.rb"
|
|
15
15
|
|
|
16
16
|
ee:cloud-activation-quarantine:
|
|
17
17
|
before_script:
|
|
@@ -27,4 +27,4 @@ ee:cloud-activation-quarantine:
|
|
|
27
27
|
- .combined-gitlab-qa-options-script
|
|
28
28
|
variables:
|
|
29
29
|
QA_RSPEC_TAGS: "--tag cloud_activation"
|
|
30
|
-
GITLAB_QA_OPTIONS_COMBINED: "$GITLAB_QA_OPTIONS --seed-db license*.rb"
|
|
30
|
+
GITLAB_QA_OPTIONS_COMBINED: "$GITLAB_QA_OPTIONS --no-admin-token --seed-db license*.rb"
|
|
@@ -11,3 +11,5 @@ If you feel that your issue can be categorized as a reproducible bug or a featur
|
|
|
11
11
|
|
|
12
12
|
Thank you for helping to make GitLab a better product.
|
|
13
13
|
-->
|
|
14
|
+
|
|
15
|
+
<!-- template sourced from https://gitlab.com/gitlab-org/gitlab-qa/-/blob/master/.gitlab/issue_templates/Default.md -->
|
|
@@ -44,3 +44,5 @@ This checklist encourages us to confirm any changes have been analyzed to reduce
|
|
|
44
44
|
* [ ] I have evaluated the [MR acceptance checklist](https://docs.gitlab.com/ee/development/code_review.html#acceptance-checklist) for this MR.
|
|
45
45
|
|
|
46
46
|
/label ~QA ~Quality
|
|
47
|
+
|
|
48
|
+
<!-- template sourced from https://gitlab.com/gitlab-org/gitlab-qa/-/blob/master/.gitlab/merge_request_templates/Default.md -->
|
data/.gitlab-ci.yml
CHANGED
|
@@ -50,9 +50,8 @@ prepare:
|
|
|
50
50
|
extends: .rules:never-on-version-change-or-tag
|
|
51
51
|
script:
|
|
52
52
|
- |
|
|
53
|
-
if [[ $TOP_UPSTREAM_SOURCE_PROJECT == "gitlab-org/gitlab" && -n $
|
|
54
|
-
|
|
55
|
-
export QA_IMAGE_TAG=$(echo "${TOP_UPSTREAM_SOURCE_REF//\//-}" | tr '[:upper:]' '[:lower:]')
|
|
53
|
+
if [[ $TOP_UPSTREAM_SOURCE_PROJECT == "gitlab-org/gitlab" && -n $TOP_UPSTREAM_SOURCE_SHA ]]; then
|
|
54
|
+
export QA_IMAGE_TAG=${TOP_UPSTREAM_SOURCE_SHA}
|
|
56
55
|
else
|
|
57
56
|
export QA_IMAGE_TAG=master
|
|
58
57
|
fi
|
data/docs/configuring_omnibus.md
CHANGED
|
@@ -106,7 +106,7 @@ Multiple Configurators may be specified and the order will be preserved in which
|
|
|
106
106
|
|
|
107
107
|
E.g., given the arguments:
|
|
108
108
|
|
|
109
|
-
```
|
|
109
|
+
```ruby
|
|
110
110
|
exe/gitlab-qa Test::Instance::Image EE --omnibus-config packages,registry
|
|
111
111
|
# or
|
|
112
112
|
exe/gitlab-qa Test::Instance::Image EE --omnibus-config packages --omnibus-config registry
|
|
@@ -136,7 +136,7 @@ Component::Gitlab.perform do |primary|
|
|
|
136
136
|
primary.omnibus_configuration << <<~OMNIBUS
|
|
137
137
|
geo_primary_role['enable'] = true
|
|
138
138
|
OMNIBUS
|
|
139
|
-
|
|
139
|
+
|
|
140
140
|
primary.instance do
|
|
141
141
|
Component::Gitlab.perform do |secondary|
|
|
142
142
|
secondary.omnibus_configuration << <<~OMNIBUS
|
|
@@ -181,10 +181,10 @@ one Omnibus configuration that might be unneccesary or Invalid for the Second In
|
|
|
181
181
|
|
|
182
182
|
1. `Runtime::OmnibusConfigurations::Default`
|
|
183
183
|
1. `Runtime::OmnibusConfigurations::[A,B,...]` where `A` and `B` are Configurators specified through the positional arguments `--a --b`
|
|
184
|
-
1. Custom written `Scenario::Template` (such as `Test::
|
|
184
|
+
1. Custom written `Scenario::Template` (such as `Test::Integration::Geo`)
|
|
185
185
|
1. `lib/gitlab/qa/component/gitlab.rb`
|
|
186
186
|
|
|
187
|
-
From top to bottom, configurations will be loaded and any configurations that are
|
|
187
|
+
From top to bottom, configurations will be loaded and any configurations that are superseded, will take precedence over the one before it, and so on.
|
|
188
188
|
|
|
189
189
|
### Executing arbitrary shell commands within the GitLab Instance
|
|
190
190
|
|
|
@@ -637,6 +637,8 @@ container is spun up and tests are run from it by running the
|
|
|
637
637
|
- `JIRA_ADMIN_USERNAME`: Username for authenticating with Jira server as admin.
|
|
638
638
|
- `JIRA_ADMIN_PASSWORD`: Password for authenticating with Jira server as admin.
|
|
639
639
|
|
|
640
|
+
These values can be found in the shared GitLab QA 1Password vault.
|
|
641
|
+
|
|
640
642
|
Example:
|
|
641
643
|
|
|
642
644
|
```
|
|
@@ -942,6 +944,14 @@ This scenario is a composition of two orchestrated scenarios. It tests the conta
|
|
|
942
944
|
GITLAB_TLS_CERTIFICATE=$(cat /path/to/certificate.crt) gitlab-qa Test::Integration::RegistryTLS EE --omnibus-config object_storage_aws
|
|
943
945
|
```
|
|
944
946
|
|
|
947
|
+
### Test::Instance::Image EE --omnibus-config ci_decomposition
|
|
948
|
+
|
|
949
|
+
This scenario is to run tests against GitLab instance with [decomposed database](https://gitlab.com/groups/gitlab-org/-/epics/6160) on a single Postgres:
|
|
950
|
+
|
|
951
|
+
```ruby
|
|
952
|
+
gitlab-qa Test::Instance::Image EE --omnibus-config ci_decomposition
|
|
953
|
+
```
|
|
954
|
+
|
|
945
955
|
### `Test::Instance::Geo EE|<full image address>:nightly|latest|any_tag http://geo-primary.gitlab http://geo-secondary.gitlab`
|
|
946
956
|
|
|
947
957
|
This scenario will run tests tagged `:geo` against a live Geo deployment, by spinning up a GitLab QA (`gitlab/gitlab-qa`)
|
|
@@ -146,11 +146,23 @@ module Gitlab
|
|
|
146
146
|
end
|
|
147
147
|
|
|
148
148
|
def instance_no_teardown
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
149
|
+
begin
|
|
150
|
+
retries ||= 0
|
|
151
|
+
prepare
|
|
152
|
+
start
|
|
153
|
+
reconfigure
|
|
154
|
+
wait_until_ready
|
|
155
|
+
process_exec_commands
|
|
156
|
+
rescue Docker::Shellout::StatusError => e
|
|
157
|
+
# for scenarios where a service fails during startup, attempt to retry to avoid flaky failures
|
|
158
|
+
if (retries += 1) < 3
|
|
159
|
+
puts "Retry instance_no_teardown due to Docker::Shellout::StatusError -- attempt #{retries}"
|
|
160
|
+
teardown!
|
|
161
|
+
retry
|
|
162
|
+
end
|
|
163
|
+
|
|
164
|
+
raise e
|
|
165
|
+
end
|
|
154
166
|
|
|
155
167
|
yield self if block_given?
|
|
156
168
|
end
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
|
+
# rubocop:disable Metrics/AbcSize
|
|
2
3
|
|
|
3
4
|
require 'securerandom'
|
|
4
5
|
require 'net/http'
|
|
@@ -14,7 +15,7 @@ module Gitlab
|
|
|
14
15
|
extend Forwardable
|
|
15
16
|
|
|
16
17
|
attr_reader :release, :omnibus_configuration, :omnibus_gitlab_rails_env
|
|
17
|
-
attr_accessor :tls, :skip_availability_check, :runner_network
|
|
18
|
+
attr_accessor :tls, :skip_availability_check, :runner_network, :seed_admin_token, :seed_db
|
|
18
19
|
attr_writer :name, :relative_path
|
|
19
20
|
|
|
20
21
|
def_delegators :release, :tag, :image, :edition
|
|
@@ -42,8 +43,10 @@ module Gitlab
|
|
|
42
43
|
@volumes[@gitlab_cert_path] = SSL_PATH
|
|
43
44
|
@volumes[@authority_cert_path] = TRUSTED_PATH
|
|
44
45
|
|
|
46
|
+
@seed_admin_token = Runtime::Scenario.seed_admin_token
|
|
47
|
+
@seed_db = Runtime::Scenario.seed_db
|
|
48
|
+
|
|
45
49
|
self.release = 'CE'
|
|
46
|
-
self.exec_commands += seed_test_data_command if Runtime::Scenario.seed_db
|
|
47
50
|
end
|
|
48
51
|
|
|
49
52
|
def set_formless_login_token
|
|
@@ -154,8 +157,7 @@ module Gitlab
|
|
|
154
157
|
@docker.attach(name) do |line, wait|
|
|
155
158
|
puts line
|
|
156
159
|
# TODO, workaround which allows to detach from the container
|
|
157
|
-
|
|
158
|
-
break if line =~ /gitlab Reconfigured!/
|
|
160
|
+
break if /gitlab Reconfigured!/.match?(line)
|
|
159
161
|
end
|
|
160
162
|
end
|
|
161
163
|
|
|
@@ -163,7 +165,6 @@ module Gitlab
|
|
|
163
165
|
return if skip_availability_check
|
|
164
166
|
|
|
165
167
|
if Availability.new(name, relative_path: relative_path, scheme: scheme, protocol_port: port.to_i).check(Runtime::Env.gitlab_availability_timeout)
|
|
166
|
-
sleep 12 # TODO, handle that better
|
|
167
168
|
puts ' -> GitLab is available.'
|
|
168
169
|
else
|
|
169
170
|
abort ' -> GitLab unavailable!'
|
|
@@ -171,9 +172,13 @@ module Gitlab
|
|
|
171
172
|
end
|
|
172
173
|
|
|
173
174
|
def process_exec_commands
|
|
174
|
-
@docker.copy(name, DATA_SEED_PATH, DATA_PATH) if
|
|
175
|
+
@docker.copy(name, DATA_SEED_PATH, DATA_PATH) if seed_admin_token || seed_db
|
|
176
|
+
|
|
177
|
+
self.exec_commands += seed_admin_token_command if seed_admin_token
|
|
178
|
+
self.exec_commands += seed_test_data_command if seed_db
|
|
175
179
|
|
|
176
|
-
|
|
180
|
+
Runtime::Logger.info("Running exec_commands...")
|
|
181
|
+
exec_commands.flatten.uniq.each { |command| @docker.exec(name, command) }
|
|
177
182
|
end
|
|
178
183
|
|
|
179
184
|
def sha_version
|
|
@@ -231,6 +236,10 @@ module Gitlab
|
|
|
231
236
|
cmd.uniq
|
|
232
237
|
end
|
|
233
238
|
|
|
239
|
+
def seed_admin_token_command
|
|
240
|
+
["gitlab-rails runner #{DATA_PATH}/admin_access_token_seed.rb"]
|
|
241
|
+
end
|
|
242
|
+
|
|
234
243
|
class Availability
|
|
235
244
|
def initialize(name, relative_path: '', scheme: 'http', protocol_port: 80)
|
|
236
245
|
@docker = Docker::Engine.new
|
|
@@ -276,3 +285,4 @@ module Gitlab
|
|
|
276
285
|
end
|
|
277
286
|
end
|
|
278
287
|
end
|
|
288
|
+
# rubocop:enable Metrics/AbcSize
|
|
@@ -101,6 +101,18 @@ module Gitlab
|
|
|
101
101
|
end
|
|
102
102
|
end
|
|
103
103
|
|
|
104
|
+
def upload_file(file_fullpath:)
|
|
105
|
+
ignore_gitlab_client_exceptions do
|
|
106
|
+
Gitlab.upload_file(project, file_fullpath)
|
|
107
|
+
end
|
|
108
|
+
end
|
|
109
|
+
|
|
110
|
+
def ignore_gitlab_client_exceptions
|
|
111
|
+
yield
|
|
112
|
+
rescue StandardError, SystemCallError, OpenSSL::SSL::SSLError, Net::OpenTimeout, Net::ReadTimeout, Gitlab::Error::Error => e
|
|
113
|
+
puts "Ignoring the following error: #{e}"
|
|
114
|
+
end
|
|
115
|
+
|
|
104
116
|
def handle_gitlab_client_exceptions
|
|
105
117
|
yield
|
|
106
118
|
rescue Gitlab::Error::NotFound
|
|
@@ -72,6 +72,8 @@ module Gitlab
|
|
|
72
72
|
issue = super
|
|
73
73
|
puts "for test '#{test.name}'."
|
|
74
74
|
|
|
75
|
+
post_or_update_failed_job_note(issue, test)
|
|
76
|
+
|
|
75
77
|
issue
|
|
76
78
|
end
|
|
77
79
|
|
|
@@ -82,10 +84,17 @@ module Gitlab
|
|
|
82
84
|
end
|
|
83
85
|
end
|
|
84
86
|
|
|
87
|
+
def full_stacktrace(test)
|
|
88
|
+
if test.failures.first['message_lines'].empty?
|
|
89
|
+
test.failures.first['message']
|
|
90
|
+
else
|
|
91
|
+
test.failures.first['message_lines'].join("\n")
|
|
92
|
+
end
|
|
93
|
+
end
|
|
94
|
+
|
|
85
95
|
def find_relevant_failure_issues(test) # rubocop:disable Metrics/AbcSize
|
|
86
96
|
ld = Class.new.extend(Gem::Text).method(:levenshtein_distance)
|
|
87
|
-
|
|
88
|
-
first_test_failure_stacktrace = sanitize_stacktrace(full_stacktrace, FAILURE_STACKTRACE_REGEX) || full_stacktrace
|
|
97
|
+
first_test_failure_stacktrace = sanitize_stacktrace(full_stacktrace(test), FAILURE_STACKTRACE_REGEX) || full_stacktrace(test)
|
|
89
98
|
clean_first_test_failure_stacktrace = remove_unique_resource_names(first_test_failure_stacktrace)
|
|
90
99
|
|
|
91
100
|
# Search with the `search` param returns 500 errors, so we filter by ~QA and then filter further in Ruby
|
|
@@ -156,9 +165,10 @@ module Gitlab
|
|
|
156
165
|
def new_issue_description(test)
|
|
157
166
|
super + [
|
|
158
167
|
"\n\n### Stack trace",
|
|
159
|
-
"```\n#{test
|
|
168
|
+
"```\n#{full_stacktrace(test)}\n```",
|
|
160
169
|
"First happened in #{test.ci_job_url}.",
|
|
161
|
-
"Related test case: #{test.testcase}."
|
|
170
|
+
"Related test case: #{test.testcase}.",
|
|
171
|
+
screenshot_section(test)
|
|
162
172
|
].join("\n\n")
|
|
163
173
|
end
|
|
164
174
|
|
|
@@ -194,6 +204,20 @@ module Gitlab
|
|
|
194
204
|
|
|
195
205
|
false
|
|
196
206
|
end
|
|
207
|
+
|
|
208
|
+
def screenshot_section(test)
|
|
209
|
+
section = ''
|
|
210
|
+
|
|
211
|
+
failure = full_stacktrace(test)
|
|
212
|
+
|
|
213
|
+
if test.screenshot? && !failure.include?('500 Internal Server Error') && !failure.include?('fabricate_via_api!')
|
|
214
|
+
relative_url = gitlab.upload_file(file_fullpath: test.failure_screenshot)
|
|
215
|
+
|
|
216
|
+
section = "### Screenshot: #{relative_url.markdown}"
|
|
217
|
+
end
|
|
218
|
+
|
|
219
|
+
section
|
|
220
|
+
end
|
|
197
221
|
end
|
|
198
222
|
end
|
|
199
223
|
end
|
|
@@ -95,6 +95,14 @@ module Gitlab
|
|
|
95
95
|
report['quarantine']['issue'] if quarantine?
|
|
96
96
|
end
|
|
97
97
|
|
|
98
|
+
def screenshot?
|
|
99
|
+
report['screenshot'].present?
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
def failure_screenshot
|
|
103
|
+
report['screenshot']['image'] if screenshot?
|
|
104
|
+
end
|
|
105
|
+
|
|
98
106
|
private
|
|
99
107
|
|
|
100
108
|
# rubocop:disable Metrics/AbcSize
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
require 'nokogiri'
|
|
2
|
+
require 'json'
|
|
3
|
+
require 'active_support/core_ext/object/blank'
|
|
2
4
|
|
|
3
5
|
module Gitlab
|
|
4
6
|
module QA
|
|
@@ -9,30 +11,50 @@ module Gitlab
|
|
|
9
11
|
end
|
|
10
12
|
|
|
11
13
|
REGEX = %r{(?<gitlab_qa_run>gitlab-qa-run-.*?(?=\/))\/(?<gitlab_ce_ee_qa>gitlab-(ee|ce)-qa-.*?(?=\/))}
|
|
14
|
+
CONTAINER_PATH = File.join(Docker::Volumes::QA_CONTAINER_WORKDIR, 'tmp').freeze
|
|
12
15
|
|
|
13
16
|
def invoke!
|
|
14
17
|
Dir.glob(@files).each do |rspec_report_file|
|
|
15
|
-
|
|
18
|
+
match_data = rspec_report_file.match(REGEX)
|
|
19
|
+
artifact_path = "#{match_data[:gitlab_qa_run]}/#{match_data[:gitlab_ce_ee_qa]}"
|
|
16
20
|
|
|
17
|
-
|
|
21
|
+
xml_report = rewrite_each_xml_screenshot_path(rspec_report_file, artifact_path)
|
|
22
|
+
|
|
23
|
+
File.write(rspec_report_file, xml_report)
|
|
18
24
|
|
|
19
25
|
puts "Saved #{rspec_report_file}"
|
|
26
|
+
|
|
27
|
+
json_rspec_report_file = rspec_report_file.gsub('.xml', '.json')
|
|
28
|
+
json_report = rewrite_each_json_screenshot_path(json_rspec_report_file, artifact_path)
|
|
29
|
+
|
|
30
|
+
File.write(json_rspec_report_file, json_report)
|
|
31
|
+
|
|
32
|
+
puts "Saved #{json_rspec_report_file}"
|
|
20
33
|
end
|
|
21
34
|
end
|
|
22
35
|
|
|
23
36
|
private
|
|
24
37
|
|
|
25
|
-
def
|
|
38
|
+
def rewrite_each_xml_screenshot_path(rspec_report_file, artifact_path)
|
|
26
39
|
report = Nokogiri::XML(File.open(rspec_report_file))
|
|
27
40
|
|
|
28
|
-
match_data = rspec_report_file.match(REGEX)
|
|
29
|
-
|
|
30
41
|
report.xpath('//system-out').each do |system_out|
|
|
31
|
-
system_out.content = system_out.content.gsub(
|
|
42
|
+
system_out.content = system_out.content.gsub(CONTAINER_PATH, artifact_path)
|
|
32
43
|
end
|
|
33
44
|
|
|
34
45
|
report.to_s
|
|
35
46
|
end
|
|
47
|
+
|
|
48
|
+
def rewrite_each_json_screenshot_path(json_rspec_report_file, artifact_path)
|
|
49
|
+
report = JSON.parse(File.read(json_rspec_report_file))
|
|
50
|
+
examples = report['examples']
|
|
51
|
+
|
|
52
|
+
examples.each do |example|
|
|
53
|
+
example['screenshot']['image'] = example['screenshot']['image'].gsub(CONTAINER_PATH, artifact_path) if example['screenshot'].present?
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
JSON.pretty_generate(report)
|
|
57
|
+
end
|
|
36
58
|
end
|
|
37
59
|
end
|
|
38
60
|
end
|
data/lib/gitlab/qa/runner.rb
CHANGED
|
@@ -13,6 +13,8 @@ module Gitlab
|
|
|
13
13
|
Runtime::Scenario.define(:qa_image, Runtime::Env.qa_image) if Runtime::Env.qa_image
|
|
14
14
|
Runtime::Scenario.define(:omnibus_configuration, Runtime::OmnibusConfiguration.new)
|
|
15
15
|
Runtime::Scenario.define(:seed_db, false)
|
|
16
|
+
Runtime::Scenario.define(:seed_admin_token, true) # Create an admin access token for root user by default
|
|
17
|
+
Runtime::Scenario.define(:omnibus_exec_commands, [])
|
|
16
18
|
|
|
17
19
|
# Omnibus Configurators specified by flags
|
|
18
20
|
@active_configurators = []
|
|
@@ -31,6 +33,10 @@ module Gitlab
|
|
|
31
33
|
Runtime::Scenario.define(:teardown, false)
|
|
32
34
|
end
|
|
33
35
|
|
|
36
|
+
opts.on('--no-admin-token', 'Skip admin token creation for root user') do
|
|
37
|
+
Runtime::Scenario.define(:seed_admin_token, false)
|
|
38
|
+
end
|
|
39
|
+
|
|
34
40
|
opts.on('--qa-image QA_IMAGE', String, 'Specifies a QA image to be used instead of inferring it from the GitLab image. See Gitlab::QA::Release#qa_image') do |value|
|
|
35
41
|
Runtime::Scenario.define(:qa_image, value)
|
|
36
42
|
end
|
|
@@ -135,6 +141,7 @@ module Gitlab
|
|
|
135
141
|
# # Runtime::OmnibusConfiguration::Packages
|
|
136
142
|
# gitlab_rails['packages_enabled'] = true
|
|
137
143
|
Runtime::Scenario.omnibus_configuration << "# #{configurator.class.name}"
|
|
144
|
+
Runtime::Scenario.omnibus_exec_commands << configurator.exec_commands
|
|
138
145
|
|
|
139
146
|
# Load the configuration
|
|
140
147
|
configurator.configuration.split("\n").each { |c| Runtime::Scenario.omnibus_configuration << c }
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Gitlab
|
|
4
|
+
module QA
|
|
5
|
+
module Runtime
|
|
6
|
+
module OmnibusConfigurations
|
|
7
|
+
class CiDecomposition < Default
|
|
8
|
+
def configuration
|
|
9
|
+
# HACK: commenting commands out as these commands should be run *after* the first
|
|
10
|
+
# reconfiguration (see first command in #exec_commands)
|
|
11
|
+
<<~OMNIBUS
|
|
12
|
+
#gitlab_rails['databases']['main']['enable'] = true
|
|
13
|
+
#gitlab_rails['databases']['ci']['enable'] = true
|
|
14
|
+
#gitlab_rails['databases']['ci']['db_database'] = 'gitlabhq_production_ci'
|
|
15
|
+
OMNIBUS
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def exec_commands
|
|
19
|
+
[
|
|
20
|
+
"sed -i 's/#gitlab_rails/gitlab_rails/g' /etc/gitlab/gitlab.rb",
|
|
21
|
+
"gitlab-ctl reconfigure",
|
|
22
|
+
"gitlab-psql -c 'create database gitlabhq_production_ci owner gitlab'",
|
|
23
|
+
"gitlab-psql -d gitlabhq_production_ci -c 'create extension btree_gist'",
|
|
24
|
+
"gitlab-psql -d gitlabhq_production_ci -c 'create extension pg_trgm'",
|
|
25
|
+
"gitlab-rake db:structure:load:ci"
|
|
26
|
+
].freeze
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
@@ -27,6 +27,7 @@ module Gitlab
|
|
|
27
27
|
specs.suite = @suite
|
|
28
28
|
specs.release = release
|
|
29
29
|
specs.args = non_rspec_args.push(*args)
|
|
30
|
+
specs.volumes[host_knapsack_report_path] = "/home/gitlab/qa/knapsack" if host_knapsack_report_path
|
|
30
31
|
end
|
|
31
32
|
end
|
|
32
33
|
|
|
@@ -37,6 +38,10 @@ module Gitlab
|
|
|
37
38
|
def deployment_component
|
|
38
39
|
raise NotImplementedError, 'Please define the Component for the deployment environment associated with this scenario.'
|
|
39
40
|
end
|
|
41
|
+
|
|
42
|
+
def host_knapsack_report_path
|
|
43
|
+
ENV["QA_KNAPSACK_REPORT_PATH"]
|
|
44
|
+
end
|
|
40
45
|
end
|
|
41
46
|
end
|
|
42
47
|
end
|
|
@@ -4,10 +4,11 @@ module Gitlab
|
|
|
4
4
|
module Test
|
|
5
5
|
module Instance
|
|
6
6
|
class Image < Scenario::Template
|
|
7
|
-
attr_writer :volumes
|
|
7
|
+
attr_writer :volumes, :seed_admin_token
|
|
8
8
|
|
|
9
9
|
def initialize
|
|
10
10
|
@volumes = {}
|
|
11
|
+
@seed_admin_token = true
|
|
11
12
|
end
|
|
12
13
|
|
|
13
14
|
def perform(release, *rspec_args)
|
|
@@ -15,6 +16,7 @@ module Gitlab
|
|
|
15
16
|
gitlab.release = release
|
|
16
17
|
gitlab.volumes = @volumes
|
|
17
18
|
gitlab.network = 'test'
|
|
19
|
+
gitlab.seed_admin_token = @seed_admin_token
|
|
18
20
|
|
|
19
21
|
gitlab.instance do
|
|
20
22
|
Component::Specs.perform do |specs|
|
|
@@ -16,6 +16,7 @@ module Gitlab
|
|
|
16
16
|
primary.release = release
|
|
17
17
|
primary.name = 'gitlab-primary'
|
|
18
18
|
primary.network = 'geo'
|
|
19
|
+
primary.seed_admin_token = false
|
|
19
20
|
primary.omnibus_configuration << <<~OMNIBUS
|
|
20
21
|
gitlab_rails['db_key_base'] = '4dd58204865eb41bca93bd38131d51cc';
|
|
21
22
|
geo_primary_role['enable'] = true;
|
|
@@ -54,7 +55,7 @@ module Gitlab
|
|
|
54
55
|
sidekiq['concurrency'] = 2;
|
|
55
56
|
puma['worker_processes'] = 2;
|
|
56
57
|
OMNIBUS
|
|
57
|
-
secondary.exec_commands
|
|
58
|
+
secondary.exec_commands += fast_ssh_key_lookup_commands + QA::Scenario::CLICommands.git_lfs_install_commands
|
|
58
59
|
|
|
59
60
|
secondary.act do
|
|
60
61
|
# TODO, we do not wait for secondary to start because of
|
|
@@ -37,6 +37,7 @@ module Gitlab
|
|
|
37
37
|
praefect.name = @praefect_node_name
|
|
38
38
|
praefect.network = @network
|
|
39
39
|
praefect.skip_availability_check = true
|
|
40
|
+
praefect.seed_admin_token = false
|
|
40
41
|
|
|
41
42
|
praefect.omnibus_configuration << praefect_omnibus_configuration
|
|
42
43
|
|
|
@@ -196,6 +197,7 @@ module Gitlab
|
|
|
196
197
|
gitaly.name = name
|
|
197
198
|
gitaly.network = @network
|
|
198
199
|
gitaly.skip_availability_check = true
|
|
200
|
+
gitaly.seed_admin_token = false
|
|
199
201
|
gitaly.omnibus_configuration << gitaly_omnibus_configuration
|
|
200
202
|
gitaly.instance(skip_teardown: true)
|
|
201
203
|
end
|
data/lib/gitlab/qa/version.rb
CHANGED
data/lib/gitlab/qa.rb
CHANGED
|
@@ -20,6 +20,7 @@ module Gitlab
|
|
|
20
20
|
autoload :ObjectStorageGcs, 'gitlab/qa/runtime/omnibus_configurations/object_storage_gcs'
|
|
21
21
|
autoload :LicenseMode, 'gitlab/qa/runtime/omnibus_configurations/license_mode'
|
|
22
22
|
autoload :RegistryObjectStorage, 'gitlab/qa/runtime/omnibus_configurations/registry_object_storage'
|
|
23
|
+
autoload :CiDecomposition, 'gitlab/qa/runtime/omnibus_configurations/ci_decomposition'
|
|
23
24
|
end
|
|
24
25
|
end
|
|
25
26
|
|
data/scripts/generate-qa-jobs.rb
CHANGED
|
@@ -15,6 +15,7 @@ class GenerateQAJobs
|
|
|
15
15
|
jobs.concat(load_yml_contents('custom_parallel'))
|
|
16
16
|
jobs.concat(load_yml_contents('instance')) if should_run?('test_instance_all')
|
|
17
17
|
jobs.concat(load_yml_contents('relative_url')) if should_run?('test_instance_all')
|
|
18
|
+
jobs.concat(load_yml_contents('ci_decomposition')) if should_run?('test_instance_all')
|
|
18
19
|
jobs.concat(load_yml_contents('repository_storage')) if should_run?('test_instance_all_repository_storage')
|
|
19
20
|
jobs.concat(load_yml_contents('omnibus_image'))
|
|
20
21
|
jobs.concat(load_yml_contents('update')) if should_run?('test_instance_all')
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
class AdminAccessTokenSeed
|
|
4
|
+
TOKEN_VALUE = 'yF4CpxN55A1V0sHMuYQa'
|
|
5
|
+
SCOPES = Gitlab::Auth.all_available_scopes
|
|
6
|
+
|
|
7
|
+
def self.seed!
|
|
8
|
+
admin_user = User.find_by(username: 'root')
|
|
9
|
+
|
|
10
|
+
token_params = {
|
|
11
|
+
scopes: SCOPES.map(&:to_s),
|
|
12
|
+
name: 'admin-api-token'
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
admin_user.personal_access_tokens.build(token_params).tap do |pat|
|
|
16
|
+
pat.set_token(TOKEN_VALUE)
|
|
17
|
+
pat.save!
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
puts 'Personal access token seeded for root user.'
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
AdminAccessTokenSeed.seed!
|
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.27.1
|
|
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-05-
|
|
11
|
+
date: 2022-05-17 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: climate_control
|
|
@@ -220,6 +220,7 @@ files:
|
|
|
220
220
|
- ".gitlab-ci.yml"
|
|
221
221
|
- ".gitlab/ci/jobs/actioncable.gitlab-ci.yml"
|
|
222
222
|
- ".gitlab/ci/jobs/base.gitlab-ci.yml"
|
|
223
|
+
- ".gitlab/ci/jobs/ci_decomposition.gitlab-ci.yml"
|
|
223
224
|
- ".gitlab/ci/jobs/cloud_activation.gitlab-ci.yml"
|
|
224
225
|
- ".gitlab/ci/jobs/custom_parallel.gitlab-ci.yml"
|
|
225
226
|
- ".gitlab/ci/jobs/ee_previous_to_ce_update.gitlab-ci.yml"
|
|
@@ -335,6 +336,7 @@ files:
|
|
|
335
336
|
- lib/gitlab/qa/runtime/env.rb
|
|
336
337
|
- lib/gitlab/qa/runtime/logger.rb
|
|
337
338
|
- lib/gitlab/qa/runtime/omnibus_configuration.rb
|
|
339
|
+
- lib/gitlab/qa/runtime/omnibus_configurations/ci_decomposition.rb
|
|
338
340
|
- lib/gitlab/qa/runtime/omnibus_configurations/default.rb
|
|
339
341
|
- lib/gitlab/qa/runtime/omnibus_configurations/license_mode.rb
|
|
340
342
|
- lib/gitlab/qa/runtime/omnibus_configurations/object_storage.rb
|
|
@@ -398,6 +400,7 @@ files:
|
|
|
398
400
|
- lib/gitlab/qa/test_logger.rb
|
|
399
401
|
- lib/gitlab/qa/version.rb
|
|
400
402
|
- scripts/generate-qa-jobs.rb
|
|
403
|
+
- support/data/admin_access_token_seed.rb
|
|
401
404
|
- support/data/license_usage_seed.rb
|
|
402
405
|
- tls_certificates/authority/ca.crt
|
|
403
406
|
- tls_certificates/authority/ca.key
|