Module: Gitlab::QA::Runtime::Env

Extended by:
Env
Included in:
Env
Defined in:
lib/gitlab/qa/runtime/env.rb

Constant Summary collapse

DEFAULT_ADMIN_PASSWORD =
'5iveL!fe'
ENV_VARIABLES =

Variables that are used in tests and are passed through to the docker container that executes the tests. These variables should be listed in /docs/what_tests_can_be_run.md#supported-gitlab-environment-variables unless they’re defined elsewhere (e.g.: docs.gitlab.com/ee/ci/variables/predefined_variables.html). Any new key-value pairs should also be added to the hash at /rubocop/cop/gitlab/dangerous_interpolation.rb to prevent Rubocop errors.

{
  'ACCEPT_INSECURE_CERTS' => :accept_insecure_certs,
  'AWS_S3_ACCESS_KEY' => :aws_s3_access_key,
  'AWS_S3_BUCKET_NAME' => :aws_s3_bucket_name,
  'AWS_S3_KEY_ID' => :aws_s3_key_id,
  'AWS_S3_REGION' => :aws_s3_region,
  'CACHE_NAMESPACE_NAME' => :cache_namespace_name,
  'CHROME_DISABLE_DEV_SHM' => :chrome_disable_dev_shm,
  'COVERBAND_ENABLED' => :coverband_enabled,
  'CI' => :ci,
  'CI_JOB_ID' => :ci_job_id,
  'CI_JOB_NAME' => :ci_job_name,
  'CI_JOB_NAME_SLUG' => :ci_job_name_slug,
  'CI_JOB_TOKEN' => :ci_job_token,
  'CI_JOB_URL' => :ci_job_url,
  'CI_MERGE_REQUEST_IID' => :ci_merge_request_iid,
  'CI_NODE_INDEX' => :ci_node_index,
  'CI_NODE_TOTAL' => :ci_node_total,
  'CI_PIPELINE_CREATED_AT' => :ci_pipeline_created_at,
  'CI_PIPELINE_ID' => :ci_pipeline_id,
  'CI_PIPELINE_SOURCE' => :ci_pipeline_source,
  'CI_PIPELINE_URL' => :ci_pipeline_url,
  'CI_PROJECT_NAME' => :ci_project_name,
  'CI_PROJECT_PATH' => :ci_project_path,
  'CI_PROJECT_PATH_SLUG' => :ci_project_path_slug,
  'CI_PROJECT_DIR' => :ci_project_dir,
  'CI_RUNNER_ID' => :ci_runner_id,
  'CI_SERVER_HOST' => :ci_server_host,
  'CI_SERVER_PERSONAL_ACCESS_TOKEN' => :ci_server_personal_access_token,
  'COLORIZED_LOGS' => :colorized_logs,
  'CLOUDSDK_CORE_PROJECT' => :cloudsdk_core_project,
  'EE_LICENSE' => :ee_license,
  'ELASTIC_URL' => :elastic_url,
  'FIPS' => :fips,
  'GCS_BUCKET_NAME' => :gcs_bucket_name,
  'GCS_CDN_BUCKET_NAME' => :gcs_cdn_bucket_name,
  'GCLOUD_ACCOUNT_EMAIL' => :gcloud_account_email,
  'GCLOUD_ACCOUNT_KEY' => :gcloud_account_key,
  'GCLOUD_REGION' => :gcloud_region,
  'GEO_FAILOVER' => :geo_failover,
  'GEO_MAX_DB_REPLICATION_TIME' => :geo_max_db_replication_time,
  'GEO_MAX_FILE_REPLICATION_TIME' => :geo_max_file_replication_time,
  'GITLAB_ADMIN_PASSWORD' => :admin_password,
  'GITLAB_ADMIN_USERNAME' => :admin_username,
  'GITLAB_FORKER_PASSWORD' => :forker_password,
  'GITLAB_FORKER_USERNAME' => :forker_username,
  'GITLAB_LDAP_PASSWORD' => :ldap_password,
  'GITLAB_LDAP_USERNAME' => :ldap_username,
  'GITLAB_PASSWORD' => :user_password,
  'GITLAB_QA_ACCESS_TOKEN' => :qa_access_token,
  'GITLAB_QA_ADMIN_ACCESS_TOKEN' => :qa_admin_access_token,
  'GITLAB_QA_CONTAINER_REGISTRY_ACCESS_TOKEN' => :qa_container_registry_access_token,
  'GITLAB_QA_DEV_ACCESS_TOKEN' => :qa_dev_access_token,
  'GITLAB_QA_FORMLESS_LOGIN_TOKEN' => :gitlab_qa_formless_login_token,
  'GITLAB_QA_LOOP_RUNNER_MINUTES' => :gitlab_qa_loop_runner_minutes,
  'GITLAB_QA_PASSWORD_1' => :gitlab_qa_password_1,
  'GITLAB_QA_PASSWORD_2' => :gitlab_qa_password_2,
  'GITLAB_QA_USER_AGENT' => :gitlab_qa_user_agent,
  'GITLAB_QA_USERNAME_1' => :gitlab_qa_username_1,
  'GITLAB_SANDBOX_NAME' => :gitlab_sandbox_name,
  'GITLAB_TLS_CERTIFICATE' => :gitlab_tls_certificate,
  'GITLAB_URL' => :gitlab_url,
  'GITLAB_USER_TYPE' => :user_type,
  'GITLAB_USERNAME' => :user_username,
  'GITLAB_CI' => :gitlab_ci,
  'GITHUB_ACCESS_TOKEN' => :github_access_token,
  'GOOGLE_CDN_JSON_KEY' => :google_cdn_json_key,
  'GOOGLE_CDN_LB' => :google_cdn_load_balancer,
  'GOOGLE_CDN_SIGNURL_KEY' => :google_cdn_signurl_key,
  'GOOGLE_CDN_SIGNURL_KEY_NAME' => :google_cdn_signurl_key_name,
  'GOOGLE_CLIENT_EMAIL' => :google_client_email,
  'GOOGLE_JSON_KEY' => :google_json_key,
  'GOOGLE_PROJECT' => :google_project,
  'JH_ENV' => :jh_env,
  'JIRA_ADMIN_PASSWORD' => :jira_admin_password,
  'JIRA_ADMIN_USERNAME' => :jira_admin_username,
  'JIRA_HOSTNAME' => :jira_hostname,
  'KNAPSACK_GENERATE_REPORT' => :knapsack_generate_report,
  'KNAPSACK_REPORT_PATH' => :knapsack_report_path,
  'KNAPSACK_TEST_DIR' => :knapsack_test_dir,
  'KNAPSACK_TEST_FILE_PATTERN' => :knapsack_test_file_pattern,
  'MAILHOG_HOSTNAME' => :mailhog_hostname,
  'NO_KNAPSACK' => :no_knapsack,
  'QA_ADDITIONAL_REPOSITORY_STORAGE' => :qa_additional_repository_storage,
  'QA_BROWSER' => :browser,
  'QA_CAN_TEST_ADMIN_FEATURES' => :qa_can_test_admin_features,
  'QA_CAN_TEST_GIT_PROTOCOL_V2' => :qa_can_test_git_protocol_v2,
  'QA_CAN_TEST_PRAEFECT' => :qa_can_test_praefect,
  'QA_COOKIES' => :qa_cookie,
  'QA_DEBUG' => :qa_debug,
  'QA_DOCKER_NETWORK' => :docker_network,
  'QA_EXPORT_TEST_METRICS' => :qa_export_test_metrics,
  'QA_GITALY_NON_CLUSTER_STORAGE' => :qa_gitaly_non_cluster_storage,
  'QA_GITHUB_OAUTH_APP_ID' => :github_oauth_app_id,
  'QA_GITHUB_OAUTH_APP_SECRET' => :github_oauth_app_secret,
  'QA_GITHUB_PASSWORD' => :qa_github_password,
  'QA_GITHUB_USERNAME' => :qa_github_username,
  'QA_GITLAB_HOSTNAME' => :qa_gitlab_hostname,
  'QA_GITLAB_USE_TLS' => :qa_gitlab_use_tls,
  'QA_IMAGE' => :qa_image,
  'QA_INFLUXDB_TOKEN' => :qa_influxdb_token,
  'QA_INFLUXDB_URL' => :qa_influxdb_url,
  'QA_KNAPSACK_REPORT_GCS_CREDENTIALS' => :qa_knapsack_report_gcs_credentials,
  'QA_KNAPSACK_REPORT_PATH' => :qa_knapsack_report_path,
  'QA_LAYOUT' => :layout,
  'QA_PRAEFECT_REPOSITORY_STORAGE' => :qa_praefect_repository_storage,
  'QA_RECORD_VIDEO' => :record_video,
  'QA_REMOTE_GRID' => :remote_grid,
  'QA_REMOTE_GRID_ACCESS_KEY' => :remote_grid_access_key,
  'QA_REMOTE_GRID_PROTOCOL' => :remote_grid_protocol,
  'QA_REMOTE_GRID_USERNAME' => :remote_grid_username,
  'QA_REMOTE_MOBILE_DEVICE_NAME' => :remote_mobile_device_name,
  'QA_REMOTE_TUNNEL_ID' => :remote_tunnel_id,
  'QA_RSPEC_REPORT_PATH' => :qa_rspec_report_path,
  'QA_SELENOID_BROWSER_IMAGE' => :selenoid_browser_image,
  'QA_SELENOID_BROWSER_VERSION' => :selenoid_browser_version,
  'QA_SIMULATE_SLOW_CONNECTION' => :qa_simulate_slow_connection,
  'QA_SKIP_PULL' => :qa_skip_pull,
  'QA_SLOW_CONNECTION_LATENCY_MS' => :qa_slow_connection_latency_ms,
  'QA_SLOW_CONNECTION_THROUGHPUT_KBPS' => :qa_slow_connection_throughput_kbps,
  'QA_VALIDATE_RESOURCE_REUSE' => :qa_validate_resource_reuse,
  'QA_VIDEO_RECORDER_IMAGE' => :video_recorder_image,
  'QA_VIDEO_RECORDER_VERSION' => :video_recorder_version,
  'QA_1P_EMAIL' => :qa_1p_email,
  'QA_1P_GITHUB_UUID' => :qa_1p_github_uuid,
  'QA_1P_PASSWORD' => :qa_1p_password,
  'QA_1P_SECRET' => :qa_1p_secret,
  'RELEASE' => :release,
  'RELEASE_REGISTRY_PASSWORD' => :release_registry_password,
  'RELEASE_REGISTRY_URL' => :release_registry_url,
  'RELEASE_REGISTRY_USERNAME' => :release_registry_username,
  'RSPEC_FAST_QUARANTINE_PATH' => :rspec_fast_quarantine_path,
  'RSPEC_SKIPPED_TESTS_REPORT_PATH' => :skipped_tests_report_path,
  'SCHEDULE_TYPE' => :schedule_type,
  'SELENOID_DIRECTORY' => :selenoid_directory,
  'SIGNUP_DISABLED' => :signup_disabled,
  'SIMPLE_SAML_FINGERPRINT' => :simple_saml_fingerprint,
  'SIMPLE_SAML_HOSTNAME' => :simple_saml_hostname,
  'SMOKE_ONLY' => :smoke_only,
  'TOP_UPSTREAM_MERGE_REQUEST_IID' => :top_upstream_merge_request_iid,
  'USE_SELENOID' => :use_selenoid,
  'WEBDRIVER_HEADLESS' => :webdriver_headless,
  'WORKSPACES_DOMAIN_CERT' => { name: :workspaces_domain_cert, type: :file },
  'WORKSPACES_DOMAIN_KEY' => { name: :workspaces_domain_key, type: :file },
  'WORKSPACES_OAUTH_APP_ID' => :workspaces_oauth_app_id,
  'WORKSPACES_OAUTH_APP_SECRET' => :workspaces_oauth_app_secret,
  'WORKSPACES_OAUTH_SIGNING_KEY' => :workspaces_oauth_signing_key,
  'WORKSPACES_PROXY_DOMAIN' => :workspaces_proxy_domain,
  'WORKSPACES_WILDCARD_CERT' => { name: :workspaces_wildcard_cert, type: :file },
  'WORKSPACES_WILDCARD_KEY' => { name: :workspaces_wildcard_key, type: :file },
  'EPIC_SYNC_TEST' => :epic_sync_test
}.freeze

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.qa_gitaly_transactions_enabled?Boolean

