gitlab-qa 14.19.1 → 14.20.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: 3d285ed79f26892ee7699676a173247fac7a727b28cf5f1a82bc88c1365eb395
4
- data.tar.gz: e06a95829a877c2d198713b3cc6cd45defff417e78f24f254580d22fe5d3f6b0
3
+ metadata.gz: d2d322ac696cbbc43376ab9e0119aa17b5ca27b326a4e98c0bed1e7e62bb0d94
4
+ data.tar.gz: ac29c33e952e89531a792294fe91ecbc251562b77eefb2aa17c46a969b1916a1
5
5
  SHA512:
6
- metadata.gz: 291d67746efa1a67cae722cb0dae38ba34fe46caac956ceb5d084e0b74cf650b734ae9f07bca363f721c9c5b788381751fd3e76171e7dc03cfb26f026e96425e
7
- data.tar.gz: 467820916ff35b99c6533f8912281580157243f3fddf42ec70cf915573c745e5b678cb1da7bb7fce7c37dbae2a1b2a71ed6f2610aee236d07bb44b36ff9ba167
6
+ metadata.gz: e16ec9338d9c0e45854dd81c15219afd7a4960882debbccf75a5a0db426b682f416ce9b41264ba560c8f384b81f822a3bbf51f66b2a0022a9d16d78d7a406c47
7
+ data.tar.gz: d4f1c16afbf492572dd0d3830c592e38c0182224b2524ab1992e5ffa1e286bcfec7f6a21da837b8de45cea4109bc703ecc6c828a64ab51c7a72d04b50e342956
data/CONTRIBUTING.md CHANGED
@@ -1,9 +1,9 @@
1
1
  ## Developer Certificate of Origin + License
2
2
 
3
- By contributing to GitLab B.V., You accept and agree to the following terms and
4
- conditions for Your present and future Contributions submitted to GitLab B.V.
5
- Except for the license granted herein to GitLab B.V. and recipients of software
6
- distributed by GitLab B.V., You reserve all right, title, and interest in and to
3
+ By contributing to GitLab Inc., You accept and agree to the following terms and
4
+ conditions for Your present and future Contributions submitted to GitLab Inc.
5
+ Except for the license granted herein to GitLab Inc. and recipients of software
6
+ distributed by GitLab Inc., You reserve all right, title, and interest in and to
7
7
  Your Contributions. All Contributions are subject to the following DCO + License
8
8
  terms.
9
9
 
data/Gemfile.lock CHANGED
@@ -1,8 +1,9 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- gitlab-qa (14.19.1)
4
+ gitlab-qa (14.20.0)
5
5
  activesupport (>= 6.1, < 7.2)
6
+ ffi (~> 1.17)
6
7
  gitlab (~> 4.19)
7
8
  http (~> 5.0)
8
9
  nokogiri (~> 1.10)
@@ -94,7 +95,7 @@ GEM
94
95
  faraday-patron (1.0.0)
95
96
  faraday-rack (1.0.0)
96
97
  faraday-retry (1.0.3)
97
- ffi (1.15.5)
98
+ ffi (1.17.0)
98
99
  ffi-compiler (1.0.1)
99
100
  ffi (>= 1.0.0)
100
101
  rake
data/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2011-2017 GitLab B.V.
1
+ Copyright (c) 2011-2017 GitLab Inc.
2
2
 
3
3
  With regard to the GitLab Software:
4
4
 
data/gitlab-qa.gemspec CHANGED
@@ -37,6 +37,7 @@ Gem::Specification.new do |spec|
37
37
  spec.add_development_dependency 'webmock', '3.7.0'
38
38
 
39
39
  spec.add_runtime_dependency 'activesupport', '>= 6.1', '< 7.2'
40
+ spec.add_runtime_dependency 'ffi', '~> 1.17'
40
41
  spec.add_runtime_dependency 'gitlab', '~> 4.19'
41
42
  spec.add_runtime_dependency 'http', '~> 5.0'
42
43
  spec.add_runtime_dependency 'nokogiri', '~> 1.10'
@@ -7,6 +7,8 @@ module Gitlab
7
7
  DOCKER_IMAGE = 'registry.gitlab.com/gitlab-org/modelops/applied-ml/code-suggestions/ai-assist/model-gateway'
8
8
  DOCKER_IMAGE_TAG = 'latest'
9
9
 
10
+ LOG_FILE_NAME = 'modelgateway_debug.log'
11
+
10
12
  # Test signing key to enable direct connection code completions
