gitlab-qa 7.32.0 → 7.35.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (86) hide show
  1. checksums.yaml +4 -4
  2. data/.gitlab/ci/jobs/base.gitlab-ci.yml +0 -1
  3. data/.gitlab/ci/jobs/registry_with_cdn.gitlab-ci.yml +12 -0
  4. data/.rubocop_todo.yml +0 -7
  5. data/Dangerfile +2 -0
  6. data/Gemfile +2 -0
  7. data/Gemfile.lock +1 -1
  8. data/Rakefile +2 -0
  9. data/docs/what_tests_can_be_run.md +2 -1
  10. data/exe/gitlab-qa +1 -0
  11. data/exe/gitlab-qa-report +1 -0
  12. data/lib/gitlab/qa/component/base.rb +3 -1
  13. data/lib/gitlab/qa/component/elasticsearch.rb +3 -1
  14. data/lib/gitlab/qa/component/gitlab.rb +42 -24
  15. data/lib/gitlab/qa/component/internet_tunnel.rb +4 -2
  16. data/lib/gitlab/qa/component/jira.rb +4 -2
  17. data/lib/gitlab/qa/component/mail_hog.rb +3 -2
  18. data/lib/gitlab/qa/component/minio.rb +7 -5
  19. data/lib/gitlab/qa/component/postgresql.rb +4 -2
  20. data/lib/gitlab/qa/component/preprod.rb +3 -1
  21. data/lib/gitlab/qa/component/production.rb +3 -1
  22. data/lib/gitlab/qa/component/release.rb +3 -1
  23. data/lib/gitlab/qa/component/saml.rb +4 -2
  24. data/lib/gitlab/qa/component/specs.rb +2 -0
  25. data/lib/gitlab/qa/component/staging.rb +4 -2
  26. data/lib/gitlab/qa/component/staging_ref.rb +4 -2
  27. data/lib/gitlab/qa/docker/command.rb +7 -1
  28. data/lib/gitlab/qa/docker/engine.rb +10 -0
  29. data/lib/gitlab/qa/docker/shellout.rb +24 -14
  30. data/lib/gitlab/qa/docker/volumes.rb +3 -1
  31. data/lib/gitlab/qa/release.rb +6 -4
  32. data/lib/gitlab/qa/report/prepare_stage_reports.rb +2 -0
  33. data/lib/gitlab/qa/report/summary_table.rb +2 -0
  34. data/lib/gitlab/qa/report/update_screenshot_path.rb +2 -0
  35. data/lib/gitlab/qa/reporter.rb +2 -0
  36. data/lib/gitlab/qa/runtime/env.rb +9 -4
  37. data/lib/gitlab/qa/runtime/logger.rb +1 -1
  38. data/lib/gitlab/qa/scenario/actable.rb +2 -0
  39. data/lib/gitlab/qa/scenario/cli_commands.rb +3 -1
  40. data/lib/gitlab/qa/scenario/template.rb +2 -0
  41. data/lib/gitlab/qa/scenario/test/instance/airgapped.rb +2 -0
  42. data/lib/gitlab/qa/scenario/test/instance/any.rb +2 -0
  43. data/lib/gitlab/qa/scenario/test/instance/deployment_base.rb +2 -0
  44. data/lib/gitlab/qa/scenario/test/instance/geo.rb +2 -0
  45. data/lib/gitlab/qa/scenario/test/instance/image.rb +2 -0
  46. data/lib/gitlab/qa/scenario/test/instance/preprod.rb +2 -0
  47. data/lib/gitlab/qa/scenario/test/instance/production.rb +2 -0
  48. data/lib/gitlab/qa/scenario/test/instance/relative_url.rb +2 -0
  49. data/lib/gitlab/qa/scenario/test/instance/release.rb +2 -0
  50. data/lib/gitlab/qa/scenario/test/instance/repository_storage.rb +2 -0
  51. data/lib/gitlab/qa/scenario/test/instance/smoke.rb +2 -0
  52. data/lib/gitlab/qa/scenario/test/instance/staging.rb +2 -0
  53. data/lib/gitlab/qa/scenario/test/instance/staging_geo.rb +2 -0
  54. data/lib/gitlab/qa/scenario/test/instance/staging_ref.rb +2 -0
  55. data/lib/gitlab/qa/scenario/test/instance/staging_ref_geo.rb +2 -0
  56. data/lib/gitlab/qa/scenario/test/integration/client_ssl.rb +2 -0
  57. data/lib/gitlab/qa/scenario/test/integration/elasticsearch.rb +2 -0
  58. data/lib/gitlab/qa/scenario/test/integration/geo.rb +2 -0
  59. data/lib/gitlab/qa/scenario/test/integration/gitaly_cluster.rb +51 -27
  60. data/lib/gitlab/qa/scenario/test/integration/group_saml.rb +2 -0
  61. data/lib/gitlab/qa/scenario/test/integration/instance_saml.rb +2 -0
  62. data/lib/gitlab/qa/scenario/test/integration/jira.rb +2 -0
  63. data/lib/gitlab/qa/scenario/test/integration/kubernetes.rb +2 -0
  64. data/lib/gitlab/qa/scenario/test/integration/ldap.rb +8 -6
  65. data/lib/gitlab/qa/scenario/test/integration/ldap_no_server.rb +2 -0
  66. data/lib/gitlab/qa/scenario/test/integration/ldap_no_tls.rb +2 -0
  67. data/lib/gitlab/qa/scenario/test/integration/ldap_tls.rb +2 -0
  68. data/lib/gitlab/qa/scenario/test/integration/mattermost.rb +2 -0
  69. data/lib/gitlab/qa/scenario/test/integration/mtls.rb +2 -0
  70. data/lib/gitlab/qa/scenario/test/integration/praefect.rb +2 -0
  71. data/lib/gitlab/qa/scenario/test/integration/saml.rb +2 -0
  72. data/lib/gitlab/qa/scenario/test/integration/smtp.rb +2 -0
  73. data/lib/gitlab/qa/scenario/test/omnibus/image.rb +2 -0
  74. data/lib/gitlab/qa/scenario/test/omnibus/update.rb +2 -0
  75. data/lib/gitlab/qa/scenario/test/omnibus/upgrade.rb +2 -0
  76. data/lib/gitlab/qa/scenario/test/sanity/version.rb +2 -0
  77. data/lib/gitlab/qa/slack/post_to_slack.rb +2 -0
  78. data/lib/gitlab/qa/support/dev_ee_qa_image.rb +3 -1
  79. data/lib/gitlab/qa/support/get_request.rb +2 -0
  80. data/lib/gitlab/qa/support/http_request.rb +2 -0
  81. data/lib/gitlab/qa/support/invalid_response_error.rb +2 -0
  82. data/lib/gitlab/qa/version.rb +1 -1
  83. data/lib/gitlab/qa.rb +4 -0
  84. data/scripts/generate-qa-jobs.rb +1 -0
  85. data/support/data/license_usage_seed.rb +2 -1
  86. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7af4e17998896415aa9c217a012124b8fa4ce8727d781a3ef47ea2801c9c6632