Returns:

  • (Boolean)


479
480
481
# File 'lib/gitlab/qa/runtime/env.rb', line 479

def self.qa_gitaly_transactions_enabled?
  enabled?(env_var_value_if_defined('QA_GITALY_TRANSACTIONS_ENABLED'), default: false)
end

Instance Method Details

#admin_passwordObject



190
191
192
# File 'lib/gitlab/qa/runtime/env.rb', line 190

def admin_password
  ENV['GITLAB_ADMIN_PASSWORD'] || DEFAULT_ADMIN_PASSWORD
end

#allow_separate_ci_databaseObject



463
464
465
# File 'lib/gitlab/qa/runtime/env.rb', line 463

def allow_separate_ci_database
  enabled?(env_var_value_if_defined('GITLAB_ALLOW_SEPARATE_CI_DATABASE'), default: false)
end

#cloud_connector_base_urlObject



427
428
429
# File 'lib/gitlab/qa/runtime/env.rb', line 427

def cloud_connector_base_url
  env_var_value_if_defined('CLOUD_CONNECTOR_BASE_URL')
end

#colorized_logs?Boolean

Returns:

  • (Boolean)


230
231
232
# File 'lib/gitlab/qa/runtime/env.rb', line 230

def colorized_logs?
  enabled?(ENV.fetch('COLORIZED_LOGS', nil), default: false)