11
13
  # https://gitlab.com/gitlab-org/modelops/applied-ml/code-suggestions/ai-assist/-/blob/97f54f4b7e43258a39bba7f29f38fe44bd316ce5/example.env#L79
12
14
  TEST_SIGNING_KEY =
@@ -87,17 +89,42 @@ module Gitlab
87
89
  @name ||= 'ai-gateway'
88
90
  end
89
91
 
92
+ def host_log_path
93
+ File.join(Runtime::Env.host_artifacts_dir, name, 'logs', LOG_FILE_NAME)
94
+ end
95
+
96
+ def container_log_path
97
+ File.join('home', 'aigateway', 'app', LOG_FILE_NAME)
98
+ end
99
+
90
100
  def configure_environment(gitlab_hostname:)
91
101
  @environment = {
92
102
  'AIGW_GITLAB_URL' => "http://#{gitlab_hostname}",
93
103
  'AIGW_GITLAB_API_URL' => "http://#{gitlab_hostname}/api/v4",
94
104
  'AIGW_CUSTOMER_PORTAL_URL' => Runtime::Env.customer_portal_url,
95
105
  'AIGW_MOCK_MODEL_RESPONSES' => true,
106
+ 'AIGW_LOGGING__LEVEL' => 'debug',
107
+ 'AIGW_LOGGING__TO_FILE' => LOG_FILE_NAME,
96
108
  'AIGW_SELF_SIGNED_JWT__SIGNING_KEY' => TEST_SIGNING_KEY,
97
109
  'AIGW_SELF_SIGNED_JWT__VALIDATION_KEY' => TEST_VALIDATION_KEY,
98
110
  'CLOUD_CONNECTOR_SERVICE_NAME' => 'gitlab-ai-gateway'
99
111
  }
100
112
  end
113
+
114
+ def teardown
115
+ # Copy debug log file to host artifacts directory
116
+ begin
117
+ Docker::Command.execute(
118
+ "cp #{name}:#{container_log_path} #{host_log_path}"
119
+ )
120
+ rescue Support::ShellCommand::StatusError => e
121
+ Runtime::Logger.warn(
122
+ "Unable to copy log file from #{name}: #{e.message}"
123
+ )
124
+ end
125
+
126
+ super
127
+ end
101
128
  end
102
129
  end
103
130
  end
@@ -68,6 +68,12 @@ module Gitlab
68
68
  @omnibus_gitlab_rails_env['CUSTOMER_PORTAL_URL'] = Runtime::Env.customer_portal_url
69
69
  end
70
70
 
71
+ def set_cloud_connector_base_url
72
+ return if Runtime::Env.cloud_connector_base_url.blank?
73
+
74
+ @omnibus_gitlab_rails_env['CLOUD_CONNECTOR_BASE_URL'] = Runtime::Env.cloud_connector_base_url
75
+ end
76
+
71
77
  # Sets GITLAB_QA_USER_AGENT as a Rail environment variable so that it can be used by GitLab to bypass features
72
78
  # that can't be automated.
73
79
  def set_qa_user_agent
@@ -138,6 +144,7 @@ module Gitlab
138
144
  set_formless_login_token
139
145
  set_license_mode
140
146
  set_qa_user_agent
