gitlab-qa 7.34.0 → 7.35.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (83) hide show
  1. checksums.yaml +4 -4
  2. data/.gitlab/ci/jobs/registry_with_cdn.gitlab-ci.yml +12 -0
  3. data/.rubocop_todo.yml +0 -7
  4. data/Dangerfile +2 -0
  5. data/Gemfile +2 -0
  6. data/Gemfile.lock +1 -1
  7. data/Rakefile +2 -0
  8. data/exe/gitlab-qa +1 -0
  9. data/exe/gitlab-qa-report +1 -0
  10. data/lib/gitlab/qa/component/base.rb +3 -1
  11. data/lib/gitlab/qa/component/elasticsearch.rb +3 -1
  12. data/lib/gitlab/qa/component/gitlab.rb +42 -24
  13. data/lib/gitlab/qa/component/internet_tunnel.rb +4 -2
  14. data/lib/gitlab/qa/component/jira.rb +4 -2
  15. data/lib/gitlab/qa/component/mail_hog.rb +3 -2
  16. data/lib/gitlab/qa/component/minio.rb +7 -5
  17. data/lib/gitlab/qa/component/postgresql.rb +4 -2
  18. data/lib/gitlab/qa/component/preprod.rb +3 -1
  19. data/lib/gitlab/qa/component/production.rb +3 -1
  20. data/lib/gitlab/qa/component/release.rb +3 -1
  21. data/lib/gitlab/qa/component/saml.rb +4 -2
  22. data/lib/gitlab/qa/component/specs.rb +2 -0
  23. data/lib/gitlab/qa/component/staging.rb +4 -2
  24. data/lib/gitlab/qa/component/staging_ref.rb +4 -2
  25. data/lib/gitlab/qa/docker/command.rb +7 -1
  26. data/lib/gitlab/qa/docker/engine.rb +10 -0
  27. data/lib/gitlab/qa/docker/shellout.rb +24 -14
  28. data/lib/gitlab/qa/docker/volumes.rb +3 -1
  29. data/lib/gitlab/qa/release.rb +6 -4
  30. data/lib/gitlab/qa/report/prepare_stage_reports.rb +2 -0
  31. data/lib/gitlab/qa/report/summary_table.rb +2 -0
  32. data/lib/gitlab/qa/report/update_screenshot_path.rb +2 -0
  33. data/lib/gitlab/qa/reporter.rb +2 -0
  34. data/lib/gitlab/qa/runtime/env.rb +9 -4
  35. data/lib/gitlab/qa/scenario/actable.rb +2 -0
  36. data/lib/gitlab/qa/scenario/cli_commands.rb +3 -1
  37. data/lib/gitlab/qa/scenario/template.rb +2 -0
  38. data/lib/gitlab/qa/scenario/test/instance/airgapped.rb +2 -0
  39. data/lib/gitlab/qa/scenario/test/instance/any.rb +2 -0
  40. data/lib/gitlab/qa/scenario/test/instance/deployment_base.rb +2 -0
  41. data/lib/gitlab/qa/scenario/test/instance/geo.rb +2 -0
  42. data/lib/gitlab/qa/scenario/test/instance/image.rb +2 -0
  43. data/lib/gitlab/qa/scenario/test/instance/preprod.rb +2 -0
  44. data/lib/gitlab/qa/scenario/test/instance/production.rb +2 -0
  45. data/lib/gitlab/qa/scenario/test/instance/relative_url.rb +2 -0
  46. data/lib/gitlab/qa/scenario/test/instance/release.rb +2 -0
  47. data/lib/gitlab/qa/scenario/test/instance/repository_storage.rb +2 -0
  48. data/lib/gitlab/qa/scenario/test/instance/smoke.rb +2 -0
  49. data/lib/gitlab/qa/scenario/test/instance/staging.rb +2 -0
  50. data/lib/gitlab/qa/scenario/test/instance/staging_geo.rb +2 -0
  51. data/lib/gitlab/qa/scenario/test/instance/staging_ref.rb +2 -0
  52. data/lib/gitlab/qa/scenario/test/instance/staging_ref_geo.rb +2 -0
  53. data/lib/gitlab/qa/scenario/test/integration/client_ssl.rb +2 -0
  54. data/lib/gitlab/qa/scenario/test/integration/elasticsearch.rb +2 -0
  55. data/lib/gitlab/qa/scenario/test/integration/geo.rb +2 -0
  56. data/lib/gitlab/qa/scenario/test/integration/gitaly_cluster.rb +2 -0
  57. data/lib/gitlab/qa/scenario/test/integration/group_saml.rb +2 -0
  58. data/lib/gitlab/qa/scenario/test/integration/instance_saml.rb +2 -0
  59. data/lib/gitlab/qa/scenario/test/integration/jira.rb +2 -0
  60. data/lib/gitlab/qa/scenario/test/integration/kubernetes.rb +2 -0
  61. data/lib/gitlab/qa/scenario/test/integration/ldap.rb +8 -6
  62. data/lib/gitlab/qa/scenario/test/integration/ldap_no_server.rb +2 -0
  63. data/lib/gitlab/qa/scenario/test/integration/ldap_no_tls.rb +2 -0
  64. data/lib/gitlab/qa/scenario/test/integration/ldap_tls.rb +2 -0
  65. data/lib/gitlab/qa/scenario/test/integration/mattermost.rb +2 -0
  66. data/lib/gitlab/qa/scenario/test/integration/mtls.rb +2 -0
  67. data/lib/gitlab/qa/scenario/test/integration/praefect.rb +2 -0
  68. data/lib/gitlab/qa/scenario/test/integration/saml.rb +2 -0
  69. data/lib/gitlab/qa/scenario/test/integration/smtp.rb +2 -0
  70. data/lib/gitlab/qa/scenario/test/omnibus/image.rb +2 -0
  71. data/lib/gitlab/qa/scenario/test/omnibus/update.rb +2 -0
  72. data/lib/gitlab/qa/scenario/test/omnibus/upgrade.rb +2 -0
  73. data/lib/gitlab/qa/scenario/test/sanity/version.rb +2 -0
  74. data/lib/gitlab/qa/slack/post_to_slack.rb +2 -0
  75. data/lib/gitlab/qa/support/dev_ee_qa_image.rb +3 -1
  76. data/lib/gitlab/qa/support/get_request.rb +2 -0
  77. data/lib/gitlab/qa/support/http_request.rb +2 -0
  78. data/lib/gitlab/qa/support/invalid_response_error.rb +2 -0
  79. data/lib/gitlab/qa/version.rb +1 -1
  80. data/lib/gitlab/qa.rb +4 -0
  81. data/scripts/generate-qa-jobs.rb +1 -0
  82. data/support/data/license_usage_seed.rb +2 -1
  83. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 917c47b2fbead3c77db3cd6c441995a8324ed73735262542dcd94de854022a35