end

#coverband_enabled?Boolean

Returns:

  • (Boolean)


467
468
469
# File 'lib/gitlab/qa/runtime/env.rb', line 467

def coverband_enabled?
  enabled?(env_var_value_if_defined('COVERBAND_ENABLED'), default: false)
end

#customer_portal_urlObject



423
424
425
# File 'lib/gitlab/qa/runtime/env.rb', line 423

def customer_portal_url
  env_var_value_if_defined('CUSTOMER_PORTAL_URL') || 'https://customers.staging.gitlab.com'
end

#debug?Boolean

Returns:

  • (Boolean)


202
203
204
# File 'lib/gitlab/qa/runtime/env.rb', line 202

def debug?
  enabled?(ENV.fetch('QA_DEBUG', nil), default: true)
end

#dev_access_token_variableObject



234
235
236
# File 'lib/gitlab/qa/runtime/env.rb', line 234

def dev_access_token_variable
  env_var_name_if_defined('GITLAB_QA_DEV_ACCESS_TOKEN')
end

#docker_add_hostsObject



403
404
405
# File 'lib/gitlab/qa/runtime/env.rb', line 403

def docker_add_hosts
  (env_var_value_if_defined('QA_DOCKER_ADD_HOSTS') || '').split(',')
end

#docker_networkObject

