gitlab-qa 14.16.0 → 14.17.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: b98b613be98b09d382003ce5a1bd4562bddf7a7e0216de30a76c0c264c51a973
4
- data.tar.gz: 808ee2237ccbcabe62430f504b99a1c39930e90ccaff107d7316ce8a7ee71f52
3
+ metadata.gz: 9a30b8f1d5f38d5c3b4a48d7b1395387b4cc854e5e2ec579d3591777b7131c84
4
+ data.tar.gz: 9da397c19c29ea43b5fce2b8ad441d09dbd203adfcb122aa7ac75cc707f65245
5
5
  SHA512:
6
- metadata.gz: edff13e29e9dc6cdda84b1cf8103676e5b74703a45fd6a7a77d34cc5b7f5b1fa836957e130806c263864c2ee659bb7f7cd9c9620e0f97c8c5cce0b756b7b2c60
7
- data.tar.gz: 45ef2a7609d5e2345a4ca25067cb722098fe0ec734b9ab18ebf5513bf1af45d87f0a755f91ae0c4b2e10329a809e72c25f81df2c293aaadcc5dc89c763c07f6d
6
+ metadata.gz: 1eba615ae509dc1425e85375e726604a160c05edd7c69e0bbe86d65ad7a638fdc8f062633463b442e77e6d11b4693d5c6e2738a97385b168108be1c18ac1187c
7
+ data.tar.gz: 3c4a0c7c9375199ff84c86c8d2d8a2d9b8eaf93094708ea7be80ad53f98a3ee8a46807364d13ad0a7b57c45f0e06d85087b23915d78549b4baf21f5a4a810044
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- gitlab-qa (14.16.0)
4
+ gitlab-qa (14.17.0)
5
5
  activesupport (>= 6.1, < 7.2)
6
6
  gitlab (~> 4.19)
7
7
  http (~> 5.0)
@@ -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 + Duo Pro add-on, and a seat is assigned to the admin user
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
 
@@ -28,7 +28,7 @@ module Gitlab
28
28
 
29
29
  ai_gateway.instance do
30
30
  gitlab.instance do
31
- set_up_duo_pro(gitlab) if @use_cloud_license
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 set_up_duo_pro(gitlab)
59
- Runtime::Logger.info('Setting up Duo Pro on GitLab instance')
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}/duo_pro_setup.rb",
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
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Gitlab
4
4
  module QA
5
- VERSION = '14.16.0'
5
+ VERSION = '14.17.0'
6
6
  end
7
7
  end
@@ -1,6 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- class DuoProSetup
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
- assign_duo_pro_seat_to_admin if enabled?('ASSIGN_SEATS')
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 (tokens = ::CloudConnector::ServiceAccessToken.active.count)&.positive? || attempts == max_attempts
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 tokens&.positive?
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 assign_duo_pro_seat_to_admin
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: add_on, user: admin
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
- DuoProSetup.configure!
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.16.0
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-09-26 00:00:00.000000000 Z
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/duo_pro_setup.rb
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