4
- data.tar.gz: 7785db11c9eb0f1f7ff2ecf32b16b8fd95ad9bab9391711f2d0af05a7e903153
3
+ metadata.gz: 68c6a21ac204323088f26d992fcff4a19a0a75af7f261a2d4b078a88aa0c5b92
4
+ data.tar.gz: 7f652f956d82d0523d9415d010330852846a6dd764e70b5156922cabc93cffe5
5
5
  SHA512:
6
- metadata.gz: c509e252f4bd1e7d405d517920e306e2cdf5233cd73a5fbf25a878cbb863a7c21e5fedb007c8ef461f7e34e1899b27ff989d92182c427575a125f4c99a39de9d
7
- data.tar.gz: 9011ddab65c7c0218ed49a5cbd2cdaa26f2b2ce013eb005d9ba63ee067ce18306bf8475861156ca52d7e2272cc9c94588ac86016e90e7901ecdac94d4e2f6cbf
6
+ metadata.gz: f59a52bfc23267353912547e351fc05a557f376326231ed98fa02f7799687276aab15ae99e773236673be64cb7a941bf6f73f0456bcea8cce25a667923291bb3
7
+ data.tar.gz: fa0037200819c8ed810551fcabf9566a1776e217773ca4e1410f1b9577dd80b6ebd98f578c6d29786b21883aec8dca73717d8b42bb9e77a5aa4ee73ed6a3409d
@@ -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.34.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'
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
@@ -1,6 +1,7 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'active_support/core_ext/object/blank'
2
4
  require 'securerandom'
