gitlab-qa 14.15.0 → 14.17.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/docs/what_tests_can_be_run.md +5 -5
- data/lib/gitlab/qa/component/gitlab.rb +2 -1
- data/lib/gitlab/qa/runtime/env.rb +5 -0
- data/lib/gitlab/qa/scenario/test/integration/ai_gateway_base.rb +4 -4
- data/lib/gitlab/qa/version.rb +1 -1
- data/rubocop/cop/gitlab/dangerous_interpolation.rb +1 -0
- data/support/setup/{duo_pro_setup.rb → gitlab_duo_setup.rb} +39 -12
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9a30b8f1d5f38d5c3b4a48d7b1395387b4cc854e5e2ec579d3591777b7131c84
|
4
|
+
data.tar.gz: 9da397c19c29ea43b5fce2b8ad441d09dbd203adfcb122aa7ac75cc707f65245
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1eba615ae509dc1425e85375e726604a160c05edd7c69e0bbe86d65ad7a638fdc8f062633463b442e77e6d11b4693d5c6e2738a97385b168108be1c18ac1187c
|
7
|
+
data.tar.gz: 3c4a0c7c9375199ff84c86c8d2d8a2d9b8eaf93094708ea7be80ad53f98a3ee8a46807364d13ad0a7b57c45f0e06d85087b23915d78549b4baf21f5a4a810044
|
data/Gemfile.lock
CHANGED
@@ -1196,7 +1196,7 @@ The following `AiGateway` scenarios spin up a GitLab Omnibus instance integrated
|
|
1196
1196
|
|
1197
1197
|
All scenarios below require the following environment variables, **_unless otherwise noted:_**
|
1198
1198
|
|
1199
|
-
- `QA_EE_ACTIVATION_CODE`: An activation code for a Staging-generated Premium or Ultimate cloud license with a purchased Duo Pro add-on. This can be found in the GitLab QA 1Password vault.
|
1199
|
+
- `QA_EE_ACTIVATION_CODE`: An activation code for a Staging-generated Premium or Ultimate cloud license with a purchased Duo Pro or Duo Enterprise add-on. This can be found in the GitLab QA 1Password vault.
|
1200
1200
|
- `GITLAB_LICENSE_MODE`: Set to `test` in order to configure GitLab Omnibus with the correct license mode and `CUSTOMER_PORTAL_URL`.
|
1201
1201
|
|
1202
1202
|
Example:
|
@@ -1211,7 +1211,7 @@ $ export GITLAB_LICENSE_MODE="test"
|
|
1211
1211
|
#### `Test::Integration::AiGateway EE|<full image address>`
|
1212
1212
|
|
1213
1213
|
- Runs tests tagged with `:ai_gateway`
|
1214
|
-
- GitLab instance has a cloud license
|
1214
|
+
- GitLab instance has a cloud license with either a Duo Pro add-on or Duo Enterprise add-on, and a seat is assigned to the admin user. Choose Duo Enterprise over Duo Pro when available.
|
1215
1215
|
|
1216
1216
|
Example:
|
1217
1217
|
|
@@ -1224,7 +1224,7 @@ $ gitlab-qa Test::Integration::AiGateway EE
|
|
1224
1224
|
#### `Test::Integration::AiGatewayNoSeatAssigned EE|<full image address>`
|
1225
1225
|
|
1226
1226
|
- Runs tests tagged with `:ai_gateway_no_seat_assigned`
|
1227
|
-
- GitLab instance has a cloud license + Duo Pro add-on, but no seat is assigned to the admin user
|
1227
|
+
- GitLab instance has a cloud license + Duo Pro or Duo Enterprise add-on, but no seat is assigned to the admin user.
|
1228
1228
|
|
1229
1229
|
Example:
|
1230
1230
|
|
@@ -1237,11 +1237,11 @@ $ gitlab-qa Test::Integration::AiGatewayNoSeatAssigned EE
|
|
1237
1237
|
#### `Test::Integration::AiGatewayNoAddOn EE|<full image address>`
|
1238
1238
|
|
1239
1239
|
- Runs tests tagged with `:ai_gateway_no_add_on`
|
1240
|
-
- GitLab instance has a cloud license without a Duo Pro add-on, and no seat is assigned to the admin user
|
1240
|
+
- GitLab instance has a cloud license without a Duo Pro or Duo Enterprise add-on, and no seat is assigned to the admin user.
|
1241
1241
|
|
1242
1242
|
**Regarding environment variables:**
|
1243
1243
|
|
1244
|
-
- `QA_EE_ACTIVATION_CODE` should be set to a Staging-generated Premium or Ultimate cloud license _without_ a Duo Pro add-on.
|
1244
|
+
- `QA_EE_ACTIVATION_CODE` should be set to a Staging-generated Premium or Ultimate cloud license _without_ a Duo Pro or Duo Enterprise add-on.
|
1245
1245
|
|
1246
1246
|
Example:
|
1247
1247
|
|
@@ -140,7 +140,8 @@ module Gitlab
|
|
140
140
|
set_qa_user_agent
|
141
141
|
env = @omnibus_gitlab_rails_env.merge(
|
142
142
|
{
|
143
|
-
'GITLAB_ALLOW_SEPARATE_CI_DATABASE' => Runtime::Env.allow_separate_ci_database.to_s
|
143
|
+
'GITLAB_ALLOW_SEPARATE_CI_DATABASE' => Runtime::Env.allow_separate_ci_database.to_s,
|
144
|
+
'COVERBAND_ENABLED' => Runtime::Env.coverband_enabled?.to_s
|
144
145
|
}
|
145
146
|
)
|
146
147
|
|
@@ -24,6 +24,7 @@ module Gitlab
|
|
24
24
|
'AWS_S3_REGION' => :aws_s3_region,
|
25
25
|
'CACHE_NAMESPACE_NAME' => :cache_namespace_name,
|
26
26
|
'CHROME_DISABLE_DEV_SHM' => :chrome_disable_dev_shm,
|
27
|
+
'COVERBAND_ENABLED' => :coverband_enabled,
|
27
28
|
'CI' => :ci,
|
28
29
|
'CI_JOB_ID' => :ci_job_id,
|
29
30
|
'CI_JOB_NAME' => :ci_job_name,
|
@@ -468,6 +469,10 @@ module Gitlab
|
|
468
469
|
enabled?(env_var_value_if_defined('GITLAB_ALLOW_SEPARATE_CI_DATABASE'), default: false)
|
469
470
|
end
|
470
471
|
|
472
|
+
def coverband_enabled?
|
473
|
+
enabled?(env_var_value_if_defined('COVERBAND_ENABLED'), default: false)
|
474
|
+
end
|
475
|
+
|
471
476
|
def mock_github_enabled?
|
472
477
|
enabled?(env_var_value_if_defined('QA_MOCK_GITHUB'), default: true)
|
473
478
|
end
|
@@ -28,7 +28,7 @@ module Gitlab
|
|
28
28
|
|
29
29
|
ai_gateway.instance do
|
30
30
|
gitlab.instance do
|
31
|
-
|
31
|
+
set_up_gitlab_duo(gitlab) if @use_cloud_license
|
32
32
|
run_specs(gitlab, *rspec_args)
|
33
33
|
end
|
34
34
|
end
|
@@ -55,14 +55,14 @@ module Gitlab
|
|
55
55
|
ai_gateway.configure_environment(gitlab_hostname: gitlab_hostname)
|
56
56
|
end
|
57
57
|
|
58
|
-
def
|
59
|
-
Runtime::Logger.info('Setting up Duo
|
58
|
+
def set_up_gitlab_duo(gitlab)
|
59
|
+
Runtime::Logger.info('Setting up Gitlab Duo on GitLab instance')
|
60
60
|
|
61
61
|
gitlab.docker.copy(gitlab.name, SETUP_SRC_PATH, SETUP_DEST_PATH)
|
62
62
|
|
63
63
|
gitlab.docker.exec(
|
64
64
|
gitlab.name,
|
65
|
-
"ASSIGN_SEATS=#{@assign_seats} HAS_ADD_ON=#{@has_add_on} gitlab-rails runner #{SETUP_DEST_PATH}/
|
65
|
+
"ASSIGN_SEATS=#{@assign_seats} HAS_ADD_ON=#{@has_add_on} gitlab-rails runner #{SETUP_DEST_PATH}/gitlab_duo_setup.rb",
|
66
66
|
mask_secrets: gitlab.secrets
|
67
67
|
)
|
68
68
|
end
|
data/lib/gitlab/qa/version.rb
CHANGED
@@ -95,6 +95,7 @@ module RuboCop
|
|
95
95
|
'CI_PIPELINE_URL' => :ci_pipeline_url,
|
96
96
|
'CI_PIPELINE_CREATED_AT' => :ci_pipeline_created_at,
|
97
97
|
'CI_MERGE_REQUEST_IID' => :ci_merge_request_iid,
|
98
|
+
'COVERBAND_ENABLED' => :coverband_enabled,
|
98
99
|
'GITLAB_CI' => :gitlab_ci,
|
99
100
|
'ELASTIC_URL' => :elastic_url,
|
100
101
|
'GITLAB_QA_LOOP_RUNNER_MINUTES' => :gitlab_qa_loop_runner_minutes,
|
@@ -1,6 +1,8 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
3
|
+
require 'active_support/core_ext/object/blank'
|
4
|
+
|
5
|
+
class GitlabDuoSetup
|
4
6
|
class << self
|
5
7
|
def configure!
|
6
8
|
activate_cloud_license
|
@@ -11,7 +13,7 @@ class DuoProSetup
|
|
11
13
|
# that the service access token has been generated before proceeding
|
12
14
|
verify_service_access_token
|
13
15
|
|
14
|
-
|
16
|
+
assign_duo_seat_to_admin if enabled?('ASSIGN_SEATS')
|
15
17
|
end
|
16
18
|
|
17
19
|
private
|
@@ -29,32 +31,31 @@ class DuoProSetup
|
|
29
31
|
end
|
30
32
|
end
|
31
33
|
|
34
|
+
def token_count
|
35
|
+
::CloudConnector::ServiceAccessToken.active.count
|
36
|
+
end
|
37
|
+
|
32
38
|
def verify_service_access_token
|
33
39
|
puts 'Waiting for service access token to be available...'
|
34
40
|
|
35
41
|
max_attempts = 3
|
36
42
|
attempts = 0
|
37
43
|
|
38
|
-
until
|
44
|
+
until token_count&.positive? || attempts == max_attempts
|
39
45
|
puts 'Attempting to verify access token exists...'
|
40
46
|
attempts += 1
|
41
47
|
sleep 30
|
42
48
|
end
|
43
49
|
|
44
|
-
return if
|
50
|
+
return if token_count&.positive?
|
45
51
|
|
46
52
|
puts "Failed to create service access token after #{max_attempts} attempts"
|
47
53
|
exit 1
|
48
54
|
end
|
49
55
|
|
50
|
-
def
|
51
|
-
puts 'Assigning Duo Pro seat to admin...'
|
52
|
-
|
53
|
-
admin = User.find_by(username: 'root')
|
54
|
-
add_on = GitlabSubscriptions::AddOnPurchase.find_by(add_on: GitlabSubscriptions::AddOn.code_suggestions.last)
|
55
|
-
|
56
|
+
def assign_duo_seat_to_admin
|
56
57
|
result = ::GitlabSubscriptions::UserAddOnAssignments::SelfManaged::CreateService.new(
|
57
|
-
add_on_purchase:
|
58
|
+
add_on_purchase: add_on_purchase, user: admin
|
58
59
|
).execute
|
59
60
|
|
60
61
|
if result.is_a?(ServiceResponse) && result[:status] == :success
|
@@ -70,7 +71,33 @@ class DuoProSetup
|
|
70
71
|
def enabled?(key, default: nil)
|
71
72
|
ENV.fetch(key, default) == 'true'
|
72
73
|
end
|
74
|
+
|
75
|
+
def find_add_on_purchase(add_on:)
|
76
|
+
GitlabSubscriptions::AddOnPurchase.find_by(add_on: add_on)
|
77
|
+
end
|
78
|
+
|
79
|
+
def duo_pro_add_on
|
80
|
+
find_add_on_purchase(add_on: GitlabSubscriptions::AddOn.code_suggestions.last)
|
81
|
+
end
|
82
|
+
|
83
|
+
def duo_enterprise_add_on
|
84
|
+
find_add_on_purchase(add_on: GitlabSubscriptions::AddOn.duo_enterprise.last)
|
85
|
+
end
|
86
|
+
|
87
|
+
def admin
|
88
|
+
User.find_by(username: 'root')
|
89
|
+
end
|
90
|
+
|
91
|
+
def add_on_purchase
|
92
|
+
if duo_enterprise_add_on.present?
|
93
|
+
puts 'Assigning Duo Enterprise seat to admin...'
|
94
|
+
duo_enterprise_add_on
|
95
|
+
else
|
96
|
+
puts 'Assigning Duo Pro seat to admin...'
|
97
|
+
duo_pro_add_on
|
98
|
+
end
|
99
|
+
end
|
73
100
|
end
|
74
101
|
end
|
75
102
|
|
76
|
-
|
103
|
+
GitlabDuoSetup.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: 14.
|
4
|
+
version: 14.17.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-
|
11
|
+
date: 2024-10-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: climate_control
|
@@ -502,7 +502,7 @@ files:
|
|
502
502
|
- support/manifests/suggested_reviewer/pubsub.yaml
|
503
503
|
- support/manifests/suggested_reviewer/recommender-bot.yaml
|
504
504
|
- support/manifests/suggested_reviewer/recommender.yaml
|
505
|
-
- support/setup/
|
505
|
+
- support/setup/gitlab_duo_setup.rb
|
506
506
|
- tls_certificates/authority/ca.crt
|
507
507
|
- tls_certificates/authority/ca.key
|
508
508
|
- tls_certificates/authority/ca.pem
|