The default network for the Docker containers

Examples:

<component>.test



399
400
401
# File 'lib/gitlab/qa/runtime/env.rb', line 399

def docker_network
  env_var_value_if_defined('QA_DOCKER_NETWORK') || 'test'
end

#ee_activation_codeObject



431
432
433
# File 'lib/gitlab/qa/runtime/env.rb', line 431

def ee_activation_code
  env_var_value_if_defined('QA_EE_ACTIVATION_CODE')
end

#elastic_versionObject



244
245
246
# File 'lib/gitlab/qa/runtime/env.rb', line 244

def elastic_version
  env_var_value_if_defined('ELASTIC_VERSION') || '8.2.0'
end

#geo_failover?Boolean

Returns:

  • (Boolean)


344
345
346
# File 'lib/gitlab/qa/runtime/env.rb', line 344

def geo_failover?
  enabled?(env_var_value_if_defined('GEO_FAILOVER'), default: false)
end

#geo_staging_ref_urlObject



447
448
449
# File 'lib/gitlab/qa/runtime/env.rb', line 447

def geo_staging_ref_url
  env_var_value_if_defined('GEO_STAGING_REF_URL') || 'https://geo.staging-ref.gitlab.com'
end

#geo_staging_urlObject



435
436
437
# File 'lib/gitlab/qa/runtime/env.rb', line 435

