gitlab-qa 6.21.4 → 7.0.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.
Files changed (52) hide show
  1. checksums.yaml +4 -4
  2. data/.gitlab-ci.yml +32 -31
  3. data/docs/configuring_omnibus.md +208 -0
  4. data/docs/run_qa_against_gdk.md +4 -0
  5. data/docs/what_tests_can_be_run.md +46 -8
  6. data/gitlab-qa.gemspec +6 -4
  7. data/lib/gitlab/qa.rb +7 -0
  8. data/lib/gitlab/qa/component/gitlab.rb +36 -29
  9. data/lib/gitlab/qa/component/minio.rb +2 -10
  10. data/lib/gitlab/qa/component/specs.rb +10 -9
  11. data/lib/gitlab/qa/docker/engine.rb +36 -5
  12. data/lib/gitlab/qa/report/test_result.rb +5 -1
  13. data/lib/gitlab/qa/runner.rb +57 -5
  14. data/lib/gitlab/qa/runtime/env.rb +2 -0
  15. data/lib/gitlab/qa/runtime/omnibus_configuration.rb +70 -0
  16. data/lib/gitlab/qa/runtime/omnibus_configurations/default.rb +25 -0
  17. data/lib/gitlab/qa/runtime/omnibus_configurations/object_storage.rb +48 -0
  18. data/lib/gitlab/qa/runtime/omnibus_configurations/packages.rb +17 -0
  19. data/lib/gitlab/qa/scenario/cli_commands.rb +3 -3
  20. data/lib/gitlab/qa/scenario/test/instance/relative_url.rb +1 -3
  21. data/lib/gitlab/qa/scenario/test/instance/repository_storage.rb +1 -1
  22. data/lib/gitlab/qa/scenario/test/integration/actioncable.rb +1 -3
  23. data/lib/gitlab/qa/scenario/test/integration/geo.rb +4 -5
  24. data/lib/gitlab/qa/scenario/test/integration/gitaly_cluster.rb +4 -5
  25. data/lib/gitlab/qa/scenario/test/integration/group_saml.rb +1 -1
  26. data/lib/gitlab/qa/scenario/test/integration/instance_saml.rb +1 -1
  27. data/lib/gitlab/qa/scenario/test/integration/kubernetes.rb +1 -1
  28. data/lib/gitlab/qa/scenario/test/integration/ldap.rb +1 -4
  29. data/lib/gitlab/qa/scenario/test/integration/ldap_no_server.rb +1 -1
  30. data/lib/gitlab/qa/scenario/test/integration/ldap_no_tls.rb +1 -1
  31. data/lib/gitlab/qa/scenario/test/integration/ldap_tls.rb +1 -2
  32. data/lib/gitlab/qa/scenario/test/integration/mattermost.rb +1 -1
  33. data/lib/gitlab/qa/scenario/test/integration/mtls.rb +3 -7
  34. data/lib/gitlab/qa/scenario/test/integration/smtp.rb +1 -1
  35. data/lib/gitlab/qa/scenario/test/integration/ssh_tunnel.rb +1 -1
  36. data/lib/gitlab/qa/version.rb +1 -1
  37. data/tls_certificates/authority/ca.crt +32 -0
  38. data/tls_certificates/authority/ca.key +51 -0
  39. data/tls_certificates/authority/ca.pem +83 -0
  40. data/tls_certificates/gitaly/gitaly.test.crt +30 -0
  41. data/tls_certificates/gitaly/gitaly.test.csr +28 -0
  42. data/tls_certificates/gitaly/gitaly.test.key +51 -0
  43. data/tls_certificates/gitlab/gitlab.test.crt +28 -29
  44. data/tls_certificates/gitlab/gitlab.test.csr +28 -0
  45. data/tls_certificates/gitlab/gitlab.test.key +51 -52
  46. metadata +19 -13
  47. data/lib/gitlab/qa/scenario/test/integration/object_storage.rb +0 -64
  48. data/lib/gitlab/qa/scenario/test/integration/packages.rb +0 -36
  49. data/tls_certificates/gitaly/ssl/gitaly.test.crt +0 -33
  50. data/tls_certificates/gitaly/ssl/gitaly.test.key +0 -52
  51. data/tls_certificates/gitaly/trusted-certs/gitaly.test.crt +0 -33
  52. data/tls_certificates/gitaly/trusted-certs/gitlab.test.crt +0 -31