4
- data.tar.gz: '0162299be6ab6e7f40d83a7f0c8a1d4d76879e7cf8d7181e3e8f027285fba8a0'
3
+ metadata.gz: 68c6a21ac204323088f26d992fcff4a19a0a75af7f261a2d4b078a88aa0c5b92
4
+ data.tar.gz: 7f652f956d82d0523d9415d010330852846a6dd764e70b5156922cabc93cffe5
5
5
  SHA512:
6
- metadata.gz: 82aeb884f959762a0de031bf0f44d050b32a576cb92adff50b9af7902ed481dab0ce0ad295338238fb61108e58be1a85b10b27f59209bb36e8655cde13d5f460
7
- data.tar.gz: 1964ac96d147d43a008ee2619d49a53b661851c1c4cb09b74701b52bf680c4f376c52aa1a68f62a08d51080199385e34cb322e4036d9d7daa7d166bf447ca620
6
+ metadata.gz: f59a52bfc23267353912547e351fc05a557f376326231ed98fa02f7799687276aab15ae99e773236673be64cb7a941bf6f73f0456bcea8cce25a667923291bb3
7
+ data.tar.gz: fa0037200819c8ed810551fcabf9566a1776e217773ca4e1410f1b9577dd80b6ebd98f578c6d29786b21883aec8dca73717d8b42bb9e77a5aa4ee73ed6a3409d
@@ -71,7 +71,6 @@ variables:
71
71
  DOCKER_DRIVER: overlay2
