gitlab-qa 13.0.0 → 13.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c1b0faca28f971a96c2dbbb66253bb39575c8113f5106ee5845bd7d18a49ad14
4
- data.tar.gz: 8d3d7ec33d579c662b765beb542c60912997a7a71711eb6b38c4fdbc8fa3580f
3
+ metadata.gz: ec2a37c6f98ab78ae2f344370d529f82b569ead6d88845e50226356617a9ebee
4
+ data.tar.gz: 8c8e21d9b39bd995e9e3e0d9c631f1c11ce711d107209bcea4f88038c679830b
5
5
  SHA512:
6
- metadata.gz: 420a71805ccb95a567440373e42592588437b479bcb60d1ad0158e71620d95e679b7f01339a505c626e44c1b262096bfbd0b2b4a9c3eb2011175589de265b1af
7
- data.tar.gz: 566711df162bd8506cabc16ffcfc66764d692c86058c5a482343412fd90a75dee821fa086df4459dd0d07abb3f03e6150d9f536afc96c15710a7b7b157b94289
6
+ metadata.gz: feff60020a43876bfee3ec151d2baa2026275d9c931cbd49c0a74b0c6af53ebacd54e3e8a77324a30eafbec72d7e3eb39f5d0e259b42d7e9279837cf85bf02ad
7
+ data.tar.gz: c2f96db542d246fddcf610414644f4c05768f14e901fade00e0f754253504de7fc38394e0a51f86f24ffea00635090d54e16c523dca7a589cb7de69b6d337216
data/.gitlab-ci.yml CHANGED
@@ -8,10 +8,10 @@
8
8
  - vendor/ruby
9
9
 
10
10
  include:
11
- - project: 'gitlab-org/quality/pipeline-common'
12
- file:
13
- - '/ci/gem-release.yml'
14
- - '/ci/danger-review.yml'
11
+ - component: gitlab.com/gitlab-org/components/danger-review/danger-review@~latest
12
+ inputs:
13
+ job_image: "${CI_REGISTRY}/gitlab-org/gitlab-build-images/debian-bullseye-ruby-${RUBY_VERSION}:bundler-2.4"
14
+ - component: gitlab.com/gitlab-org/components/gem-release/gem-release@~latest
15
15
 
16
16
  stages:
17
17
  - check
@@ -97,7 +97,6 @@ cache-gems:
97
97
  - Gemfile.lock
98
98
 
99
99
  danger-review:
100
- image: ${CI_REGISTRY}/gitlab-org/gitlab-build-images/debian-bullseye-ruby-${RUBY_VERSION}:bundler-2.4
101
100
  stage: check
102
101
  needs:
103
102
  - job: cache-gems
data/Gemfile.lock CHANGED
@@ -1,8 +1,8 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- gitlab-qa (13.0.0)
5
- activesupport (>= 6.1, < 7.1)
4
+ gitlab-qa (13.2.0)
5
+ activesupport (>= 6.1, < 7.2)
6
6
  gitlab (~> 4.19)
7
7
  http (~> 5.0)
8
8
  nokogiri (~> 1.10)