@@ -10,6 +10,7 @@ module Gitlab
10
10
  # These variables should be listed in /docs/what_tests_can_be_run.md#supported-gitlab-environment-variables
11
11
  # unless they're defined elsewhere (e.g.: https://docs.gitlab.com/ee/ci/variables/predefined_variables.html)
12
12
  ENV_VARIABLES = {
13
+ 'QA_IMAGE' => :qa_image,
13
14
  'QA_REMOTE_GRID' => :remote_grid,
14
15
  'QA_REMOTE_GRID_USERNAME' => :remote_grid_username,
15
16
  'QA_REMOTE_GRID_ACCESS_KEY' => :remote_grid_access_key,
@@ -64,6 +65,7 @@ module Gitlab
64
65
  'KNAPSACK_TEST_FILE_PATTERN' => :knapsack_test_file_pattern,
65
66
  'KNAPSACK_TEST_DIR' => :knapsack_test_dir,
66
67
  'CI' => :ci,
68
+ 'CI_JOB_NAME' => :ci_job_name,
67
69
  'CI_JOB_URL' => :ci_job_url,
68
70
  'CI_RUNNER_ID' => :ci_runner_id,
69
71
  'CI_SERVER_HOST' => :ci_server_host,
@@ -0,0 +1,70 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'active_support/core_ext/object/blank'
4
+
5
+ module Gitlab
6
+ module QA
7
+ module Runtime
8
+ class OmnibusConfiguration
9
+ def initialize
10
+ @config = ["# Generated by GitLab QA Omnibus Configurator at #{Time.now.strftime('%Y-%m-%d %H:%M:%S')}"]
11
+ end
12
+
13
+ def to_s
14
+ sanitize!.join("\n")
15
+ end
16
+
17
+ def configuration
18
+ raise NotImplementedError
19
+ end
20
+
21
+ # Before hook for any additional configuration
22
+ # This would usually be a container that needs to be running
23
+ # @return Any instance of [Gitlab::QA::Component::Base]
24
+ def prepare; end
25
+
26
+ # Commands to execute before GitLab boots
27
+ def exec_commands
28
+ []
29
+ end
30
+
31
+ # Ensures no duplicate entries
32
+ # @raise RuntimeError if competing configurations exist
33
+ # rubocop:disable Metrics/AbcSize
34
+ def sanitize!
35
+ sanitized = @config.map do |config|
36
+ next config if config.start_with?('#') || config.match(/\w+\(/) # allow for comments and method invocations
37
+
38
+ # sometimes "=" is part of a Hash. Only split based on the first "="
39
+ k, v = config.split("=", 2)
40
+ # make sure each config is well-formed
41
+ # e.g., gitlab_rails['packages_enabled'] = true
42
+ # NOT gitlab_rails['packages_enabled']=true
43
+
44
+ v.nil? ? k.strip : "#{k.strip} = #{v.strip.tr('"', "'")}".strip
45
+ end.uniq
46
+
47
+ errors = []
48
+
49
+ # check for duplicates
50
+ duplicate_keys = []
51
+ duplicates = sanitized.reject do |n|
52
+ key = n.split('=').first
53
+ duplicate_keys << key unless duplicate_keys.include?(key)
54
+ end
55
+
56
+ duplicates.each { |duplicate| errors << "Duplicate entry found: `#{duplicate}`" }
57
+
58
+ raise "Errors exist within the Omnibus Configuration!\n#{errors.join(',')}" if errors.any?
59
+
60
+ @config = sanitized
61
+ end
62
+ # rubocop:enable Metrics/AbcSize
63
+
64
+ def <<(config)
65
+ @config << config.strip unless config.strip.empty?
66
+ end
67
+ end
68
+ end
69
+ end
70
+ end
@@ -0,0 +1,25 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Gitlab
4
+ module QA
5
+ module Runtime
6
+ module OmnibusConfigurations
7
+ # Default Configuration for Omnibus
8
+ # All runs will include this configuration
9
+ class Default < Runtime::OmnibusConfiguration
10
+ def configuration
11
+ <<~OMNIBUS
12
+ gitlab_rails['gitlab_default_theme'] = 10 # Light Red Theme
13
+ gitlab_rails['gitlab_disable_animations'] = true # Disable animations
14
+ gitlab_rails['application_settings_cache_seconds'] = 0 # Settings cache expiry
15
+ OMNIBUS
16
+ end
17
+
18
+ def self.configuration
19
+ new.configuration
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,48 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Gitlab
4
+ module QA
5
+ module Runtime
6
+ module OmnibusConfigurations
7
+ class ObjectStorage < Default
8
+ TYPES = %w[artifacts external_diffs lfs uploads packages dependency_proxy].freeze
9
+
10
+ def configuration
11
+ TYPES.each_with_object(+'') do |object_type, omnibus|
12
+ omnibus << <<~OMNIBUS
13
+ gitlab_rails['#{object_type}_enabled'] = true
14
+ gitlab_rails['#{object_type}_storage_path'] = '/var/opt/gitlab/gitlab-rails/shared/#{object_type}'
15
+ gitlab_rails['#{object_type}_object_store_enabled'] = true
16
+ gitlab_rails['#{object_type}_object_store_remote_directory'] = '#{object_type}-bucket'
17
+ gitlab_rails['#{object_type}_object_store_background_upload'] = false
18
+ gitlab_rails['#{object_type}_object_store_direct_upload'] = true
19
+ gitlab_rails['#{object_type}_object_store_proxy_download'] = true
20
+ gitlab_rails['#{object_type}_object_store_connection'] = #{minio.to_config}
21
+ OMNIBUS
22
+ end
23
+ end
24
+
25
+ def prepare
26
+ minio.network = 'test'
27
+
28
+ TYPES.each do |bucket_name|
29
+ minio.add_bucket("#{bucket_name}-bucket")
30
+ end
31
+
32
+ minio
33
+ end
34
+
35
+ def exec_commands
36
+ QA::Scenario::CLICommands.git_lfs_install_commands
37
+ end
38
+
39
+ private
40
+
41
+ def minio
42
+ @minio ||= Component::Minio.new
43
+ end
44
+ end
45
+ end
46
+ end
47
+ end
48
+ end
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Gitlab
4
+ module QA
5
+ module Runtime
6
+ module OmnibusConfigurations
7
+ class Packages < Default
8
+ def configuration
9
+ <<~OMNIBUS
10
+ gitlab_rails['packages_enabled'] = true
11
+ OMNIBUS
12
+ end
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
@@ -4,11 +4,11 @@ module Gitlab
4
4
  module CLICommands
5
5
  GIT_LFS_VERSION = '2.8.0'.freeze
6
6
 
7
- def git_lfs_install_commands
8
- @git_lfs_install_commands ||= [
7
+ def self.git_lfs_install_commands
8
+ [
9
9
  "cd /tmp ; curl -qsL https://github.com/git-lfs/git-lfs/releases/download/v#{GIT_LFS_VERSION}/git-lfs-linux-amd64-v#{GIT_LFS_VERSION}.tar.gz | tar xzvf -",
10
10
  'cp /tmp/git-lfs /usr/local/bin'
11
- ]
11
+ ].freeze
12
12
  end
13
13
  end
14
14
  end
@@ -10,9 +10,7 @@ module Gitlab
10
10
  gitlab.network = 'test'
11
11
  gitlab.relative_path = '/relative'
12
12
 
13
- gitlab.omnibus_config = <<~OMNIBUS
14
- external_url '#{gitlab.address}';
15
- OMNIBUS
13
+ gitlab.omnibus_configuration << "external_url '#{gitlab.address}'"
16
14
 
17
15
  gitlab.instance do
18
16
  Component::Specs.perform do |specs|
@@ -9,7 +9,7 @@ module Gitlab
9
9
  gitlab.release = QA::Release.new(release)
10
10
  gitlab.name = 'gitlab'
11
11
  gitlab.network = 'test'
12
- gitlab.omnibus_config = <<~OMNIBUS
12
+ gitlab.omnibus_configuration << <<~OMNIBUS
13
13
  git_data_dirs({
14
14
  'default' => {
15
15
  'path' => '/var/opt/gitlab/git-data/repositories/default'
@@ -9,9 +9,7 @@ module Gitlab
9
9
  gitlab.release = QA::Release.new(release)
10
10
  gitlab.name = 'gitlab-actioncable'
11
11
  gitlab.network = 'test'
12
- gitlab.omnibus_config = <<~OMNIBUS
13
- actioncable['enable'] = true;
14
- OMNIBUS
12
+ gitlab.omnibus_configuration << "actioncable['enable'] = true"
15
13
 
16
14
  gitlab.instance do
17
15
  puts "Running actioncable specs!"
@@ -4,7 +4,6 @@ module Gitlab
4
4
  module Test
5
5
  module Integration
6
6
  class Geo < Scenario::Template
7
- include Scenario::CLICommands
8
7
  ##
9
8
  # rubocop:disable Lint/MissingCopEnableDirective
10
9
  # rubocop:disable Metrics/AbcSize
@@ -20,7 +19,7 @@ module Gitlab
20
19
  primary.release = release
21
20
  primary.name = 'gitlab-primary'
22
21
  primary.network = 'geo'
23
- primary.omnibus_config = <<~OMNIBUS
22
+ primary.omnibus_configuration << <<~OMNIBUS
24
23
  gitlab_rails['db_key_base'] = '4dd58204865eb41bca93bd38131d51cc';
25
24
  geo_primary_role['enable'] = true;
26
25
  gitlab_rails['db_password'] = 'mypass';
@@ -36,14 +35,14 @@ module Gitlab
36
35
  sidekiq['concurrency'] = 2;
37
36
  puma['worker_processes'] = 2;
38
37
  OMNIBUS
39
- primary.exec_commands = fast_ssh_key_lookup_commands + git_lfs_install_commands
38
+ primary.exec_commands = fast_ssh_key_lookup_commands + QA::Scenario::CLICommands.git_lfs_install_commands
40
39
 
41
40
  primary.instance do
42
41
  Component::Gitlab.perform do |secondary|
43
42
  secondary.release = release
44
43
  secondary.name = 'gitlab-secondary'
45
44
  secondary.network = 'geo'
46
- secondary.omnibus_config = <<~OMNIBUS
45
+ secondary.omnibus_configuration << <<~OMNIBUS
47
46
  geo_secondary['db_fdw'] = true;
48
47
  geo_secondary_role['enable'] = true;
49
48
  gitlab_rails['db_key_base'] = '4dd58204865eb41bca93bd38131d51cc';
@@ -58,7 +57,7 @@ module Gitlab
58
57
  sidekiq['concurrency'] = 2;
59
58
  puma['worker_processes'] = 2;
60
59
  OMNIBUS
61
- secondary.exec_commands = fast_ssh_key_lookup_commands + git_lfs_install_commands
60
+ secondary.exec_commands = fast_ssh_key_lookup_commands + QA::Scenario::CLICommands.git_lfs_install_commands
62
61
 
63
62
  secondary.act do
64
63
  # TODO, we do not wait for secondary to start because of
@@ -39,7 +39,7 @@ module Gitlab
39
39
  praefect.network = @network
40
40
  praefect.skip_availability_check = true
41
41
 
42
- praefect.omnibus_config = praefect_omnibus_configuration
42
+ praefect.omnibus_configuration << praefect_omnibus_configuration
43
43
 
44
44
  praefect.instance(skip_teardown: true)
45
45
  end
@@ -49,7 +49,7 @@ module Gitlab
49
49
  gitlab.name = gitlab_name
50
50
  gitlab.network = @network
51
51
 
52
- gitlab.omnibus_config = gitlab_omnibus_configuration
52
+ gitlab.omnibus_configuration << gitlab_omnibus_configuration
53
53
  gitlab.instance do
54
54
  puts "Running Gitaly Cluster specs!"
55
55
 
@@ -131,8 +131,7 @@ module Gitlab
131
131
 
132
132
  def gitaly_omnibus_configuration
133
133
  <<~OMNIBUS
134
- #{disable_other_services}
135
- prometheus['enable'] = true;
134
+ #{disable_other_services.sub(/(prometheus\['enable'\]) = false/, '\1 = true')}
136
135
  prometheus_monitoring['enable'] = false;
137
136
  gitaly['enable'] = true;
138
137
  gitaly['listen_addr'] = '0.0.0.0:8075';
@@ -197,7 +196,7 @@ module Gitlab
197
196
  gitaly.name = name
198
197
  gitaly.network = @network
199
198
  gitaly.skip_availability_check = true
200
- gitaly.omnibus_config = gitaly_omnibus_configuration
199
+ gitaly.omnibus_configuration << gitaly_omnibus_configuration
201
200
  gitaly.instance(skip_teardown: true)
202
201
  end
203
202
  end
@@ -17,7 +17,7 @@ module Gitlab
17
17
  end
18
18
 
19
19
  def configure(gitlab, saml)
20
- gitlab.omnibus_config = <<~OMNIBUS
20
+ gitlab.omnibus_configuration << <<~OMNIBUS
21
21
  gitlab_rails['omniauth_enabled'] = true;
22
22
  gitlab_rails['omniauth_providers'] = [{ name: 'group_saml' }];
23
23
  OMNIBUS
@@ -17,7 +17,7 @@ module Gitlab
17
17
  saml.set_assertion_consumer_service("#{gitlab.address}/users/auth/saml/callback")
18
18
  saml.set_simple_saml_hostname
19
19
 
20
- gitlab.omnibus_config = <<~OMNIBUS
20
+ gitlab.omnibus_configuration << <<~OMNIBUS
21
21
  gitlab_rails['omniauth_enabled'] = true;
22
22
  gitlab_rails['omniauth_allow_single_sign_on'] = ['saml'];
23
23
  gitlab_rails['omniauth_block_auto_created_users'] = false;
@@ -21,7 +21,7 @@ module Gitlab
21
21
  tunnel_registry.gitlab_hostname = gitlab.hostname
22
22
  tunnel_registry.network = 'test'
23
23
 
24
- gitlab.omnibus_config = <<~OMNIBUS
24
+ gitlab.omnibus_configuration << <<~OMNIBUS
25
25
  external_url '#{tunnel_gitlab.url}';
26
26
  nginx['listen_port'] = 80;
27
27
  nginx['listen_https'] = false;
@@ -27,7 +27,7 @@ module Gitlab
27
27
  end
28
28
 
29
29
  def ldap_servers_omnibus_config
30
- config = YAML.safe_load <<~CFG
30
+ YAML.safe_load <<~CFG
31
31
  main:
32
32
  label: LDAP
33
33
  host: #{ldap_hostname}
@@ -44,9 +44,6 @@ module Gitlab
44
44
  external_groups: ''
45
45
  sync_ssh_keys: false
46
46
  CFG
47
-
48
- # Quotes get eaten up when the string is set in the environment
49
- config.to_s.gsub("\"", "\\\"")
50
47
  end
51
48
 
52
49
  def ldap_hostname
@@ -12,7 +12,7 @@ module Gitlab
12
12
  end
13
13
 
14
14
  def configure_omnibus(gitlab)
15
- gitlab.omnibus_config = <<~OMNIBUS
15
+ gitlab.omnibus_configuration << <<~OMNIBUS
16
16
  gitlab_rails['ldap_enabled'] = true;
17
17
  gitlab_rails['ldap_servers'] = #{ldap_servers_omnibus_config};
18
18
  gitlab_rails['ldap_sync_worker_cron'] = '* * * * *';
@@ -15,7 +15,7 @@ module Gitlab
15
15
  end
16
16
 
17
17
  def configure_omnibus(gitlab)
18
- gitlab.omnibus_config = <<~OMNIBUS
18
+ gitlab.omnibus_configuration << <<~OMNIBUS
19
19
  gitlab_rails['ldap_enabled'] = true;
20
20
  gitlab_rails['ldap_servers'] = #{ldap_servers_omnibus_config};
21
21
  gitlab_rails['ldap_sync_worker_cron'] = '* * * * *';
@@ -15,8 +15,7 @@ module Gitlab
15
15
  end
16
16
 
17
17
  def configure_omnibus(gitlab)
18
- gitlab.set_accept_insecure_certs
19
- gitlab.omnibus_config = <<~OMNIBUS
18
+ gitlab.omnibus_configuration << <<~OMNIBUS
20
19
  gitlab_rails['ldap_enabled'] = true;
21
20
  gitlab_rails['ldap_servers'] = #{ldap_servers_omnibus_config};
22
21
  letsencrypt['enable'] = false;
@@ -13,7 +13,7 @@ module Gitlab
13
13
  mattermost_external_url = "http://#{mattermost_hostname}"
14
14
 
15
15
  gitlab.add_network_alias(mattermost_hostname)
16
- gitlab.omnibus_config = <<~OMNIBUS
16
+ gitlab.omnibus_configuration << <<~OMNIBUS
17
17
  mattermost_external_url '#{mattermost_external_url}';
18
18
  OMNIBUS
19
19
 
@@ -21,9 +21,8 @@ module Gitlab
21
21
  gitaly.network = @network
22
22
  gitaly.skip_availability_check = true
23
23
 
24
- gitaly.set_accept_insecure_certs
25
- gitaly.omnibus_config = gitaly_omnibus
26
- gitaly.mtls
24
+ gitaly.omnibus_configuration << gitaly_omnibus
25
+ gitaly.gitaly_tls
27
26
 
28
27
  gitaly.instance do
29
28
  Component::Gitlab.perform do |gitlab|
@@ -31,10 +30,8 @@ module Gitlab
31
30
  gitlab.name = @gitlab_name
32
31
  gitlab.network = @network
33
32
 
34
- gitlab.set_accept_insecure_certs
35
- gitlab.omnibus_config = gitlab_omnibus
33
+ gitlab.omnibus_configuration << gitlab_omnibus
36
34
  gitlab.tls = true
37
- gitlab.set_trusted_certificates
38
35
 
39
36
  gitlab.instance do
40
37
  puts "Running mTLS specs!"
@@ -50,7 +47,6 @@ module Gitlab
50
47
  specs.network = gitlab.network
51
48
  specs.args = [gitlab.address, *rspec_args]
52
49
  specs.env = @env
53
- specs.mtls
54
50
  end
55
51
  end
56
52
  end
@@ -14,7 +14,7 @@ module Gitlab
14
14
  attr_reader :gitlab_name, :spec_suite
15
15
 
16
16
  def configure_omnibus(gitlab, mail_hog)
17
- gitlab.omnibus_config = <<~OMNIBUS
17
+ gitlab.omnibus_configuration << <<~OMNIBUS
18
18
  gitlab_rails['smtp_enable'] = true;
19
19
  gitlab_rails['smtp_address'] = '#{mail_hog.hostname}';
20
20
  gitlab_rails['smtp_port'] = 1025;