72
72
  DOCKER_HOST: tcp://docker:2375
73
73
  COLORIZED_LOGS: "true"
74
- QA_DEBUG: "false"
75
74
  QA_CAN_TEST_GIT_PROTOCOL_V2: "true"
76
75
  QA_CAN_TEST_PRAEFECT: "false"
77
76
  QA_GENERATE_ALLURE_REPORT: "true"
@@ -1,4 +1,7 @@
1
1
  ce:registry_with_cdn:
2
+ before_script:
3
+ - unset GITLAB_QA_ADMIN_ACCESS_TOKEN
4
+ - !reference [default, before_script]
2
5
  extends:
3
6
  - .rules:ce-never-when-triggered-by-feature-flag-definition-change
4
7
  - .test
@@ -10,6 +13,9 @@ ce:registry_with_cdn:
10
13
  allow_failure: true
11
14
 
12
15
  ce:registry_with_cdn-quarantine:
16
+ before_script:
17
+ - unset GITLAB_QA_ADMIN_ACCESS_TOKEN
18
+ - !reference [default, before_script]
13
19
  extends:
14
20
  - .rules:ce-never-when-triggered-by-feature-flag-definition-change
15
21
  - .test
@@ -21,6 +27,9 @@ ce:registry_with_cdn-quarantine:
21
27
  QA_SCENARIO: "Test::Integration::RegistryWithCDN"
22
28
 
23
29
  ee:registry_with_cdn:
30
+ before_script:
31
+ - unset GITLAB_QA_ADMIN_ACCESS_TOKEN
32
+ - !reference [default, before_script]
24
33
  extends:
25
34
  - .rules:ee-never-when-triggered-by-feature-flag-definition-change
26
35
  - .test
@@ -32,6 +41,9 @@ ee:registry_with_cdn:
32
41
  allow_failure: true
33
42
 
34
43
  ee:registry_with_cdn-quarantine:
44
+ before_script:
45
+ - unset GITLAB_QA_ADMIN_ACCESS_TOKEN
46
+ - !reference [default, before_script]
35
47
  extends:
36
48
  - .rules:ee-never-when-triggered-by-feature-flag-definition-change
37
49
  - .test
data/.rubocop_todo.yml CHANGED
@@ -95,13 +95,6 @@ Style/ExplicitBlockArgument:
95
95
  Exclude:
96
96
  - 'lib/gitlab/qa/scenario/test/integration/ldap.rb'
97
97
 
98
- # Offense count: 86
99
- # Cop supports --auto-correct.
100
- # Configuration parameters: EnforcedStyle.
101
- # SupportedStyles: always, always_true, never
102
- Style/FrozenStringLiteralComment:
103
- Enabled: false
104
-
105
98
  # Offense count: 1
106
99
  # Cop supports --auto-correct.
107
100
  Style/HashTransformKeys:
data/Dangerfile CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'gitlab-dangerfiles'
2
4
 
3
5
  Gitlab::Dangerfiles.for_project(self) do |dangerfiles|
data/Gemfile CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  source 'https://rubygems.org'
2
4
 
3
5
  gemspec
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- gitlab-qa (7.32.0)
4
+ gitlab-qa (7.35.0)
5
5
  activesupport (~> 6.1)
6
6
  gitlab (~> 4.18.0)
7
7
  http (~> 5.0)
data/Rakefile CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'bundler/gem_tasks'
2
4
  require 'rspec/core/rake_task'
3
5
  require 'rubocop/rake_task'