@@ -0,0 +1,9 @@
1
+ # Environment Setup | Users
2
+
3
+ Most tests ([orchestrated and instance-level](../docs/what_tests_can_be_run.md#the-two-types-of-qa-tests)) [run as the default `root` user](https://gitlab.com/gitlab-org/gitlab/-/blob/3f247bf0d6d24b479b7f169f9c14068968d9672a/qa/qa/runtime/user.rb#L16). However, some require additional users. If the test framework has administrator access to the test environment it can create users itself. If administrator access is not available you will need to create users before being able to run certain tests.
4
+
5
+ ## Disable email verification
6
+
7
+ If [email verification](https://docs.gitlab.com/ee/security/email_verification.html) is enabled on the test environment (via the `require_email_verification` feature flag), a user cannot log in under certain conditions (e.g., logging in the first time from a new location) unless they enter a verification code that is sent to their email address.
8
+
9
+ To disable email verification you can disable the `require_email_verification` feature flag, which will disable email verification for all users on the instance. Alternatively, you can skip verification for individual users by enabling the `skip_require_email_verification` feature flag for that user.
@@ -58,7 +58,8 @@ All environment variables used by GitLab QA should be defined in [`lib/gitlab/qa
58
58
  | `GITLAB_QA_ACCESS_TOKEN`|- | A valid personal access token with the `api` scope. This allows tests to use the API without having to create a new personal access token first. It is also used to check what version [deployed environments](https://gitlab.com/gitlab-org/quality/pipeline-common/-/blob/master/ci/dot-com/README.md#projects) are currently running. Existing tokens for each environment can be found in the shared 1Password vault. |No|
59
59
  | `GITLAB_QA_ADMIN_ACCESS_TOKEN` |- | A valid personal access token with the `api` scope from a user with admin access. Used for API access as an admin during tests. | No|
60
60
  | `GITLAB_QA_CONTAINER_REGISTRY_ACCESS_TOKEN` | - | A valid personal access token with the `read_registry` scope. Used to [access the container registry on `registry.gitlab.com` when tests run in a CI job that _is not_ triggered via another pipeline](https://gitlab.com/gitlab-org/gitlab-qa/-/blob/364addb83e7b136ff0f9d8719ca9553d290aa9ab/lib/gitlab/qa/release.rb#L152). For example, if you manually run a [new Staging pipeline](https://ops.gitlab.net/gitlab-org/quality/staging/-/pipelines/new), this token will be used. | No |
61
- | `EE_LICENSE` |- | Enterprise Edition license. | No|
61
+ | `EE_LICENSE` |- | Enterprise Edition license. For Staging license to be applied successfully requires `CUSTOMER_PORTAL_URL` set. | No|
62
+ | `GITLAB_LICENSE_MODE` |- | If set to `test` gitlab-qa will then set customers portal address to Staging address. | No|
62
63
  | `QA_EE_ACTIVATION_CODE` |- | Cloud activation code to enable Enterprise Edition features. | No|
63
64
  | `QA_ARTIFACTS_DIR` |`/tmp/gitlab-qa`| Path to a directory where artifacts (logs and screenshots) for failing tests will be saved. | No|
64
65
  | `DOCKER_HOST` |`http://localhost`| Docker host to run tests against. | No|
@@ -1173,6 +1174,24 @@ need to be updated, it can be useful to proxy all requests to real `GitHub` inst
1173
1174
 
1174
1175
  Testing import [by direct transfer](https://docs.gitlab.com/ee/user/group/import/#migrate-groups-by-direct-transfer-recommended) is done by spinning up 2 omnibus installations - `import-target` and `import-source`. In order for tests to work, application setting `allow_local_requests_from_web_hooks_and_services` must be enabled in target instance. This is automatically done by test process if environment variable `QA_ALLOW_LOCAL_REQUESTS` is set to `true`.
1175
1176
 
1177
+ ### `Test::Integration::AiGateway EE|<full image address>`
1178
+
1179
+ This scenario spins up a GitLab Omnibus instance integrated with a test AI Gateway using [fake models](https://gitlab.com/gitlab-org/modelops/applied-ml/code-suggestions/ai-assist#faking-out-ai-models). It will run specs tagged with the `:ai_gateway` tag in order to help verify that cloud licensing and authentication for AI features work as expected for self-managed instances.
1180
+
1181
+ **Required environment variables:**
1182
+
1183
+ - `QA_EE_ACTIVATION_CODE`: An activation code for a Staging-generated Premium or Ultimate cloud license with a purchased AI add-on. This can be found in the GitLab QA 1Password vault.
1184
+ - `GITLAB_LICENSE_MODE`: Set to `test` in order to configure GitLab Omnibus with the correct license mode and `CUSTOMER_PORTAL_URL`.
1185
+
1186
+ Example:
1187
+
1188
+ ```shell
1189
+ $ export QA_EE_ACTIVATION_CODE="<value from 1Password>"
1190
+ $ export GITLAB_LICENSE_MODE="test"
1191
+
1192
+ $ gitlab-qa Test::Integration::AiGateway EE
1193
+ ```
1194
+
1176
1195
  ----
1177
1196
 
1178
1197
  [Back to README.md](../README.md)
data/gitlab-qa.gemspec CHANGED
@@ -36,7 +36,7 @@ Gem::Specification.new do |spec|
36
36
  spec.add_development_dependency 'timecop', '~> 0.9.5'
37
37
  spec.add_development_dependency 'webmock', '3.7.0'
38
38
 
39
- spec.add_runtime_dependency 'activesupport', '>= 6.1', '< 7.1'
39
+ spec.add_runtime_dependency 'activesupport', '>= 6.1', '< 7.2'
40
40
  spec.add_runtime_dependency 'gitlab', '~> 4.19'
41
41
  spec.add_runtime_dependency 'http', '~> 5.0'
42
42
  spec.add_runtime_dependency 'nokogiri', '~> 1.10'
@@ -0,0 +1,25 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Gitlab
4
+ module QA
5
+ module Component
6
+ class AiGateway < Base
7
+ DOCKER_IMAGE = 'registry.gitlab.com/gitlab-org/modelops/applied-ml/code-suggestions/ai-assist/model-gateway'
8
+ DOCKER_IMAGE_TAG = 'latest'
9
+
10
+ def name
11
+ @name ||= 'ai-gateway'
12
+ end
13
+
14
+ def configure_environment(gitlab_hostname:)
15
+ @environment = {
16
+ 'AIGW_GITLAB_URL' => "http://#{gitlab_hostname}",
17
+ 'AIGW_GITLAB_API_URL' => "http://#{gitlab_hostname}/api/v4",
18
+ 'AIGW_CUSTOMER_PORTAL_URL' => Runtime::Env.customer_portal_url,
19
+ 'AIGW_USE_FAKE_MODELS' => true
20
+ }
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
@@ -83,6 +83,13 @@ module Gitlab
83
83
  @environment['ELASTIC_URL'] = url
84
84
  end
85
85
 
86
+ def set_ee_activation_code
87
+ raise 'QA_EE_ACTIVATION_CODE is required!' if Runtime::Env.ee_activation_code.to_s.strip.empty?
88
+
89
+ @omnibus_gitlab_rails_env['QA_EE_ACTIVATION_CODE'] = Runtime::Env.ee_activation_code
90
+ secrets << Runtime::Env.ee_activation_code
91
+ end
92
+
86
93
  def release=(release)
87
94
  @release = QA::Release.new(release)
88
95
  end
@@ -428,6 +428,10 @@ module Gitlab
428
428
  env_var_value_if_defined('CUSTOMER_PORTAL_URL') || 'https://customers.staging.gitlab.com'
429
429
  end
430
430
 
431
+ def ee_activation_code
432
+ env_var_value_if_defined('QA_EE_ACTIVATION_CODE')
433
+ end
434
+
431
435
  def geo_staging_url
432
436
  env_var_value_if_defined('GEO_STAGING_URL') || 'https://geo.staging.gitlab.com'
433
437
  end
@@ -0,0 +1,86 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Gitlab
4
+ module QA
5
+ module Scenario
6
+ module Test
7
+ module Integration
8
+ class AiGateway < Scenario::Template
9
+ SETUP_SRC_PATH = File.expand_path('../../../../../../support/setup', __dir__)
10
+ SETUP_DEST_PATH = '/tmp/setup-scripts'
11
+
12
+ def initialize
13
+ @network = 'test'
14
+ @ai_gateway_name = 'ai-gateway'
15
+ @ai_gateway_hostname = "#{@ai_gateway_name}.#{@network}"
16
+ @ai_gateway_port = 5000
17
+ end
18
+
19
+ def perform(release, *rspec_args)
20
+ Component::Gitlab.perform do |gitlab|
21
+ setup_gitlab(gitlab, release)
22
+
23
+ Component::AiGateway.perform do |ai_gateway|
24
+ setup_ai_gateway(ai_gateway, gitlab_hostname: gitlab.hostname)
25
+
26
+ ai_gateway.instance do
27
+ gitlab.instance do
28
+ setup_code_suggestions(gitlab)
29
+ run_specs(gitlab, *rspec_args)
30
+ end
31
+ end
32
+ end
33
+ end
34
+ end
35
+
36
+ private
37
+
38
+ def setup_gitlab(gitlab, release)
39
+ gitlab.release = QA::Release.new(release)
40
+ gitlab.name = 'gitlab'
41
+ gitlab.network = @network
42
+
43
+ gitlab.omnibus_gitlab_rails_env['CODE_SUGGESTIONS_BASE_URL'] = "http://#{@ai_gateway_hostname}:#{@ai_gateway_port}"
44
+
45
+ gitlab.set_ee_activation_code
46
+ end
47
+
48
+ def setup_ai_gateway(ai_gateway, gitlab_hostname:)
49
+ ai_gateway.name = @ai_gateway_name
50
+ ai_gateway.network = @network
51
+ ai_gateway.ports = [@ai_gateway_port]
52
+
53
+ ai_gateway.configure_environment(gitlab_hostname: gitlab_hostname)
54
+ end
55
+
56
+ def setup_code_suggestions(gitlab)
57
+ Runtime::Logger.info('Setting up Code Suggestions on GitLab instance')
58
+
59
+ gitlab.docker.copy(gitlab.name, SETUP_SRC_PATH, SETUP_DEST_PATH)
60
+
61
+ gitlab.docker.exec(
62
+ gitlab.name,
63
+ "gitlab-rails runner #{SETUP_DEST_PATH}/code_suggestions_setup.rb",
64
+ mask_secrets: gitlab.secrets
65
+ )
66
+ end
67
+
68
+ def run_specs(gitlab, *rspec_args)
69
+ Runtime::Logger.info('Running AI Gateway specs!')
70
+
71
+ rspec_args << "--" unless rspec_args.include?('--')
72
+ rspec_args << %w[--tag ai_gateway]
73
+
74
+ Component::Specs.perform do |specs|
75
+ specs.suite = 'Test::Instance::All'
76
+ specs.release = gitlab.release
77
+ specs.network = gitlab.network
78
+ specs.args = [gitlab.address, *rspec_args]
79
+ end
80
+ end
81
+ end
82
+ end
83
+ end
84
+ end
85
+ end
86
+ end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Gitlab
4
4
  module QA
5
- VERSION = '13.0.0'
5
+ VERSION = '13.2.0'
6
6
  end
7
7
  end
@@ -0,0 +1,54 @@
1
+ # frozen_string_literal: true
2
+
3
+ class CodeSuggestionsSetup
4
+ class << self
5
+ def configure!
6
+ puts 'Enabling code_suggestions_tokens_api feature flag...'
7
+ Feature.enable(:code_suggestions_tokens_api)
8
+
9
+ activate_cloud_license
10
+
11
+ # Due to the various async Sidekiq processes involved, we wait to verify
12
+ # that the code suggestions access token has been generated before proceeding
13
+ verify_code_suggestions_access_token
14
+
15
+ puts 'Enabling application setting instance_level_code_suggestions_enabled...'
16
+ ApplicationSetting.last.update(instance_level_code_suggestions_enabled: true)
17
+ end
18
+
19
+ private
20
+
21
+ def activate_cloud_license
22
+ puts 'Activating cloud license...'
23
+ activation_result = ::GitlabSubscriptions::ActivateService.new.execute(ENV.fetch('QA_EE_ACTIVATION_CODE', nil))
24
+
25
+ if activation_result[:success]
26
+ puts 'Cloud license activation successful'
27
+ else
28
+ puts 'Cloud license activation failed!'
29
+ puts Array(result[:errors]).join(' ')
30
+ exit 1
31
+ end
32
+ end
33
+
34
+ def verify_code_suggestions_access_token
35
+ puts 'Waiting for code suggestions access token to be available...'
36
+
37
+ max_attempts = 3
38
+ attempts = 0
39
+
40
+ until (tokens = ::Ai::ServiceAccessToken.active.count)&.positive? || attempts == max_attempts
41
+ puts 'Attempting to verify access token exists...'
42
+ attempts += 1
43
+ sleep 30
44
+ end
45
+
46
+ return if tokens&.positive?
47
+
48
+ puts "Failed to create code suggestions access token after #{max_attempts} attempts"
49
+ exit 1
50
+ end
51
+ end
52
+ end
53
+
54
+ CodeSuggestionsSetup.configure!
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: 13.0.0
4
+ version: 13.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - GitLab Quality
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-12-06 00:00:00.000000000 Z
11
+ date: 2024-01-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: climate_control
@@ -201,7 +201,7 @@ dependencies:
201
201
  version: '6.1'
202
202
  - - "<"
203
203
  - !ruby/object:Gem::Version
204
- version: '7.1'
204
+ version: '7.2'
205
205
  type: :runtime
206
206
  prerelease: false
207
207
  version_requirements: !ruby/object:Gem::Requirement
@@ -211,7 +211,7 @@ dependencies:
211
211
  version: '6.1'
212
212
  - - "<"
213
213
  - !ruby/object:Gem::Version
214
- version: '7.1'
214
+ version: '7.2'
215
215
  - !ruby/object:Gem::Dependency
216
216
  name: gitlab
217
217
  requirement: !ruby/object:Gem::Requirement
@@ -328,7 +328,7 @@ dependencies:
328
328
  - - "<"
329
329
  - !ruby/object:Gem::Version
330
330
  version: '3'
331
- description:
331
+ description:
332
332
  email:
333
333
  - gitlab-qa@gmail.com
334
334
  executables:
@@ -365,6 +365,7 @@ files:
365
365
  - docs/developer/http_mocking.md
366
366
  - docs/developer/ssl.md
367
367
  - docs/developer/style_guide.md
368
+ - docs/environment_setup/users.md
368
369
  - docs/how_it_works.md
369
370
  - docs/omnibus_configurations/license_mode.md
370
371
  - docs/release_process.md
@@ -383,6 +384,7 @@ files:
383
384
  - gitlab-qa.gemspec
384
385
  - lefthook.yml
385
386
  - lib/gitlab/qa.rb
387
+ - lib/gitlab/qa/component/ai_gateway.rb
386
388
  - lib/gitlab/qa/component/alpine.rb
387
389
  - lib/gitlab/qa/component/base.rb
388
390
  - lib/gitlab/qa/component/chaos.rb
@@ -444,6 +446,7 @@ files:
444
446
  - lib/gitlab/qa/scenario/test/instance/staging_geo.rb
445
447
  - lib/gitlab/qa/scenario/test/instance/staging_ref.rb
446
448
  - lib/gitlab/qa/scenario/test/instance/staging_ref_geo.rb
449
+ - lib/gitlab/qa/scenario/test/integration/ai_gateway.rb
447
450
  - lib/gitlab/qa/scenario/test/integration/chaos.rb
448
451
  - lib/gitlab/qa/scenario/test/integration/client_ssl.rb
449
452
  - lib/gitlab/qa/scenario/test/integration/elasticsearch.rb
@@ -496,6 +499,7 @@ files:
496
499
  - support/manifests/suggested_reviewer/pubsub.yaml
497
500
  - support/manifests/suggested_reviewer/recommender-bot.yaml
498
501
  - support/manifests/suggested_reviewer/recommender.yaml
502
+ - support/setup/code_suggestions_setup.rb
499
503
  - tls_certificates/authority/ca.crt
500
504
  - tls_certificates/authority/ca.key
501
505
  - tls_certificates/authority/ca.pem
@@ -513,7 +517,7 @@ homepage: http://about.gitlab.com/
513
517
  licenses:
514
518
  - MIT
515
519
  metadata: {}
516
- post_install_message:
520
+ post_install_message:
517
521
  rdoc_options: []
518
522
  require_paths:
519
523
  - lib
@@ -528,8 +532,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
528
532
  - !ruby/object:Gem::Version
529
533
  version: '0'
530
534
  requirements: []
531
- rubygems_version: 3.1.6
532
- signing_key:
535
+ rubygems_version: 3.3.26
536
+ signing_key:
533
537
  specification_version: 4
534
538
  summary: Integration tests for GitLab
535
539
  test_files: []