147
+ set_cloud_connector_base_url
141
148
  env = @omnibus_gitlab_rails_env.merge(
142
149
  {
143
150
  'GITLAB_ALLOW_SEPARATE_CI_DATABASE' => Runtime::Env.allow_separate_ci_database.to_s,
@@ -41,6 +41,7 @@ module Gitlab
41
41
  'CI_PROJECT_NAME' => :ci_project_name,
42
42
  'CI_PROJECT_PATH' => :ci_project_path,
43
43
  'CI_PROJECT_PATH_SLUG' => :ci_project_path_slug,
44
+ 'CI_PROJECT_DIR' => :ci_project_dir,
44
45
  'CI_RUNNER_ID' => :ci_runner_id,
45
46
  'CI_SERVER_HOST' => :ci_server_host,
46
47
  'CI_SERVER_PERSONAL_ACCESS_TOKEN' => :ci_server_personal_access_token,
@@ -326,6 +327,12 @@ module Gitlab
326
327
  end
327
328
  end
328
329
 
330
+ def require_cloud_connector_base_url!
331
+ return unless cloud_connector_base_url.blank?
332
+
333
+ raise ArgumentError, "Please provide CLOUD_CONNECTOR_BASE_URL"
334
+ end
335
+
329
336
  def require_initial_password!
330
337
  return unless env_var_value_if_defined('GITLAB_INITIAL_ROOT_PASSWORD').to_s.strip.empty?
331
338
 
@@ -433,6 +440,10 @@ module Gitlab
433
440
  env_var_value_if_defined('CUSTOMER_PORTAL_URL') || 'https://customers.staging.gitlab.com'
434
441
  end
435
442
 
443
+ def cloud_connector_base_url
444
+ env_var_value_if_defined('CLOUD_CONNECTOR_BASE_URL')
445
+ end
446
+
436
447
  def ee_activation_code
437
448
  env_var_value_if_defined('QA_EE_ACTIVATION_CODE')
438
449
  end
@@ -8,6 +8,8 @@ module Gitlab
8
8
  class UpdateFromPrevious < Scenario::Template
9
9
  using Rainbow
10
10
 
11
+ attr_reader :rspec_args
12
+
11
13
  # Test update from N - 1 (major|minor|patch) version to current release
12
14
  # Run health check (or smoke if below 17.1.0) test suite on previous release to populate some data in database before update
13
15
  #
@@ -36,6 +38,7 @@ module Gitlab
36
38
  semver_component,
37
39
  from_edition || @current_release.edition
38
40
  ).fetch
41
+ @rspec_args = rspec_args
39
42
 
40
43
  upgrade_info = "#{[*upgrade_path, current_release].join(' => ')} (#{current_version})".bright
41
44
  Runtime::Logger.info("Performing gitlab update: #{upgrade_info}")
@@ -43,6 +46,18 @@ module Gitlab
43
46
  update(rspec_args)
44
47
  end
45
48
 
49
+ def seeding_suite_args
50
+ first_release_version = extract_version(upgrade_path.first.release)
51
+ if Gem::Version.new(first_release_version) < Gem::Version.new("17.1.0")
52
+ ["--", "--tag", "smoke"]
53
+ else
54
+ ["--", "--tag", "health_check"]
55
+ end
56
+ end
57
+
58
+ # this is any action or event that may happen before the seeding suite is run
59
+ def pre_seeding_environment_actions(gitlab); end
60
+
46
61
  private
47
62
 
48
63
  attr_reader :current_release, :upgrade_path
@@ -62,16 +77,9 @@ module Gitlab
62
77
  # rubocop:disable Metrics/AbcSize
63
78
  def update(rspec_args)
64
79
  Docker::Volumes.new.with_temporary_volumes do |volumes|
65
- first_release_version = extract_version(upgrade_path.first.release)
66
- seeding_suite_args = if Gem::Version.new(first_release_version) < Gem::Version.new("17.1.0")
67
- ["--", "--tag", "smoke"]
68
- else
69
- ["--", "--tag", "health_check"]
70
- end
71
-
72
80
  # deploy first release in upgrade path and run specs to populate db
73
81
  Runtime::Logger.info("Running the first release in upgrade path: #{upgrade_path.first}")
74
- run_gitlab(upgrade_path.first, volumes, seeding_suite_args)
82
+ run_gitlab(upgrade_path.first, volumes, seeding_suite_args, seeding_run: true)
75
83
 
76
84
  # deploy releases in upgrade path
77
85
  upgrade_path[1..].each do |release|
@@ -91,7 +99,7 @@ module Gitlab
91
99
  # @param [Gitlab::QA::Release] release
92
100
  # @param [Hash] volumes
93
101
  # @return [void]
94
- def run_gitlab(release, volumes, rspec_args = [], skip_setup: false) # rubocop:disable Metrics/AbcSize
102
+ def run_gitlab(release, volumes, rspec_args = [], skip_setup: false, seeding_run: false) # rubocop:disable Metrics/AbcSize
95
103
  Runtime::Logger.info("Deploying release: #{release.to_s.bright}")
96
104
 
97
105
  Component::Gitlab.perform do |gitlab|
@@ -99,6 +107,7 @@ module Gitlab
99
107
  gitlab.release = release
100
108
  gitlab.volumes = volumes
101
109
  gitlab.network = Runtime::Env.docker_network
110
+ gitlab.set_ee_activation_code if @use_cloud_license
102
111
 
103
112
  if skip_setup
104
113
  gitlab.skip_server_hooks = true
@@ -108,7 +117,10 @@ module Gitlab
108
117
 
109
118
  next gitlab.launch_and_teardown_instance unless run_specs?(release)
110
119
 
111
- gitlab.instance { run_specs(gitlab, release, rspec_args) }
120
+ gitlab.instance do
121
+ pre_seeding_environment_actions(gitlab) if seeding_run
122
+ run_specs(gitlab, release, rspec_args)
123
+ end
112
124
  end
113
125
  end
114
126
 
@@ -0,0 +1,46 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Gitlab
4
+ module QA
5
+ module Scenario
6
+ module Test
7
+ module Omnibus
8
+ class UpdateFromPreviousAi < UpdateFromPrevious
9
+ def initialize
10
+ Runtime::Env.require_cloud_connector_base_url!
11
+ @use_cloud_license = true
12
+ @perform_license_sync_event = false
13
+ super
14
+ end
15
+
16
+ def seeding_suite_args
17
+ super + (rspec_args[1..] || [])
18
+ end
19
+
20
+ def pre_seeding_environment_actions(gitlab)
21
+ super
22
+ set_up_gitlab_duo(gitlab)
23
+ end
24
+
25
+ private
26
+
27
+ def set_up_gitlab_duo(gitlab)
28
+ setup_src_path = File.expand_path('../../../../../../support/setup', __dir__)
29
+ setup_dest_path = '/tmp/setup-scripts'
30
+
31
+ Runtime::Logger.info('Setting up Gitlab Duo on GitLab instance')
32
+
33
+ gitlab.docker.copy(gitlab.name, setup_src_path, setup_dest_path)
34
+
35
+ gitlab.docker.exec(
36
+ gitlab.name,
37
+ "ASSIGN_SEATS=true HAS_ADD_ON=true gitlab-rails runner #{setup_dest_path}/gitlab_duo_setup.rb",
38
+ mask_secrets: gitlab.secrets
39
+ )
40
+ end
41
+ end
42
+ end
43
+ end
44
+ end
45
+ end
46
+ end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Gitlab
4
4
  module QA
5
- VERSION = '14.19.1'
5
+ VERSION = '14.20.0'
6
6
  end
7
7
  end
@@ -88,10 +88,14 @@ class GitlabDuoSetup
88
88
  end
89
89
 
90
90
  def duo_pro_add_on
91
+ return nil unless GitlabSubscriptions::AddOn.respond_to?(:code_suggestions)
92
+
91
93
  find_add_on_purchase(add_on: GitlabSubscriptions::AddOn.code_suggestions.last)
92
94
  end
93
95
 
94
96
  def duo_enterprise_add_on
97
+ return nil unless GitlabSubscriptions::AddOn.respond_to?(:duo_enterprise)
98
+
95
99
  find_add_on_purchase(add_on: GitlabSubscriptions::AddOn.duo_enterprise.last)
96
100
  end
97
101
 
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: 14.19.1
4
+ version: 14.20.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: 2024-10-28 00:00:00.000000000 Z
11
+ date: 2024-11-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: climate_control
@@ -212,6 +212,20 @@ dependencies:
212
212
  - - "<"
213
213
  - !ruby/object:Gem::Version
214
214
  version: '7.2'
215
+ - !ruby/object:Gem::Dependency
216
+ name: ffi
217
+ requirement: !ruby/object:Gem::Requirement
218
+ requirements:
219
+ - - "~>"
220
+ - !ruby/object:Gem::Version
221
+ version: '1.17'
222
+ type: :runtime
223
+ prerelease: false
224
+ version_requirements: !ruby/object:Gem::Requirement
225
+ requirements:
226
+ - - "~>"
227
+ - !ruby/object:Gem::Version
228
+ version: '1.17'
215
229
  - !ruby/object:Gem::Dependency
216
230
  name: gitlab
217
231
  requirement: !ruby/object:Gem::Requirement
@@ -477,6 +491,7 @@ files:
477
491
  - lib/gitlab/qa/scenario/test/integration/suggested_reviewer.rb
478
492
  - lib/gitlab/qa/scenario/test/omnibus/image.rb
479
493
  - lib/gitlab/qa/scenario/test/omnibus/update_from_previous.rb
494
+ - lib/gitlab/qa/scenario/test/omnibus/update_from_previous_ai.rb
480
495
  - lib/gitlab/qa/scenario/test/omnibus/upgrade.rb
481
496
  - lib/gitlab/qa/service/cluster_provider/base.rb
482
497
  - lib/gitlab/qa/service/cluster_provider/k3d.rb