def geo_staging_url
  env_var_value_if_defined('GEO_STAGING_URL') || 'https://geo.staging.gitlab.com'
end

#gitlab_availability_timeoutObject



214
215
216
# File 'lib/gitlab/qa/runtime/env.rb', line 214

def gitlab_availability_timeout
  (env_var_value_if_defined('GITLAB_QA_AVAILABILITY_TIMEOUT') || 360).to_i
end

#gitlab_dev_usernameObject



222
223
224
# File 'lib/gitlab/qa/runtime/env.rb', line 222

def gitlab_dev_username
  env_var_value_if_defined('GITLAB_DEV_USERNAME') || 'gitlab-qa-bot'
end

#gitlab_license_modeObject



419
420
421
# File 'lib/gitlab/qa/runtime/env.rb', line 419

def gitlab_license_mode
  env_var_value_if_defined('GITLAB_LICENSE_MODE')
end

#gitlab_usernameObject



218
219
220
# File 'lib/gitlab/qa/runtime/env.rb', line 218

def gitlab_username
  env_var_value_if_defined('GITLAB_USERNAME') || 'gitlab-qa'
end

#host_artifacts_dirObject



238
239
240
241
242
# File 'lib/gitlab/qa/runtime/env.rb', line 238

def host_artifacts_dir
  @host_artifacts_dir ||= File.join(
    env_var_value_if_defined('QA_ARTIFACTS_DIR') || '/tmp/gitlab-qa', Runtime::Env.run_id
  )
end

#jh_env?Boolean

Returns:

  • (Boolean)


407
408
409
# File 'lib/gitlab/qa/runtime/env.rb', line 407

def jh_env?
  enabled?(env_var_value_if_defined('JH_ENV'), default: false)
end

#log_levelObject



206
207
208
# File 'lib/gitlab/qa/runtime/env.rb', line 206

def log_level
  env_var_value_if_defined('QA_LOG_LEVEL')&.upcase || 'INFO'
end

#log_pathObject



210
211
212
# File 'lib/gitlab/qa/runtime/env.rb', line 210

def log_path
  env_var_value_if_defined('QA_LOG_PATH') || host_artifacts_dir
end

#mobile_layout?Boolean

Returns:

  • (Boolean)


360
361
362
# File 'lib/gitlab/qa/runtime/env.rb', line 360

def mobile_layout?
  env_var_value_if_defined('QA_LAYOUT')&.match?(/tablet|phone/i)
end

#mock_github_enabled?Boolean

Returns:

  • (Boolean)


471
472
473
# File 'lib/gitlab/qa/runtime/env.rb', line 471

def mock_github_enabled?
  enabled?(env_var_value_if_defined('QA_MOCK_GITHUB'), default: true)
end

#opensearch_versionObject



248
249
250
# File 'lib/gitlab/qa/runtime/env.rb', line 248

def opensearch_version
  env_var_value_if_defined('OPENSEARCH_VERSION') || '2.0.1'
end

#preprod_urlObject