@@ -68,7 +68,8 @@ All environment variables used by GitLab QA should be defined in [`lib/gitlab/qa
68
68
  | `QA_PRAEFECT_REPOSITORY_STORAGE` |- | The name of repository storage using Praefect. Note: Admin access is required to change repository storage. | No|
69
69
  | `QA_COOKIES` |- | Optionally set to "cookie1=value;cookie2=value" in order to add a cookie to every request. This can be used to set the canary cookie by setting it to "gitlab_canary=true". | No|
70
70
  | `QA_DEBUG` |- | Set to `true` to verbosely log page object actions. Note: if enabled be aware that sensitive data might be logged. If an input element has a QA selector with `password` in the name, data entered into the input element will be masked. If the element doesn't have `password` in its name it won't be masked. | No|
71
- | `QA_LOG_PATH` |- | Path to output debug logging to. By default `QA_ARTIFACTS_DIR` is used | No|
71
+ | `QA_LOG_LEVEL` | `info` | Logging level to use for gitlab-qa output and qa tests output | No|
72
+ | `QA_LOG_PATH` | `QA_ARTIFACTS_DIR` | Path to output debug logging to. | No|
72
73
  | `QA_CAN_TEST_GIT_PROTOCOL_V2` | `true` | Set to `false` to skip tests that require Git protocol v2 if your environment doesn't support it. | No|
73
74
  | `QA_CAN_TEST_ADMIN_FEATURES` | `true` | Set to `false` to skip tests that require admin access. | No|
74
75
  | `QA_CAN_TEST_PRAEFECT` | `true` | Set to `false` to skip tests that require Praefect to be running. | No|
data/exe/gitlab-qa CHANGED
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
2
3
 
3
4
  lib = File.expand_path('../lib', __dir__)
4
5
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
data/exe/gitlab-qa-report CHANGED
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
2
3
 
3
4
  lib = File.expand_path('../lib', __dir__)
4
5
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
@@ -155,7 +155,9 @@ module Gitlab
155
155
  rescue Docker::Shellout::StatusError => e
156
156
  # for scenarios where a service fails during startup, attempt to retry to avoid flaky failures
157
157
  if (retries += 1) < 3
158
- puts "Retry instance_no_teardown due to Docker::Shellout::StatusError -- attempt #{retries}"
158
+ Runtime::Logger.warn(
159
+ "Retry instance_no_teardown due to Docker::Shellout::StatusError -- attempt #{retries}"
160
+ )
159
161
  teardown!
160
162
  retry
161
163
  end
@@ -1,8 +1,10 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Gitlab
2
4
  module QA
3
5
  module Component
4
6
  class Elasticsearch < Base
5
- DOCKER_IMAGE = 'docker.elastic.co/elasticsearch/elasticsearch'.freeze
7
+ DOCKER_IMAGE = 'docker.elastic.co/elasticsearch/elasticsearch'
6
8
 
7
9
  def name
8
10
  @name ||= "elastic68"
@@ -13,6 +13,7 @@ module Gitlab
13
13
  module Component
14
14
  class Gitlab < Base
15
15
  extend Forwardable
16
+ using Rainbow
16
17
 
17
18
  attr_reader :release, :omnibus_configuration, :omnibus_gitlab_rails_env
18
19
  attr_accessor :tls, :skip_availability_check, :runner_network, :seed_admin_token, :seed_db
@@ -121,8 +122,9 @@ module Gitlab
121
122
  def prepare_gitlab_omnibus_config
122
123
  set_formless_login_token
123
124
  set_license_mode
125
+ return if omnibus_gitlab_rails_env.empty?
124
126
 
125
- @omnibus_configuration << "gitlab_rails['env'] = #{@omnibus_gitlab_rails_env}" unless omnibus_gitlab_rails_env.empty?
127
+ @omnibus_configuration << "gitlab_rails['env'] = #{@omnibus_gitlab_rails_env}"
126
128
  end
127
129
 
128
130
  def start # rubocop:disable Metrics/AbcSize
@@ -148,7 +150,12 @@ module Gitlab
148
150
  command << "--network-alias #{network_alias}"
149
151
  end
150
152
  end
151
- Docker::Command.execute("network connect --alias #{name}.#{network} --alias #{name}.#{runner_network} #{runner_network} #{name}") if runner_network
153
+
154
+ return unless runner_network
155
+
156
+ Docker::Command.execute(
157
+ "network connect --alias #{name}.#{network} --alias #{name}.#{runner_network} #{runner_network} #{name}"
158
+ )
152
159
  end
153
160
 
154
161
  def reconfigure
@@ -163,10 +170,19 @@ module Gitlab
163
170
  def wait_until_ready
164
171
  return if skip_availability_check
165
172
 
166
- if Availability.new(name, relative_path: relative_path, scheme: scheme, protocol_port: port.to_i).check(Runtime::Env.gitlab_availability_timeout)
167
- puts ' -> GitLab is available.'
173
+ availability = Availability.new(
174
+ name,
175
+ relative_path: relative_path,
176
+ scheme: scheme,
177
+ protocol_port: port.to_i
178
+ )
179
+
180
+ Runtime::Logger.info("Waiting for GitLab to become healthy ...")
181
+
182
+ if availability.check(Runtime::Env.gitlab_availability_timeout)
183
+ Runtime::Logger.info("-> GitLab is available at `#{availability.uri}`!".bright)
168
184
  else
169
- abort ' -> GitLab unavailable!'
185
+ abort '-> GitLab unavailable!'.red
170
186
  end
171
187
  end
172
188
 
@@ -260,7 +276,10 @@ module Gitlab
260
276
  [
261
277
  @docker.exec(name, 'mkdir -p /opt/gitlab/embedded/service/gitlab-shell/hooks/pre-receive.d'),
262
278
  @docker.write_files(name) do |f|
263
- f.write('/opt/gitlab/embedded/service/gitlab-shell/hooks/pre-receive.d/pre-receive.d', global_server_prereceive_hook, false)
279
+ f.write(
280
+ '/opt/gitlab/embedded/service/gitlab-shell/hooks/pre-receive.d/pre-receive.d',
281
+ global_server_prereceive_hook, false
282
+ )
264
283
  end,
265
284
  @docker.exec(name, 'chmod +x /opt/gitlab/embedded/service/gitlab-shell/hooks/pre-receive.d/*')
266
285
  ]
@@ -270,42 +289,41 @@ module Gitlab
270
289
  def initialize(name, relative_path: '', scheme: 'http', protocol_port: 80)
271
290
  @docker = Docker::Engine.new
272
291
 
273
- host = @docker.hostname
274
- port = @docker.port(name, protocol_port).split(':').last
275
-
276
- @uri = URI.join("#{scheme}://#{host}:#{port}", "#{relative_path}/", 'help')
292
+ @name = name
293
+ @scheme = scheme
294
+ @relative_path = relative_path
295
+ @protocol_port = protocol_port
277
296
  end
278
297
 
279
298
  def check(retries)
280
- print "Waiting for GitLab at `#{@uri}` to become available "
281
-
282
299
  retries.times do
283
300
  return true if service_available?
284
301
 
285
- print '.'
286
302
  sleep 1
287
303
  end
288
304
 
289
305
  false
290
306
  end
291
307
 
308
+ def uri
309
+ @uri ||= begin
310
+ port = docker.port(name, protocol_port).split(':').last
311
+
312
+ URI.join("#{scheme}://#{docker.hostname}:#{port}", relative_path)
313
+ end
314
+ end
315
+
292
316
  private
293
317
 
318
+ attr_reader :docker, :name, :relative_path, :scheme, :protocol_port
319
+
294
320
  def service_available?
295
- response = Net::HTTP.start(@uri.host, @uri.port, opts) do |http|
296
- http.head2(@uri.request_uri)
297
- end
321
+ output = docker.inspect(name) { |command| command << "--format='{{json .State.Health.Status}}'" }
298
322
 
299
- print response.code
300
- response.code.to_i == 200
301
- rescue Errno::ECONNREFUSED, Errno::ECONNRESET, EOFError => e
302
- print e.message
323
+ output == '"healthy"'
324
+ rescue Docker::Shellout::StatusError
303
325
  false
304
326
  end
305
-
306
- def opts
307
- @uri.scheme == 'https' ? { use_ssl: true, verify_mode: OpenSSL::SSL::VERIFY_NONE } : {}
308
- end
309
327
  end
310
328
  end
311
329
  end
@@ -1,11 +1,13 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'tempfile'
2
4
 
3
5
  module Gitlab
4
6
  module QA
5
7
  module Component
6
8
  class InternetTunnel < Base
7
- DOCKER_IMAGE = 'gitlab/ssh-tunnel'.freeze
8
- DOCKER_IMAGE_TAG = '1.0.0'.freeze
9
+ DOCKER_IMAGE = 'gitlab/ssh-tunnel'
10
+ DOCKER_IMAGE_TAG = '1.0.0'
9
11
 
10
12
  attr_writer :gitlab_hostname
11
13
 
@@ -1,9 +1,11 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Gitlab
2
4
  module QA
3
5
  module Component
4
6
  class Jira < Base
5
- DOCKER_IMAGE = 'registry.gitlab.com/gitlab-org/gitlab-qa/jira-gitlab'.freeze
6
- DOCKER_IMAGE_TAG = '8.8-project-and-issue'.freeze
7
+ DOCKER_IMAGE = 'registry.gitlab.com/gitlab-org/gitlab-qa/jira-gitlab'
8
+ DOCKER_IMAGE_TAG = '8.8-project-and-issue'
7
9
 
8
10
  def name
9
11
  @name ||= "jira"
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  # This component sets up the MailHog (https://github.com/mailhog/MailHog)
2
3
  # image with the proper configuration for SMTP email delivery from Gitlab
3
4
 
@@ -5,8 +6,8 @@ module Gitlab
5
6
  module QA
6
7
  module Component
7
8
  class MailHog < Base
8
- DOCKER_IMAGE = 'mailhog/mailhog'.freeze
9
- DOCKER_IMAGE_TAG = 'v1.0.0'.freeze
9
+ DOCKER_IMAGE = 'mailhog/mailhog'
10
+ DOCKER_IMAGE_TAG = 'v1.0.0'
10
11
 
11
12
  def name
12
13
  @name ||= "mailhog"
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'securerandom'
2
4
  require 'fileutils'
3
5
  require 'yaml'
@@ -8,12 +10,12 @@ module Gitlab
8
10
  module QA
9
11
  module Component
10
12
  class Minio < Base
11
- DOCKER_IMAGE = 'minio/minio'.freeze
12
- DOCKER_IMAGE_TAG = 'latest'.freeze
13
+ DOCKER_IMAGE = 'minio/minio'
14
+ DOCKER_IMAGE_TAG = 'latest'
13
15
  # These are secrets used in a local Minio container, they're not used for any online S3 server.
14
- AWS_ACCESS_KEY = 'AKIAIOSFODNN7EXAMPLE'.freeze
15
- AWS_SECRET_KEY = 'wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY'.freeze
16
- DATA_DIR = '/data'.freeze
16
+ AWS_ACCESS_KEY = 'AKIAIOSFODNN7EXAMPLE'
17
+ AWS_SECRET_KEY = 'wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY'
18
+ DATA_DIR = '/data'
17
19
  DEFAULT_PORT = 9000
18
20
 
19
21
  def initialize
@@ -1,9 +1,11 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Gitlab
2
4
  module QA
3
5
  module Component
4
6
  class PostgreSQL < Base
5
- DOCKER_IMAGE = 'postgres'.freeze
6
- DOCKER_IMAGE_TAG = '11'.freeze
7
+ DOCKER_IMAGE = 'postgres'
8
+ DOCKER_IMAGE_TAG = '11'
7
9
 
8
10
  def name
9
11
  @name ||= "postgres"
@@ -1,8 +1,10 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Gitlab
2
4
  module QA
3
5
  module Component
4
6
  class Preprod < Staging
5
- ADDRESS = 'https://pre.gitlab.com'.freeze
7
+ ADDRESS = 'https://pre.gitlab.com'
6
8
  end
7
9
  end
8
10
  end
@@ -1,8 +1,10 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Gitlab
2
4
  module QA
3
5
  module Component
4
6
  class Production < Staging
5
- ADDRESS = 'https://gitlab.com'.freeze
7
+ ADDRESS = 'https://gitlab.com'
6
8
  end
7
9
  end
8
10
  end
@@ -1,8 +1,10 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Gitlab
2
4
  module QA
3
5
  module Component
4
6
  class Release < Staging
5
- ADDRESS = 'https://release.gitlab.net'.freeze
7
+ ADDRESS = 'https://release.gitlab.net'
6
8
  end
7
9
  end
8
10
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'securerandom'
2
4
 
3
5
  # This component sets up the docker-test-saml-idp (https://github.com/kristophjunge/docker-test-saml-idp)
@@ -7,8 +9,8 @@ module Gitlab
7
9
  module QA
8
10
  module Component
9
11
  class SAML < Base
10
- DOCKER_IMAGE = 'jamedjo/test-saml-idp'.freeze
11
- DOCKER_IMAGE_TAG = 'latest'.freeze
12
+ DOCKER_IMAGE = 'jamedjo/test-saml-idp'
13
+ DOCKER_IMAGE_TAG = 'latest'
12
14
 
13
15
  def set_entity_id(entity_id)
14
16
  @environment['SIMPLESAMLPHP_SP_ENTITY_ID'] = entity_id
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'securerandom'
2
4
 
3
5
  module Gitlab
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'net/http'
2
4
  require 'json'
3
5
  require 'uri'
@@ -6,8 +8,8 @@ module Gitlab
6
8
  module QA
7
9
  module Component
8
10
  class Staging
9
- ADDRESS = 'https://staging.gitlab.com'.freeze
10
- GEO_SECONDARY_ADDRESS = 'https://geo.staging.gitlab.com'.freeze
11
+ ADDRESS = 'https://staging.gitlab.com'
12
+ GEO_SECONDARY_ADDRESS = 'https://geo.staging.gitlab.com'
11
13
 
12
14
  def self.release
13
15
  QA::Release.new(image)
@@ -1,9 +1,11 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Gitlab
2
4
  module QA
3
5
  module Component
4
6
  class StagingRef < Staging
5
- ADDRESS = 'https://staging-ref.gitlab.com'.freeze
6
- GEO_SECONDARY_ADDRESS = 'https://geo.staging-ref.gitlab.com'.freeze
7
+ ADDRESS = 'https://staging-ref.gitlab.com'
8
+ GEO_SECONDARY_ADDRESS = 'https://geo.staging-ref.gitlab.com'
7
9
  end
8
10
  end
9
11
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Gitlab
2
4
  module QA
3
5
  module Docker
@@ -43,7 +45,7 @@ module Gitlab
43
45
  #
44
46
  # @return [String] The masked command string
45
47
  def mask_secrets
46
- @mask_secrets.each_with_object(to_s) { |secret, s| s.gsub!(secret, '*****') }
48
+ @mask_secrets.each_with_object(+to_s) { |secret, s| s.gsub!(secret, '*****') }
47
49
  end
48
50
 
49
51
  def ==(other)
@@ -52,6 +54,10 @@ module Gitlab
52
54
 
53
55
  def execute!(&block)
54
56
  Docker::Shellout.new(self).execute!(&block)
57
+ rescue Docker::Shellout::StatusError => e
58
+ e.set_backtrace([])
59
+
60
+ raise e
55
61
  end
56
62
 
57
63
  def self.execute(cmd, mask_secrets: nil, &block)
@@ -142,6 +142,16 @@ module Gitlab
142
142
  Docker::Command.execute(['ps', name].compact.join(' '))
143
143
  end
144
144
 
145
+ def inspect(name)
146
+ Docker::Command.new('inspect').then do |command|
147
+ yield command if block_given?
148
+
149
+ command << name
150
+
151
+ command.execute!
152
+ end
153
+ end
154
+
145
155
  private
146
156
 
147
157
  def full_image_name(image, tag)
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'open3'
4
- require 'rainbow/refinement'
4
+ require 'active_support/core_ext/string/filters'
5
5
 
6
6
  module Gitlab
7
7
  module QA
@@ -17,16 +17,16 @@ module Gitlab
17
17
  @logger = Runtime::Logger.logger
18
18
  end
19
19
 
20
- attr_reader :command, :logger
20
+ attr_reader :command, :output
21
21
 
22
22
  def execute! # rubocop:disable Metrics/AbcSize
23
- raise StatusError, 'Command already executed' if @output.any?
23
+ raise StatusError, 'Command already executed' if output.any?
24
24
 
25
- logger.info("Docker shell command: `#{@command.mask_secrets.cyan}`")
25
+ logger.info("Docker shell command: `#{command.mask_secrets.cyan}`")
26
26
 
27
27
  Open3.popen2e(@command.to_s) do |_in, out, wait|
28
28
  out.each do |line|
29
- @output.push(line)
29
+ output.push(line)
30
30
 
31
31
  if stream_progress
32
32
  print "."
@@ -36,21 +36,28 @@ module Gitlab
36
36
 
37
37
  yield line, wait if block_given?
38
38
  end
39
- puts if stream_progress
39
+ puts if stream_progress && !output.empty?
40
40
 
41
- if wait.value.exited? && wait.value.exitstatus.nonzero?
42
- logger.error("Docker shell command output:\n#{output}") unless command.stream_output
43
- raise StatusError, "Docker command `#{@command.mask_secrets[0..100]}` failed! ✘"
44
- end
41
+ fail! if wait.value.exited? && wait.value.exitstatus.nonzero?
45
42
 
46
- logger.debug("Docker shell command output:\n#{output}") unless command.stream_output || output.empty?
43
+ logger.debug("Docker shell command output:\n#{string_output}") unless command.stream_output || output.empty?
47
44
  end
48
45
 
49
- output
46
+ string_output
50
47
  end
51
48
 
52
49
  private
53
50
 
51
+ attr_reader :logger
52
+
53
+ # Raise error and print output to error log level
54
+ #
55
+ # @return [void]
56
+ def fail!
57
+ logger.error("Docker shell command output:\n#{string_output}") unless command.stream_output
58
+ raise StatusError, "Docker command `#{command.mask_secrets.truncate(100)}` failed! " + "✘".red
59
+ end
60
+
54
61
  # Stream only command execution progress and log output when command finished
55
62
  #
56
63
  # @return [Boolean]
@@ -58,8 +65,11 @@ module Gitlab
58
65
  !(Runtime::Env.ci || command.stream_output)
59
66
  end
60
67
 
61
- def output
62
- @output.join.chomp
68
+ # Stringified command output
69
+ #
70
+ # @return [String]
71
+ def string_output
72
+ output.join.chomp
63
73
  end
64
74
  end
65
75
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'tmpdir'
2
4
 
3
5
  module Gitlab
@@ -7,7 +9,7 @@ module Gitlab
7
9
  VOLUMES = { 'config' => '/etc/gitlab',
8
10
  'data' => '/var/opt/gitlab' }.freeze
9
11
 
10
- QA_CONTAINER_WORKDIR = '/home/gitlab/qa'.freeze
12
+ QA_CONTAINER_WORKDIR = '/home/gitlab/qa'
11
13
 
12
14
  def initialize(volumes = VOLUMES)
13
15
  @volumes = volumes
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Gitlab
2
4
  module QA
3
5
  class Release
@@ -49,10 +51,10 @@ module Gitlab
49
51
  \z
50
52
  /xi
51
53
 
52
- DEFAULT_TAG = 'latest'.freeze
53
- DEFAULT_CANONICAL_TAG = 'nightly'.freeze
54
- DEV_REGISTRY = 'dev.gitlab.org:5005'.freeze
55
- COM_REGISTRY = 'registry.gitlab.com'.freeze
54
+ DEFAULT_TAG = 'latest'
55
+ DEFAULT_CANONICAL_TAG = 'nightly'
56
+ DEV_REGISTRY = 'dev.gitlab.org:5005'
57
+ COM_REGISTRY = 'registry.gitlab.com'
56
58
 
57
59
  InvalidImageNameError = Class.new(RuntimeError)
58
60
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'nokogiri'
2
4
 
3
5
  module Gitlab
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'nokogiri'
2
4
  require 'table_print'
3
5
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'nokogiri'
2
4
  require 'json'
3
5
  require 'active_support/core_ext/object/blank'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'optparse'
2
4
 
3
5
  module Gitlab