3
- require 'rainbow/refinement'
4
5
 
5
6
  module Gitlab
6
7
  module QA
@@ -142,7 +143,9 @@ module Gitlab
142
143
  attr_writer(method_name)
143
144
 
144
145
  define_method(method_name) do
145
- env_var_value_if_defined(env_name) || (instance_variable_get("@#{method_name}") if instance_variable_defined?("@#{method_name}"))
146
+ env_var_value_if_defined(env_name) || (if instance_variable_defined?("@#{method_name}")
147
+ instance_variable_get("@#{method_name}")
148
+ end)
146
149
  end
147
150
  end
148
151
 
@@ -220,11 +223,13 @@ module Gitlab
220
223
  end
221
224
 
222
225
  def host_artifacts_dir
223
- @host_artifacts_dir ||= File.join(env_var_value_if_defined('QA_ARTIFACTS_DIR') || '/tmp/gitlab-qa', Runtime::Env.run_id)
226
+ @host_artifacts_dir ||= File.join(
227
+ env_var_value_if_defined('QA_ARTIFACTS_DIR') || '/tmp/gitlab-qa', Runtime::Env.run_id
228
+ )
224
229
  end
225
230
 
226
231
  def elastic_version
227
- env_var_value_if_defined('ELASTIC_VERSION') || '7.17.0'.freeze
232
+ env_var_value_if_defined('ELASTIC_VERSION') || '7.17.0'
228
233
  end
229
234
 
230
235
  def require_license!
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Gitlab
2
4
  module QA
3
5
  module Scenario
@@ -1,8 +1,10 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Gitlab
2
4
  module QA
3
5
  module Scenario
4
6
  module CLICommands
5
- GIT_LFS_VERSION = '2.8.0'.freeze
7
+ GIT_LFS_VERSION = '2.8.0'
6
8
 
7
9
  def self.git_lfs_install_commands