459
460
461
# File 'lib/gitlab/qa/runtime/env.rb', line 459

def preprod_url
  env_var_value_if_defined('PREPROD_URL') || 'https://pre.gitlab.com'
end

#production_urlObject



455
456
457
# File 'lib/gitlab/qa/runtime/env.rb', line 455

def production_url
  env_var_value_if_defined('PRODUCTION_URL') || 'https://gitlab.com'
end

#qa_com_registryObject



415
416
417
# File 'lib/gitlab/qa/runtime/env.rb', line 415

def qa_com_registry
  env_var_value_if_defined('QA_COM_REGISTRY') || 'registry.gitlab.com'
end

#qa_dev_registryObject



411
412
413
# File 'lib/gitlab/qa/runtime/env.rb', line 411

def qa_dev_registry
  env_var_value_if_defined('QA_DEV_REGISTRY') || 'dev.gitlab.org:5005'
end

#qa_export_test_metrics?Boolean

Returns:

  • (Boolean)


348
349
350
# File 'lib/gitlab/qa/runtime/env.rb', line 348

def qa_export_test_metrics?
  enabled?(env_var_value_if_defined('QA_EXPORT_TEST_METRICS'), default: true)
end

#qa_gitlab_use_tls?Boolean

Returns:

  • (Boolean)


340
341
342
# File 'lib/gitlab/qa/runtime/env.rb', line 340

def qa_gitlab_use_tls?
  enabled?(env_var_value_if_defined('QA_GITLAB_USE_TLS'), default: false)
end

#qa_run_typeObject



381
382
383
384
385
386
387
388
389
390
391
392
393
394
# File 'lib/gitlab/qa/runtime/env.rb', line 381

def qa_run_type
  return env_var_value_if_defined('QA_RUN_TYPE') if env_var_value_valid?('QA_RUN_TYPE')

  live_envs = %w[staging staging-canary staging-ref canary preprod production]
  return unless live_envs.include?(ci_project_name)

  test_subset = if env_var_value_if_defined('SMOKE_ONLY') == 'true'
                  'sanity'
                else
                  'full'
                end

  "#{ci_project_name}-#{test_subset}"
end

#release_urlObject



451
452
453
# File 'lib/gitlab/qa/runtime/env.rb', line 451

def release_url
  env_var_value_if_defined('RELEASE_URL') || 'https://release.gitlab.net'
end

#require_aws_s3_environment!Object



282
283
284
285
286
287
288
289
# File 'lib/gitlab/qa/runtime/env.rb', line 282

def require_aws_s3_environment!
  %w[AWS_S3_REGION AWS_S3_KEY_ID AWS_S3_ACCESS_KEY AWS_S3_BUCKET_NAME].each do |env_key|
    unless ENV.key?(env_key)
      raise ArgumentError,
        "Environment variable #{env_key} must be set to run AWS S3 object storage specs"
    end
  end
end

#require_cloud_connector_base_url!Object

Raises:

  • (ArgumentError)


330
331
332
333
334
# File 'lib/gitlab/qa/runtime/env.rb', line 330

def require_cloud_connector_base_url!
  return unless cloud_connector_base_url.blank?

  raise ArgumentError, "Please provide CLOUD_CONNECTOR_BASE_URL"
end

#require_gcs_environment!Object



291
292
293
294
295
296
297
298
# File 'lib/gitlab/qa/runtime/env.rb', line 291

def require_gcs_environment!
  %w[GOOGLE_PROJECT GOOGLE_CLIENT_EMAIL GOOGLE_JSON_KEY GCS_BUCKET_NAME].each do |env_key|
    unless ENV.key?(env_key)
      raise ArgumentError,
        "Environment variable #{env_key} must be set to run GCS object storage specs"
    end
  end
end

#require_gcs_with_cdn_environment!Object



300
301
302
303
304
305
306
307
308
# File 'lib/gitlab/qa/runtime/env.rb', line 300

