gitlab-qa 10.3.0 → 12.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -1
- data/.gitlab/changelog_config.yml +13 -0
- data/.gitlab/merge_request_templates/Release.md +13 -34
- data/.gitlab-ci.yml +3 -1
- data/.rubocop.yml +13 -2
- data/.rubocop_todo.yml +57 -97
- data/Dangerfile +1 -5
- data/Gemfile.lock +47 -39
- data/README.md +1 -2
- data/docs/release_process.md +1 -1
- data/docs/running_against_remote_grid.md +42 -3
- data/docs/what_tests_can_be_run.md +5 -2
- data/gitlab-qa.gemspec +5 -3
- data/lib/gitlab/qa/component/base.rb +9 -9
- data/lib/gitlab/qa/component/gitaly.rb +7 -5
- data/lib/gitlab/qa/component/gitaly_cluster.rb +15 -9
- data/lib/gitlab/qa/component/gitlab.rb +48 -21
- data/lib/gitlab/qa/component/mail_hog.rb +1 -0
- data/lib/gitlab/qa/component/praefect.rb +41 -31
- data/lib/gitlab/qa/component/selenoid.rb +14 -7
- data/lib/gitlab/qa/component/specs.rb +11 -5
- data/lib/gitlab/qa/component/staging.rb +4 -4
- data/lib/gitlab/qa/component/telegraf.rb +2 -1
- data/lib/gitlab/qa/docker/engine.rb +6 -3
- data/lib/gitlab/qa/docker/volumes.rb +1 -1
- data/lib/gitlab/qa/release.rb +4 -4
- data/lib/gitlab/qa/runner.rb +10 -3
- data/lib/gitlab/qa/runtime/env.rb +47 -62
- data/lib/gitlab/qa/runtime/logger.rb +1 -1
- data/lib/gitlab/qa/runtime/omnibus_configuration.rb +1 -0
- data/lib/gitlab/qa/runtime/omnibus_configurations/decomposition_single_db.rb +1 -2
- data/lib/gitlab/qa/runtime/omnibus_configurations/object_storage_gcs.rb +2 -1
- data/lib/gitlab/qa/runtime/scenario.rb +1 -5
- data/lib/gitlab/qa/scenario/actable.rb +4 -4
- data/lib/gitlab/qa/scenario/test/instance/airgapped.rb +2 -4
- data/lib/gitlab/qa/scenario/test/instance/deployment_base.rb +2 -1
- data/lib/gitlab/qa/scenario/test/integration/gitaly_cluster.rb +0 -2
- data/lib/gitlab/qa/scenario/test/integration/group_saml.rb +1 -1
- data/lib/gitlab/qa/scenario/test/integration/ldap.rb +5 -6
- data/lib/gitlab/qa/scenario/test/integration/mtls.rb +20 -6
- data/lib/gitlab/qa/scenario/test/integration/oauth.rb +13 -4
- data/lib/gitlab/qa/scenario/test/integration/praefect.rb +16 -10
- data/lib/gitlab/qa/scenario/test/integration/registry_with_cdn.rb +5 -2
- data/lib/gitlab/qa/scenario/test/omnibus/update_from_previous.rb +1 -1
- data/lib/gitlab/qa/scenario/test/omnibus/upgrade.rb +1 -3
- data/lib/gitlab/qa/scenario/test/sanity/version.rb +1 -1
- data/lib/gitlab/qa/support/config_scripts.rb +1 -1
- data/lib/gitlab/qa/support/gitlab_version_info.rb +30 -10
- data/lib/gitlab/qa/support/shell_command.rb +1 -0
- data/lib/gitlab/qa/test_logger.rb +2 -2
- data/lib/gitlab/qa/version.rb +1 -1
- data/lib/gitlab/qa.rb +0 -1
- data/support/data/admin_access_token_seed.rb +5 -1
- data/support/data/license_usage_seed.rb +3 -1
- metadata +16 -45
- data/bin/slack +0 -14
- data/exe/gitlab-qa-report +0 -10
- data/lib/gitlab/qa/report/base_test_results.rb +0 -39
- data/lib/gitlab/qa/report/find_set_dri.rb +0 -43
- data/lib/gitlab/qa/report/generate_test_session.rb +0 -275
- data/lib/gitlab/qa/report/gitlab_issue_client.rb +0 -190
- data/lib/gitlab/qa/report/gitlab_issue_dry_client.rb +0 -28
- data/lib/gitlab/qa/report/j_unit_test_results.rb +0 -27
- data/lib/gitlab/qa/report/json_test_results.rb +0 -29
- data/lib/gitlab/qa/report/prepare_stage_reports.rb +0 -86
- data/lib/gitlab/qa/report/relate_failure_issue.rb +0 -374
- data/lib/gitlab/qa/report/report_as_issue.rb +0 -176
- data/lib/gitlab/qa/report/report_results.rb +0 -64
- data/lib/gitlab/qa/report/results_in_issues.rb +0 -126
- data/lib/gitlab/qa/report/results_in_testcases.rb +0 -111
- data/lib/gitlab/qa/report/results_reporter_shared.rb +0 -70
- data/lib/gitlab/qa/report/summary_table.rb +0 -43
- data/lib/gitlab/qa/report/test_result.rb +0 -184
- data/lib/gitlab/qa/report/update_screenshot_path.rb +0 -63
- data/lib/gitlab/qa/reporter.rb +0 -131
- data/lib/gitlab/qa/runtime/omnibus_configurations/packages.rb +0 -17
- data/lib/gitlab/qa/runtime/token_finder.rb +0 -44
- data/lib/gitlab/qa/slack/post_to_slack.rb +0 -30
- data/lib/gitlab/qa/system_logs/finders/json_log_finder.rb +0 -65
- data/lib/gitlab/qa/system_logs/finders/rails/api_log_finder.rb +0 -21
- data/lib/gitlab/qa/system_logs/finders/rails/application_log_finder.rb +0 -21
- data/lib/gitlab/qa/system_logs/finders/rails/exception_log_finder.rb +0 -21
- data/lib/gitlab/qa/system_logs/finders/rails/graphql_log_finder.rb +0 -21
- data/lib/gitlab/qa/system_logs/log_types/log.rb +0 -38
- data/lib/gitlab/qa/system_logs/log_types/rails/api_log.rb +0 -34
- data/lib/gitlab/qa/system_logs/log_types/rails/application_log.rb +0 -27
- data/lib/gitlab/qa/system_logs/log_types/rails/exception_log.rb +0 -23
- data/lib/gitlab/qa/system_logs/log_types/rails/graphql_log.rb +0 -30
- data/lib/gitlab/qa/system_logs/shared_fields.rb +0 -29
- data/lib/gitlab/qa/system_logs/system_logs_formatter.rb +0 -65
@@ -1,5 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require 'active_support'
|
3
4
|
require 'active_support/core_ext/object/blank'
|
4
5
|
require 'securerandom'
|
5
6
|
|
@@ -22,12 +23,17 @@ module Gitlab
|
|
22
23
|
'QA_REMOTE_MOBILE_DEVICE_NAME' => :remote_mobile_device_name,
|
23
24
|
'QA_REMOTE_TUNNEL_ID' => :remote_tunnel_id,
|
24
25
|
'QA_BROWSER' => :browser,
|
26
|
+
'QA_SELENOID_BROWSER_VERSION' => :selenoid_browser_version,
|
27
|
+
'QA_RECORD_VIDEO' => :record_video,
|
28
|
+
'QA_LAYOUT' => :layout,
|
29
|
+
'QA_VIDEO_RECORDER_IMAGE' => :video_recorder_image,
|
30
|
+
'QA_VIDEO_RECORDER_VERSION' => :video_recorder_version,
|
31
|
+
'QA_SELENOID_BROWSER_IMAGE' => :selenoid_browser_image,
|
25
32
|
'QA_ADDITIONAL_REPOSITORY_STORAGE' => :qa_additional_repository_storage,
|
26
33
|
'QA_PRAEFECT_REPOSITORY_STORAGE' => :qa_praefect_repository_storage,
|
27
34
|
'QA_GITALY_NON_CLUSTER_STORAGE' => :qa_gitaly_non_cluster_storage,
|
28
35
|
'QA_COOKIES' => :qa_cookie,
|
29
36
|
'QA_DEBUG' => :qa_debug,
|
30
|
-
'QA_DEFAULT_BRANCH' => :qa_default_branch,
|
31
37
|
'QA_CAN_TEST_ADMIN_FEATURES' => :qa_can_test_admin_features,
|
32
38
|
'QA_CAN_TEST_GIT_PROTOCOL_V2' => :qa_can_test_git_protocol_v2,
|
33
39
|
'QA_CAN_TEST_PRAEFECT' => :qa_can_test_praefect,
|
@@ -42,7 +48,6 @@ module Gitlab
|
|
42
48
|
'QA_SKIP_PULL' => :qa_skip_pull,
|
43
49
|
'QA_VALIDATE_RESOURCE_REUSE' => :qa_validate_resource_reuse,
|
44
50
|
'WEBDRIVER_HEADLESS' => :webdriver_headless,
|
45
|
-
'GITLAB_API_BASE' => :api_base,
|
46
51
|
'GITLAB_ADMIN_USERNAME' => :admin_username,
|
47
52
|
'GITLAB_ADMIN_PASSWORD' => :admin_password,
|
48
53
|
'GITLAB_USERNAME' => :user_username,
|
@@ -57,7 +62,6 @@ module Gitlab
|
|
57
62
|
'GITLAB_QA_ADMIN_ACCESS_TOKEN' => :qa_admin_access_token,
|
58
63
|
'GITLAB_QA_DEV_ACCESS_TOKEN' => :qa_dev_access_token,
|
59
64
|
'GITLAB_QA_CONTAINER_REGISTRY_ACCESS_TOKEN' => :qa_container_registry_access_token,
|
60
|
-
'GITLAB_QA_ISSUE_URL' => :qa_issue_url,
|
61
65
|
'GITHUB_ACCESS_TOKEN' => :github_access_token,
|
62
66
|
'GITLAB_URL' => :gitlab_url,
|
63
67
|
'SIMPLE_SAML_HOSTNAME' => :simple_saml_hostname,
|
@@ -69,22 +73,26 @@ module Gitlab
|
|
69
73
|
'CLOUDSDK_CORE_PROJECT' => :cloudsdk_core_project,
|
70
74
|
'GCLOUD_REGION' => :gcloud_region,
|
71
75
|
'SIGNUP_DISABLED' => :signup_disabled,
|
72
|
-
'GITLAB_CI_API_TOKEN' => :gitlab_ci_api_token,
|
73
76
|
'GITLAB_QA_USERNAME_1' => :gitlab_qa_username_1,
|
74
77
|
'GITLAB_QA_PASSWORD_1' => :gitlab_qa_password_1,
|
75
78
|
'GITLAB_QA_USERNAME_2' => :gitlab_qa_username_2,
|
76
79
|
'GITLAB_QA_PASSWORD_2' => :gitlab_qa_password_2,
|
77
80
|
'QA_GITHUB_USERNAME' => :qa_github_username,
|
78
81
|
'QA_GITHUB_PASSWORD' => :qa_github_password,
|
82
|
+
'QA_FACEBOOK_USERNAME' => :qa_facebook_username,
|
83
|
+
'QA_FACEBOOK_PASSWORD' => :qa_facebook_password,
|
79
84
|
'KNAPSACK_GENERATE_REPORT' => :knapsack_generate_report,
|
80
85
|
'KNAPSACK_REPORT_PATH' => :knapsack_report_path,
|
81
86
|
'KNAPSACK_TEST_FILE_PATTERN' => :knapsack_test_file_pattern,
|
82
87
|
'KNAPSACK_TEST_DIR' => :knapsack_test_dir,
|
83
88
|
'QA_KNAPSACK_REPORT_GCS_CREDENTIALS' => :qa_knapsack_report_gcs_credentials,
|
84
89
|
'QA_KNAPSACK_REPORT_PATH' => :qa_knapsack_report_path,
|
90
|
+
'QA_RSPEC_REPORT_PATH' => :qa_rspec_report_path,
|
91
|
+
'RSPEC_FAST_QUARANTINE_PATH' => :rspec_fast_quarantine_path,
|
92
|
+
'RSPEC_SKIPPED_TESTS_REPORT_PATH' => :skipped_tests_report_path,
|
85
93
|
'CI' => :ci,
|
86
|
-
'CI_COMMIT_REF_NAME' => :ci_commit_ref_name,
|
87
94
|
'CI_JOB_NAME' => :ci_job_name,
|
95
|
+
'CI_JOB_NAME_SLUG' => :ci_job_name_slug,
|
88
96
|
'CI_JOB_URL' => :ci_job_url,
|
89
97
|
'CI_JOB_TOKEN' => :ci_job_token,
|
90
98
|
'CI_RUNNER_ID' => :ci_runner_id,
|
@@ -92,22 +100,16 @@ module Gitlab
|
|
92
100
|
'CI_SERVER_PERSONAL_ACCESS_TOKEN' => :ci_server_personal_access_token,
|
93
101
|
'CI_NODE_INDEX' => :ci_node_index,
|
94
102
|
'CI_NODE_TOTAL' => :ci_node_total,
|
95
|
-
'CI_PROJECT_ID' => :ci_project_id,
|
96
103
|
'CI_PROJECT_NAME' => :ci_project_name,
|
97
104
|
'CI_PROJECT_PATH' => :ci_project_path,
|
98
|
-
'CI_SLACK_WEBHOOK_URL' => :ci_slack_webhook_url,
|
99
|
-
'CI_PIPELINE_ID' => :ci_pipeline_id,
|
100
105
|
'CI_PIPELINE_SOURCE' => :ci_pipeline_source,
|
101
106
|
'CI_PIPELINE_URL' => :ci_pipeline_url,
|
102
107
|
'CI_PIPELINE_CREATED_AT' => :ci_pipeline_created_at,
|
103
108
|
'CI_MERGE_REQUEST_IID' => :ci_merge_request_iid,
|
104
|
-
'CI_API_V4_URL' => :ci_api_v4_url,
|
105
109
|
'GITLAB_CI' => :gitlab_ci,
|
106
110
|
'ELASTIC_URL' => :elastic_url,
|
107
111
|
'GITLAB_QA_LOOP_RUNNER_MINUTES' => :gitlab_qa_loop_runner_minutes,
|
108
112
|
'MAILHOG_HOSTNAME' => :mailhog_hostname,
|
109
|
-
'SLACK_QA_CHANNEL' => :slack_qa_channel,
|
110
|
-
'SLACK_ICON_EMOJI' => :slack_icon_emoji,
|
111
113
|
'GITLAB_QA_FORMLESS_LOGIN_TOKEN' => :gitlab_qa_formless_login_token,
|
112
114
|
'GEO_MAX_FILE_REPLICATION_TIME' => :geo_max_file_replication_time,
|
113
115
|
'GEO_MAX_DB_REPLICATION_TIME' => :geo_max_db_replication_time,
|
@@ -115,7 +117,6 @@ module Gitlab
|
|
115
117
|
'JIRA_ADMIN_USERNAME' => :jira_admin_username,
|
116
118
|
'JIRA_ADMIN_PASSWORD' => :jira_admin_password,
|
117
119
|
'CACHE_NAMESPACE_NAME' => :cache_namespace_name,
|
118
|
-
'DEPLOY_VERSION' => :deploy_version,
|
119
120
|
'GITLAB_QA_USER_AGENT' => :gitlab_qa_user_agent,
|
120
121
|
'GEO_FAILOVER' => :geo_failover,
|
121
122
|
'GITLAB_INITIAL_ROOT_PASSWORD' => :initial_root_password,
|
@@ -142,6 +143,8 @@ module Gitlab
|
|
142
143
|
'JH_ENV' => :jh_env,
|
143
144
|
'QA_GITHUB_OAUTH_APP_ID' => :github_oauth_app_id,
|
144
145
|
'QA_GITHUB_OAUTH_APP_SECRET' => :github_oauth_app_secret,
|
146
|
+
'QA_FACEBOOK_OAUTH_APP_ID' => :facebook_oauth_app_id,
|
147
|
+
'QA_FACEBOOK_OAUTH_APP_SECRET' => :facebook_oauth_app_secret,
|
145
148
|
'QA_1P_EMAIL' => :qa_1p_email,
|
146
149
|
'QA_1P_PASSWORD' => :qa_1p_password,
|
147
150
|
'QA_1P_SECRET' => :qa_1p_secret,
|
@@ -151,16 +154,15 @@ module Gitlab
|
|
151
154
|
'RELEASE_REGISTRY_USERNAME' => :release_registry_username,
|
152
155
|
'RELEASE_REGISTRY_PASSWORD' => :release_registry_password,
|
153
156
|
'SELENOID_DIRECTORY' => :selenoid_directory,
|
154
|
-
'USE_SELENOID' => :use_selenoid
|
157
|
+
'USE_SELENOID' => :use_selenoid,
|
158
|
+
'SCHEDULE_TYPE' => :schedule_type
|
155
159
|
}.freeze
|
156
160
|
|
157
161
|
ENV_VARIABLES.each do |env_name, method_name|
|
158
162
|
attr_writer(method_name)
|
159
163
|
|
160
164
|
define_method(method_name) do
|
161
|
-
env_var_value_if_defined(env_name) || (if instance_variable_defined?("@#{method_name}")
|
162
|
-
instance_variable_get("@#{method_name}")
|
163
|
-
end)
|
165
|
+
env_var_value_if_defined(env_name) || (instance_variable_get("@#{method_name}") if instance_variable_defined?("@#{method_name}"))
|
164
166
|
end
|
165
167
|
end
|
166
168
|
|
@@ -171,7 +173,7 @@ module Gitlab
|
|
171
173
|
value = env_var_name_if_defined(name) || send(attribute) # rubocop:disable GitlabSecurity/PublicSend
|
172
174
|
vars[name] = value if value
|
173
175
|
end
|
174
|
-
qa_variables = ENV.each_with_object({}) do |(name,
|
176
|
+
qa_variables = ENV.each_with_object({}) do |(name, _value), vars|
|
175
177
|
next unless name.start_with?('QA_')
|
176
178
|
|
177
179
|
var_name = env_var_name_if_defined(name)
|
@@ -182,7 +184,7 @@ module Gitlab
|
|
182
184
|
end
|
183
185
|
|
184
186
|
def debug?
|
185
|
-
enabled?(ENV
|
187
|
+
enabled?(ENV.fetch('QA_DEBUG', nil), default: true)
|
186
188
|
end
|
187
189
|
|
188
190
|
def log_level
|
@@ -193,10 +195,6 @@ module Gitlab
|
|
193
195
|
env_var_value_if_defined('QA_LOG_PATH') || host_artifacts_dir
|
194
196
|
end
|
195
197
|
|
196
|
-
def default_branch
|
197
|
-
env_var_value_if_defined('QA_DEFAULT_BRANCH') || 'main'
|
198
|
-
end
|
199
|
-
|
200
198
|
def gitlab_availability_timeout
|
201
199
|
(env_var_value_if_defined('GITLAB_QA_AVAILABILITY_TIMEOUT') || 360).to_i
|
202
200
|
end
|
@@ -209,20 +207,12 @@ module Gitlab
|
|
209
207
|
env_var_value_if_defined('GITLAB_DEV_USERNAME') || 'gitlab-qa-bot'
|
210
208
|
end
|
211
209
|
|
212
|
-
def gitlab_api_base
|
213
|
-
env_var_value_if_defined('GITLAB_API_BASE') || 'https://gitlab.com/api/v4'
|
214
|
-
end
|
215
|
-
|
216
|
-
def pipeline_from_project_name
|
217
|
-
ci_project_name.to_s.start_with?('gitlab') ? QA::Runtime::Env.default_branch : ci_project_name
|
218
|
-
end
|
219
|
-
|
220
210
|
def run_id
|
221
211
|
@run_id ||= "gitlab-qa-run-#{Time.now.strftime('%Y-%m-%d-%H-%M-%S')}-#{SecureRandom.hex(4)}"
|
222
212
|
end
|
223
213
|
|
224
214
|
def colorized_logs?
|
225
|
-
enabled?(ENV
|
215
|
+
enabled?(ENV.fetch('COLORIZED_LOGS', nil), default: false)
|
226
216
|
end
|
227
217
|
|
228
218
|
def dev_access_token_variable
|
@@ -233,10 +223,6 @@ module Gitlab
|
|
233
223
|
env_var_value_if_defined('GITLAB_INITIAL_ROOT_PASSWORD') || '5iveL!fe'
|
234
224
|
end
|
235
225
|
|
236
|
-
def deploy_environment
|
237
|
-
env_var_value_if_defined('DEPLOY_ENVIRONMENT') || pipeline_from_project_name
|
238
|
-
end
|
239
|
-
|
240
226
|
def host_artifacts_dir
|
241
227
|
@host_artifacts_dir ||= File.join(
|
242
228
|
env_var_value_if_defined('QA_ARTIFACTS_DIR') || '/tmp/gitlab-qa', Runtime::Env.run_id
|
@@ -275,18 +261,6 @@ module Gitlab
|
|
275
261
|
raise ArgumentError, "Please provide GITLAB_QA_DEV_ACCESS_TOKEN"
|
276
262
|
end
|
277
263
|
|
278
|
-
def require_slack_qa_channel!
|
279
|
-
return unless env_var_value_if_defined('SLACK_QA_CHANNEL').to_s.strip.empty?
|
280
|
-
|
281
|
-
raise ArgumentError, "Please provide SLACK_QA_CHANNEL"
|
282
|
-
end
|
283
|
-
|
284
|
-
def require_ci_slack_webhook_url!
|
285
|
-
return unless env_var_value_if_defined('CI_SLACK_WEBHOOK_URL').to_s.strip.empty?
|
286
|
-
|
287
|
-
raise ArgumentError, "Please provide CI_SLACK_WEBHOOK_URL"
|
288
|
-
end
|
289
|
-
|
290
264
|
def require_qa_container_registry_access_token!
|
291
265
|
return unless env_var_value_if_defined('GITLAB_QA_CONTAINER_REGISTRY_ACCESS_TOKEN').to_s.strip.empty?
|
292
266
|
|
@@ -295,32 +269,31 @@ module Gitlab
|
|
295
269
|
|
296
270
|
def require_aws_s3_environment!
|
297
271
|
%w[AWS_S3_REGION AWS_S3_KEY_ID AWS_S3_ACCESS_KEY AWS_S3_BUCKET_NAME].each do |env_key|
|
298
|
-
unless ENV.key?(env_key)
|
299
|
-
raise ArgumentError, "Environment variable #{env_key} must be set to run AWS S3 object storage specs"
|
300
|
-
end
|
272
|
+
raise ArgumentError, "Environment variable #{env_key} must be set to run AWS S3 object storage specs" unless ENV.key?(env_key)
|
301
273
|
end
|
302
274
|
end
|
303
275
|
|
304
276
|
def require_gcs_environment!
|
305
277
|
%w[GOOGLE_PROJECT GOOGLE_CLIENT_EMAIL GOOGLE_JSON_KEY GCS_BUCKET_NAME].each do |env_key|
|
306
|
-
unless ENV.key?(env_key)
|
307
|
-
raise ArgumentError, "Environment variable #{env_key} must be set to run GCS object storage specs"
|
308
|
-
end
|
278
|
+
raise ArgumentError, "Environment variable #{env_key} must be set to run GCS object storage specs" unless ENV.key?(env_key)
|
309
279
|
end
|
310
280
|
end
|
311
281
|
|
312
282
|
def require_gcs_with_cdn_environment!
|
313
|
-
%w[GOOGLE_CDN_JSON_KEY GCS_CDN_BUCKET_NAME GOOGLE_CDN_LB GOOGLE_CDN_SIGNURL_KEY
|
314
|
-
|
315
|
-
|
316
|
-
end
|
283
|
+
%w[GOOGLE_CDN_JSON_KEY GCS_CDN_BUCKET_NAME GOOGLE_CDN_LB GOOGLE_CDN_SIGNURL_KEY
|
284
|
+
GOOGLE_CDN_SIGNURL_KEY_NAME].each do |env_key|
|
285
|
+
raise ArgumentError, "Environment variable #{env_key} must be set to run GCS with CDN enabled scenario" unless ENV.key?(env_key)
|
317
286
|
end
|
318
287
|
end
|
319
288
|
|
320
289
|
def require_oauth_environment!
|
321
290
|
%w[QA_GITHUB_OAUTH_APP_ID QA_GITHUB_OAUTH_APP_SECRET QA_GITHUB_USERNAME
|
322
|
-
|
323
|
-
|
291
|
+
QA_GITHUB_PASSWORD QA_1P_EMAIL QA_1P_PASSWORD QA_1P_SECRET QA_1P_GITHUB_UUID QA_FACEBOOK_USERNAME
|
292
|
+
QA_FACEBOOK_PASSWORD QA_FACEBOOK_OAUTH_APP_SECRET QA_FACEBOOK_OAUTH_APP_ID].each do |env_key|
|
293
|
+
unless ENV.key?(env_key)
|
294
|
+
raise ArgumentError,
|
295
|
+
"Environment variable #{env_key} must be set to run OAuth specs"
|
296
|
+
end
|
324
297
|
end
|
325
298
|
end
|
326
299
|
|
@@ -364,8 +337,20 @@ module Gitlab
|
|
364
337
|
env_var_value_if_defined('QA_LAYOUT')&.match?(/tablet|phone/i)
|
365
338
|
end
|
366
339
|
|
367
|
-
def
|
368
|
-
env_var_value_if_defined('
|
340
|
+
def video_recorder_image
|
341
|
+
env_var_value_if_defined('QA_VIDEO_RECORDER_IMAGE') || 'presidenten/selenoid-manual-video-recorder'
|
342
|
+
end
|
343
|
+
|
344
|
+
def video_recorder_version
|
345
|
+
env_var_value_if_defined('QA_VIDEO_RECORDER_VERSION') || 'latest'
|
346
|
+
end
|
347
|
+
|
348
|
+
def selenoid_browser_image
|
349
|
+
env_var_value_if_defined('QA_SELENOID_BROWSER_IMAGE') || 'selenoid/chrome'
|
350
|
+
end
|
351
|
+
|
352
|
+
def selenoid_browser_version
|
353
|
+
env_var_value_if_defined('QA_SELENOID_BROWSER_VERSION') || '111.0'
|
369
354
|
end
|
370
355
|
|
371
356
|
def qa_run_type
|
@@ -458,7 +443,7 @@ module Gitlab
|
|
458
443
|
end
|
459
444
|
|
460
445
|
def env_var_value_if_defined(variable)
|
461
|
-
return ENV
|
446
|
+
return ENV.fetch(variable, nil) if env_var_value_valid?(variable)
|
462
447
|
end
|
463
448
|
|
464
449
|
def env_var_name_if_defined(variable)
|
@@ -8,8 +8,7 @@ module Gitlab
|
|
8
8
|
def configuration
|
9
9
|
<<~OMNIBUS
|
10
10
|
gitlab_rails['databases']['main']['enable'] = true
|
11
|
-
gitlab_rails['databases']['ci']['enable'] =
|
12
|
-
gitlab_rails['databases']['ci']['db_database'] = 'gitlabhq_production'
|
11
|
+
gitlab_rails['databases']['ci']['enable'] = false
|
13
12
|
OMNIBUS
|
14
13
|
end
|
15
14
|
end
|
@@ -1,4 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
require 'tempfile'
|
3
4
|
|
4
5
|
module Gitlab
|
@@ -26,7 +27,7 @@ module Gitlab
|
|
26
27
|
end
|
27
28
|
|
28
29
|
def setup_json_key
|
29
|
-
Tempfile.open('gcs-json-key', ENV
|
30
|
+
Tempfile.open('gcs-json-key', ENV.fetch('CI_PROJECT_DIR', nil)) do |file|
|
30
31
|
file.write(ENV.fetch('GOOGLE_JSON_KEY'))
|
31
32
|
|
32
33
|
file
|
@@ -18,18 +18,14 @@ module Gitlab
|
|
18
18
|
|
19
19
|
define_singleton_method(attribute) do
|
20
20
|
attributes[attribute.to_sym].tap do |value|
|
21
|
-
if value.to_s.empty?
|
22
|
-
raise ArgumentError, "Empty `#{attribute}` attribute!"
|
23
|
-
end
|
21
|
+
raise ArgumentError, "Empty `#{attribute}` attribute!" if value.to_s.empty?
|
24
22
|
end
|
25
23
|
end
|
26
24
|
end
|
27
25
|
|
28
|
-
# rubocop:disable Style/MethodMissing
|
29
26
|
def method_missing(name, *)
|
30
27
|
raise ArgumentError, "Scenario attribute `#{name}` not defined!"
|
31
28
|
end
|
32
|
-
# rubocop:enable Style/MethodMissing
|
33
29
|
end
|
34
30
|
end
|
35
31
|
end
|
@@ -4,8 +4,8 @@ module Gitlab
|
|
4
4
|
module QA
|
5
5
|
module Scenario
|
6
6
|
module Actable
|
7
|
-
def act(
|
8
|
-
instance_exec(
|
7
|
+
def act(...)
|
8
|
+
instance_exec(...)
|
9
9
|
end
|
10
10
|
|
11
11
|
def self.included(base)
|
@@ -17,8 +17,8 @@ module Gitlab
|
|
17
17
|
yield new if block_given?
|
18
18
|
end
|
19
19
|
|
20
|
-
def act(
|
21
|
-
new.act(
|
20
|
+
def act(...)
|
21
|
+
new.act(...)
|
22
22
|
end
|
23
23
|
end
|
24
24
|
end
|
@@ -80,10 +80,10 @@ module Gitlab
|
|
80
80
|
iptables -A OUTPUT -p tcp -m tcp --sport 80 -m state --state NEW,ESTABLISHED -j ACCEPT
|
81
81
|
iptables -A INPUT -p tcp -m tcp --dport 80 -m state --state NEW,ESTABLISHED -j ACCEPT
|
82
82
|
|
83
|
-
# some exceptions to allow runners access network https://gitlab.com/gitlab-org/gitlab-qa/-/issues/700
|
83
|
+
# some exceptions to allow runners access network https://gitlab.com/gitlab-org/gitlab-qa/-/issues/700#{' '}
|
84
84
|
iptables -A OUTPUT -p tcp -d #{gitlab_registry_ip} -j ACCEPT
|
85
85
|
iptables -A OUTPUT -p tcp -d #{dev_gitlab_registry_ip} -j ACCEPT
|
86
|
-
# allow access to praefect node
|
86
|
+
# allow access to praefect node#{' '}
|
87
87
|
iptables -A OUTPUT -p tcp -d #{praefect_ip} -j ACCEPT
|
88
88
|
|
89
89
|
# Should now fail to ping gitlab_ip, port 22/80 should be open
|
@@ -130,8 +130,6 @@ module Gitlab
|
|
130
130
|
]
|
131
131
|
}
|
132
132
|
];
|
133
|
-
grafana['disable_login_form'] = false;
|
134
|
-
grafana['admin_password'] = 'GRAFANA_ADMIN_PASSWORD';
|
135
133
|
OMNIBUS
|
136
134
|
end
|
137
135
|
end
|
@@ -37,7 +37,8 @@ module Gitlab
|
|
37
37
|
end
|
38
38
|
|
39
39
|
def deployment_component
|
40
|
-
raise NotImplementedError,
|
40
|
+
raise NotImplementedError,
|
41
|
+
'Please define the Component for the deployment environment associated with this scenario.'
|
41
42
|
end
|
42
43
|
end
|
43
44
|
end
|
@@ -18,7 +18,7 @@ module Gitlab
|
|
18
18
|
raise ArgumentError, 'Group SAML is EE only feature!' unless release.ee?
|
19
19
|
end
|
20
20
|
|
21
|
-
def configure(gitlab,
|
21
|
+
def configure(gitlab, _saml)
|
22
22
|
gitlab.omnibus_configuration << <<~OMNIBUS
|
23
23
|
gitlab_rails['omniauth_enabled'] = true;
|
24
24
|
gitlab_rails['omniauth_providers'] = [{ name: 'group_saml' }];
|
@@ -66,16 +66,14 @@ module Gitlab
|
|
66
66
|
end
|
67
67
|
end
|
68
68
|
|
69
|
-
def orchestrate_ldap
|
69
|
+
def orchestrate_ldap(&block)
|
70
70
|
Component::LDAP.perform do |ldap|
|
71
71
|
ldap.name = 'ldap-server'
|
72
72
|
ldap.network = 'test'
|
73
73
|
ldap.set_gitlab_credentials
|
74
74
|
ldap.tls = tls
|
75
75
|
|
76
|
-
ldap.instance
|
77
|
-
yield
|
78
|
-
end
|
76
|
+
ldap.instance(&block)
|
79
77
|
end
|
80
78
|
end
|
81
79
|
|
@@ -90,8 +88,9 @@ module Gitlab
|
|
90
88
|
if orchestrate_ldap_server
|
91
89
|
orchestrate_ldap { run_specs(gitlab, {}, *rspec_args) }
|
92
90
|
else
|
93
|
-
volumes = {
|
94
|
-
|
91
|
+
volumes = { admin: File.join(Docker::Volumes::QA_CONTAINER_WORKDIR, 'qa/fixtures/ldap/admin'),
|
92
|
+
non_admin: File.join(Docker::Volumes::QA_CONTAINER_WORKDIR,
|
93
|
+
'qa/fixtures/ldap/non_admin') }
|
95
94
|
run_specs(gitlab, volumes, *rspec_args)
|
96
95
|
end
|
97
96
|
end
|
@@ -87,17 +87,32 @@ module Gitlab
|
|
87
87
|
|
88
88
|
def gitaly_omnibus
|
89
89
|
<<~OMNIBUS
|
90
|
-
gitaly['
|
91
|
-
|
92
|
-
|
93
|
-
|
90
|
+
gitaly['configuration'] = {
|
91
|
+
auth: {
|
92
|
+
token: 'abc123secret',
|
93
|
+
},
|
94
|
+
tls_listen_addr: '0.0.0.0:9999',
|
95
|
+
tls: {
|
96
|
+
certificate_path: '/etc/gitlab/ssl/gitaly.test.crt',
|
97
|
+
key_path: '/etc/gitlab/ssl/gitaly.test.key',
|
98
|
+
},
|
99
|
+
storage: [
|
100
|
+
{
|
101
|
+
name: 'default',
|
102
|
+
path: '/var/opt/gitlab/git-data/repositories',
|
103
|
+
},
|
104
|
+
{
|
105
|
+
name: 'storage1',
|
106
|
+
path: '/mnt/gitlab/git-data/repositories',
|
107
|
+
},
|
108
|
+
],
|
109
|
+
};
|
94
110
|
postgresql['enable'] = false;
|
95
111
|
redis['enable'] = false;
|
96
112
|
nginx['enable'] = false;
|
97
113
|
puma['enable'] = false;
|
98
114
|
sidekiq['enable'] = false;
|
99
115
|
gitlab_workhorse['enable'] = false;
|
100
|
-
grafana['enable'] = false;
|
101
116
|
gitlab_exporter['enable'] = false;
|
102
117
|
alertmanager['enable'] = false;
|
103
118
|
prometheus['enable'] = false;
|
@@ -105,7 +120,6 @@ module Gitlab
|
|
105
120
|
gitlab_rails['rake_cache_clear'] = false;
|
106
121
|
gitlab_rails['auto_migrate'] = false;
|
107
122
|
|
108
|
-
gitaly['auth_token'] = 'abc123secret';
|
109
123
|
gitlab_shell['secret_token'] = 'shellsecret';
|
110
124
|
|
111
125
|
gitlab_rails['internal_api_url'] = 'https://#{@gitlab_name}.#{@network}';
|
@@ -11,7 +11,7 @@ module Gitlab
|
|
11
11
|
attr_reader :gitlab_name
|
12
12
|
|
13
13
|
def initialize
|
14
|
-
@gitlab_name = 'gitlab
|
14
|
+
@gitlab_name = 'gitlab'
|
15
15
|
end
|
16
16
|
|
17
17
|
def perform(release, *rspec_args)
|
@@ -23,8 +23,9 @@ module Gitlab
|
|
23
23
|
gitlab.release = release
|
24
24
|
gitlab.network = 'test'
|
25
25
|
gitlab.name = gitlab_name
|
26
|
+
gitlab.tls = true
|
26
27
|
|
27
|
-
gitlab.omnibus_configuration << gitlab_omnibus_configuration
|
28
|
+
gitlab.omnibus_configuration << gitlab_omnibus_configuration(gitlab.address)
|
28
29
|
|
29
30
|
gitlab.instance do
|
30
31
|
Runtime::Logger.info('Running OAuth specs!')
|
@@ -43,10 +44,10 @@ module Gitlab
|
|
43
44
|
|
44
45
|
private
|
45
46
|
|
46
|
-
def gitlab_omnibus_configuration
|
47
|
+
def gitlab_omnibus_configuration(gitlab_address)
|
47
48
|
<<~OMNIBUS
|
48
49
|
gitlab_rails['omniauth_enabled'] = true;
|
49
|
-
gitlab_rails['omniauth_allow_single_sign_on'] = ['github'];
|
50
|
+
gitlab_rails['omniauth_allow_single_sign_on'] = ['github', 'facebook'];
|
50
51
|
gitlab_rails['omniauth_block_auto_created_users'] = false;
|
51
52
|
gitlab_rails['omniauth_providers'] = [
|
52
53
|
{
|
@@ -56,8 +57,16 @@ module Gitlab
|
|
56
57
|
url: 'https://github.com/',
|
57
58
|
verify_ssl: false,
|
58
59
|
args: { scope: 'user:email' }
|
60
|
+
},
|
61
|
+
{
|
62
|
+
name: 'facebook',
|
63
|
+
app_id: '$QA_FACEBOOK_OAUTH_APP_ID',
|
64
|
+
app_secret: '$QA_FACEBOOK_OAUTH_APP_SECRET',
|
65
|
+
verify_ssl: false
|
59
66
|
}
|
60
67
|
];
|
68
|
+
letsencrypt['enable'] = false;
|
69
|
+
external_url '#{gitlab_address}';
|
61
70
|
OMNIBUS
|
62
71
|
end
|
63
72
|
end
|
@@ -30,14 +30,22 @@ module Gitlab
|
|
30
30
|
}
|
31
31
|
});
|
32
32
|
gitaly['enable'] = true;
|
33
|
-
gitaly['
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
33
|
+
gitaly['configuration'] = {
|
34
|
+
auth: {
|
35
|
+
token: 'secret-token',
|
36
|
+
},
|
37
|
+
listen_addr: '0.0.0.0:8075',
|
38
|
+
tls: {
|
39
|
+
certificate_path: '/etc/gitlab/ssl/gitaly.test.crt',
|
40
|
+
key_path: '/etc/gitlab/ssl/gitaly.test.key',
|
41
|
+
},
|
42
|
+
storage: [
|
43
|
+
{
|
44
|
+
name: 'gitaly',
|
45
|
+
path: '/var/opt/gitlab/git-data/repositories',
|
46
|
+
},
|
47
|
+
],
|
48
|
+
};
|
41
49
|
gitlab_rails['gitaly_token'] = 'secret-token';
|
42
50
|
gitlab_shell['secret_token'] = 'GITLAB_SHELL_SECRET_TOKEN';
|
43
51
|
prometheus['scrape_configs'] = [
|
@@ -60,8 +68,6 @@ module Gitlab
|
|
60
68
|
]
|
61
69
|
}
|
62
70
|
];
|
63
|
-
grafana['disable_login_form'] = false;
|
64
|
-
grafana['admin_password'] = 'GRAFANA_ADMIN_PASSWORD';
|
65
71
|
OMNIBUS
|
66
72
|
end
|
67
73
|
end
|
@@ -14,8 +14,8 @@ module Gitlab
|
|
14
14
|
gitlab.network = 'test'
|
15
15
|
gitlab.name = 'gitlab'
|
16
16
|
gitlab.seed_admin_token = false
|
17
|
-
sign_url_key_path = gitlab.
|
18
|
-
cdn_gcloud_path = gitlab.
|
17
|
+
sign_url_key_path = gitlab.create_key_file('GOOGLE_CDN_SIGNURL_KEY')
|
18
|
+
cdn_gcloud_path = gitlab.create_key_file('GOOGLE_CDN_JSON_KEY')
|
19
19
|
|
20
20
|
gitlab.omnibus_configuration << <<~OMNIBUS
|
21
21
|
external_url 'http://#{gitlab.name}.#{gitlab.network}';
|
@@ -32,6 +32,9 @@ module Gitlab
|
|
32
32
|
specs.network = gitlab.network
|
33
33
|
specs.args = [gitlab.address, *rspec_args]
|
34
34
|
end
|
35
|
+
ensure
|
36
|
+
gitlab.delete_key_file(sign_url_key_path)
|
37
|
+
gitlab.delete_key_file(cdn_gcloud_path)
|
35
38
|
end
|
36
39
|
end
|
37
40
|
end
|
@@ -115,7 +115,7 @@ module Gitlab
|
|
115
115
|
# @param [Gitlab::QA::Release] release
|
116
116
|
# @return [Boolean]
|
117
117
|
def run_specs?(release)
|
118
|
-
[upgrade_path.first, current_release].any?
|
118
|
+
[upgrade_path.first, current_release].any?(release)
|
119
119
|
end
|
120
120
|
end
|
121
121
|
end
|
@@ -12,9 +12,7 @@ module Gitlab
|
|
12
12
|
def perform(image = 'CE', *rspec_args)
|
13
13
|
ce_release = QA::Release.new(image)
|
14
14
|
|
15
|
-
if ce_release.ee?
|
16
|
-
raise ArgumentError, 'Only CE can be upgraded to EE!'
|
17
|
-
end
|
15
|
+
raise ArgumentError, 'Only CE can be upgraded to EE!' if ce_release.ee?
|
18
16
|
|
19
17
|
Docker::Volumes.new.with_temporary_volumes do |volumes|
|
20
18
|
Scenario::Test::Instance::Image
|
@@ -71,7 +71,7 @@ module Gitlab
|
|
71
71
|
end
|
72
72
|
|
73
73
|
def commit_within_hours?(commit_time_string, hours)
|
74
|
-
Time.at(Time.parse(commit_time_string).utc).to_datetime > Time.at((Time.now - hours * 60 * 60).utc).to_datetime
|
74
|
+
Time.at(Time.parse(commit_time_string).utc).to_datetime > Time.at((Time.now - (hours * 60 * 60)).utc).to_datetime
|
75
75
|
end
|
76
76
|
|
77
77
|
def api_commit_detail(host, project, sha)
|
@@ -10,7 +10,7 @@ module Gitlab
|
|
10
10
|
global_server_prereceive_hook = <<~SCRIPT
|
11
11
|
#!/usr/bin/env bash
|
12
12
|
|
13
|
-
if [[
|
13
|
+
if [[ \\$GL_PROJECT_PATH =~ 'reject-prereceive' ]]; then
|
14
14
|
echo 'GL-HOOK-ERR: Custom error message rejecting prereceive hook for projects with GL_PROJECT_PATH matching pattern reject-prereceive'
|
15
15
|
exit 1
|
16
16
|
fi
|