8
10
  [
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Gitlab
2
4
  module QA
3
5
  module Scenario
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Gitlab
2
4
  module QA
3
5
  module Scenario
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Gitlab
2
4
  module QA
3
5
  module Scenario
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Gitlab
2
4
  module QA
3
5
  module Scenario
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Gitlab
2
4
  module QA
3
5
  module Scenario
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Gitlab
2
4
  module QA
3
5
  module Scenario
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Gitlab
2
4
  module QA
3
5
  module Scenario
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Gitlab
2
4
  module QA
3
5
  module Scenario
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Gitlab
2
4
  module QA
3
5
  module Scenario
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Gitlab
2
4
  module QA
3
5
  module Scenario
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Gitlab
2
4
  module QA
3
5
  module Scenario
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Gitlab
2
4
  module QA
3
5
  module Scenario
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Gitlab
2
4
  module QA
3
5
  module Scenario
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Gitlab
2
4
  module QA
3
5
  module Scenario
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Gitlab
2
4
  module QA
3
5
  module Scenario
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Gitlab
2
4
  module QA
3
5
  module Scenario
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Gitlab
2
4
  module QA
3
5
  module Scenario
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Gitlab
2
4
  module QA
3
5
  module Scenario
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Gitlab
2
4
  module QA
3
5
  module Scenario
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Gitlab
2
4
  module QA
3
5
  module Scenario
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'yaml'
2
4
 
3
5
  module Gitlab
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'yaml'
2
4
 
3
5
  module Gitlab
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Gitlab
2
4
  module QA
3
5
  module Scenario
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'yaml'
2
4
 
3
5
  module Gitlab
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'yaml'
2
4
 
3
5
  module Gitlab
@@ -8,12 +10,12 @@ module Gitlab
8
10
  class LDAP < Scenario::Template
9
11
  LDAP_PORT = 389
10
12
  LDAP_TLS_PORT = 636
11
- BASE_DN = 'dc=example,dc=org'.freeze
12
- BIND_DN = 'cn=admin,dc=example,dc=org'.freeze
13
- GROUP_BASE = 'ou=Global Groups,dc=example,dc=org'.freeze
14
- ADMIN_GROUP = 'AdminGroup'.freeze
15
- ADMIN_USER = 'admin'.freeze
16
- ADMIN_PASSWORD = 'admin'.freeze
13
+ BASE_DN = 'dc=example,dc=org'
14
+ BIND_DN = 'cn=admin,dc=example,dc=org'
15
+ GROUP_BASE = 'ou=Global Groups,dc=example,dc=org'
16
+ ADMIN_GROUP = 'AdminGroup'
17
+ ADMIN_USER = 'admin'
18
+ ADMIN_PASSWORD = 'admin'
17
19
 
18
20
  attr_reader :gitlab_name, :spec_suite, :tls, :ldap_name, :network, :orchestrate_ldap_server
19
21
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Gitlab
2
4
  module QA
3
5
  module Scenario
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'yaml'
2
4
 
3
5
  module Gitlab
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'yaml'
2
4
 
3
5
  module Gitlab
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Gitlab
2
4
  module QA
3
5
  module Scenario
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Gitlab
2
4
  module QA
3
5
  module Scenario
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Gitlab
2
4
  module QA
3
5
  module Scenario
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'yaml'
2
4
 
3
5
  module Gitlab
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'yaml'
2
4
 
3
5
  module Gitlab
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Gitlab
2
4
  module QA
3
5
  module Scenario
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'tmpdir'
2
4
  require 'fileutils'
3
5
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'tmpdir'
2
4
  require 'fileutils'
3
5
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'json'
2
4
  require 'net/http'
3
5
  require 'cgi'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Gitlab
2
4
  module QA
3
5
  module Slack
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'json'
2
4
  require 'uri'
3
5
 
@@ -7,7 +9,7 @@ module Gitlab
7
9
  class DevEEQAImage
8
10
  attr_reader :base_url
9
11
 
10
- DEV_ADDRESS = 'https://dev.gitlab.org'.freeze
12
+ DEV_ADDRESS = 'https://dev.gitlab.org'
11
13
  GITLAB_EE_QA_REPOSITORY_ID = 55
12
14
  QAImageNotFoundError = Class.new(StandardError)
13
15
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'net/http'
2
4
  require 'uri'
3
5
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'http'
2
4
  require 'json'
3
5
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Gitlab
2
4
  module QA
3
5
  module Support
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Gitlab
4
4
  module QA
5
- VERSION = '7.34.0'
5
+ VERSION = '7.35.0'
6
6
  end
7
7
  end
data/lib/gitlab/qa.rb CHANGED
@@ -1,3 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'rainbow/refinement'
4
+
1
5
  module Gitlab
2
6
  module QA
3
7
  autoload :Release, 'gitlab/qa/release'
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
2
3
 
3
4
  require 'yaml'
4
5
 
@@ -48,7 +48,8 @@ class LicenseUsageSeed
48
48
  end
49
49
 
50
50
  def self.create_member(user, group_id)
51
- roles = Gitlab::Access.values
51
+ # Excludes GUEST role based on ultimate license seat count
52
+ roles = [Gitlab::Access::REPORTER, Gitlab::Access::DEVELOPER, Gitlab::Access::MAINTAINER]
52
53
 
53
54
  GroupMember.create(user_id: user.id, access_level: roles.sample, source_id: group_id)
54
55
  Users::UpdateHighestMemberRoleService.new(user).execute
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gitlab-qa
3
3
  version: !ruby/object:Gem::Version
4
- version: 7.34.0
4
+ version: 7.35.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - GitLab Quality
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-06-13 00:00:00.000000000 Z
11
+ date: 2022-06-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: climate_control