def require_gcs_with_cdn_environment!
  %w[GOOGLE_CDN_JSON_KEY GCS_CDN_BUCKET_NAME GOOGLE_CDN_LB GOOGLE_CDN_SIGNURL_KEY
    GOOGLE_CDN_SIGNURL_KEY_NAME].each do |env_key|
    unless ENV.key?(env_key)
      raise ArgumentError,
        "Environment variable #{env_key} must be set to run GCS with CDN enabled scenario"
    end
  end
end

#require_github_oauth_environment!Object



320
321
322
323
324
325
326
327
328
# File 'lib/gitlab/qa/runtime/env.rb', line 320

def require_github_oauth_environment!
  %w[QA_GITHUB_OAUTH_APP_ID QA_GITHUB_OAUTH_APP_SECRET QA_GITHUB_USERNAME
    QA_GITHUB_PASSWORD QA_1P_EMAIL QA_1P_PASSWORD QA_1P_SECRET QA_1P_GITHUB_UUID].each do |env_key|
    unless ENV.key?(env_key)
      raise ArgumentError,
        "Environment variable #{env_key} must be set to run OAuth specs"
    end
  end
end

#require_license!Object

Raises:

  • (ArgumentError)


252
253
254
255
256
# File 'lib/gitlab/qa/runtime/env.rb', line 252

def require_license!
  return if ENV.include?('EE_LICENSE')

  raise ArgumentError, 'GitLab License is not available. Please load a license into EE_LICENSE env variable.'
end

#require_no_license!Object

Raises:

  • (ArgumentError)


258
259
260
261
262
# File 'lib/gitlab/qa/runtime/env.rb', line 258

def require_no_license!
  return unless ENV.include?('EE_LICENSE')

  raise ArgumentError, "Unexpected EE_LICENSE provided. Please unset it to continue."
end

#require_oauth_environment!Object



310
311
312
313
314
315
316
317
318
# File 'lib/gitlab/qa/runtime/env.rb', line 310

def require_oauth_environment!
  %w[QA_GITHUB_OAUTH_APP_ID QA_GITHUB_OAUTH_APP_SECRET QA_GITHUB_USERNAME
    QA_GITHUB_PASSWORD QA_1P_EMAIL QA_1P_PASSWORD QA_1P_SECRET QA_1P_GITHUB_UUID].each do |env_key|
    unless ENV.key?(env_key)
      raise ArgumentError,
        "Environment variable #{env_key} must be set to run OAuth specs"
    end
  end
end

#require_qa_access_token!Object

Raises:

  • (ArgumentError)


264
265
266
267
268
# File 'lib/gitlab/qa/runtime/env.rb', line 264

def require_qa_access_token!
  return unless env_var_value_if_defined('GITLAB_QA_ACCESS_TOKEN').to_s.strip.empty?

  raise ArgumentError, "Please provide GITLAB_QA_ACCESS_TOKEN"
end

#require_qa_container_registry_access_token!Object

Raises:

  • (ArgumentError)


276
277
278
279
280
# File 'lib/gitlab/qa/runtime/env.rb', line 276

def require_qa_container_registry_access_token!
  return unless env_var_value_if_defined('GITLAB_QA_CONTAINER_REGISTRY_ACCESS_TOKEN').to_s.strip.empty?

  raise ArgumentError, "Please provide GITLAB_QA_CONTAINER_REGISTRY_ACCESS_TOKEN"
end

#require_qa_dev_access_token!Object

Raises:

  • (ArgumentError)


270
271
272
273
274
# File 'lib/gitlab/qa/runtime/env.rb', line 270

def require_qa_dev_access_token!
  return unless env_var_value_if_defined('GITLAB_QA_DEV_ACCESS_TOKEN').to_s.strip.empty?

  raise ArgumentError, "Please provide GITLAB_QA_DEV_ACCESS_TOKEN"
end

#retry_failed_specs?Boolean

Returns:

  • (Boolean)


475
476
477
# File 'lib/gitlab/qa/runtime/env.rb', line 475

def retry_failed_specs?
  enabled?(env_var_value_if_defined('QA_RETRY_FAILED_SPECS'), default: false)
end

#run_idObject



226
227
228
# File 'lib/gitlab/qa/runtime/env.rb', line 226

def run_id
  @run_id ||= "gitlab-qa-run-#{Time.now.strftime('%Y-%m-%d-%H-%M-%S')}-#{SecureRandom.hex(4)}"
end

#selenoid_browser_imageObject



373
374
375
# File 'lib/gitlab/qa/runtime/env.rb', line 373

def selenoid_browser_image
  env_var_value_if_defined('QA_SELENOID_BROWSER_IMAGE') || 'selenoid/chrome'
end

#selenoid_browser_versionObject



377
378
379
# File 'lib/gitlab/qa/runtime/env.rb', line 377

def selenoid_browser_version
  env_var_value_if_defined('QA_SELENOID_BROWSER_VERSION') || '111.0'
end

#selenoid_directoryObject



352
353
354
# File 'lib/gitlab/qa/runtime/env.rb', line 352

def selenoid_directory
  env_var_value_if_defined('SELENOID_DIRECTORY') || "#{host_artifacts_dir}/selenoid"
end

#skip_pull?Boolean

Returns:

  • (Boolean)


336
337
338
# File 'lib/gitlab/qa/runtime/env.rb', line 336

def skip_pull?
  enabled?(env_var_value_if_defined('QA_SKIP_PULL'), default: false)
end

#staging_ref_urlObject



443
444
445
# File 'lib/gitlab/qa/runtime/env.rb', line 443

def staging_ref_url
  env_var_value_if_defined('STAGING_REF_URL') || 'https://staging-ref.gitlab.com'
end

#staging_urlObject



439
440
441
# File 'lib/gitlab/qa/runtime/env.rb', line 439

def staging_url
  env_var_value_if_defined('STAGING_URL') || 'https://staging.gitlab.com'
end

#use_selenoid?Boolean

Returns:

  • (Boolean)


356
357
358
# File 'lib/gitlab/qa/runtime/env.rb', line 356

def use_selenoid?
  enabled?(env_var_value_if_defined('USE_SELENOID'), default: false)
end

#variablesObject



174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
# File 'lib/gitlab/qa/runtime/env.rb', line 174

def variables
  defined_variables = ENV_VARIABLES.each_with_object({}) do |(env_var_name, attributes), vars|
    method_name, value = method_name_and_value(env_var_name, attributes, name_as_value: true)
    value ||= send(method_name) # rubocop:disable GitlabSecurity/PublicSend
    vars[env_var_name] = value if value
  end
  qa_variables = ENV.each_with_object({}) do |(name, _value), vars|
    next unless name.start_with?('QA_')

    var_name = env_var_name_if_defined(name)
    vars[name] = var_name if var_name
  end

  qa_variables.merge(defined_variables)
end

#variables_to_maskArray

Variables that should be masked

Returns:

  • (Array)

    the values of the variables that should be masked



197
198
199
200
# File 'lib/gitlab/qa/runtime/env.rb', line 197

def variables_to_mask
  # Consider all file variables to need masking by default because they're likely to be secrets
  variables.select { |k, _| ENV_VARIABLES[k].is_a?(Hash) && ENV_VARIABLES[k][:type] == :file }.values
end

#video_recorder_imageObject



364
365
366
367
# File 'lib/gitlab/qa/runtime/env.rb', line 364

def video_recorder_image
  env_var_value_if_defined('QA_VIDEO_RECORDER_IMAGE') ||
    'registry.gitlab.com/gitlab-org/gitlab-qa/selenoid-manual-video-recorder'
end

#video_recorder_versionObject



369
370
371
# File 'lib/gitlab/qa/runtime/env.rb', line 369

def video_recorder_version
  env_var_value_if_defined('QA_VIDEO_RECORDER_VERSION') || 'latest'
end