gitlab-qa 14.0.2 → 14.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 06cdfb404230f5d597a2ec654c113514737824c05c4d07076e13920514f6ee50
4
- data.tar.gz: 8ce3ef6d3d4409339365f6e5eea40b13c0e92bd956ece9817abbd915286c655c
3
+ metadata.gz: 8ff023809865275353e982f054758e26847e64a9e1f710a73700c87c16d43129
4
+ data.tar.gz: dd0797b89d5b161161890fb5f0648c960e4e5f15209a8dabffe57bcf982c95eb
5
5
  SHA512:
6
- metadata.gz: 46dbfd8867ba9a3cb19a0909a63973931a8050da8a3fdfb5fc83872385ce2c022cb742caa4c7c27740ecbe1c026529e01991c8d2bc89a6ef91cc592047b3b2a0
7
- data.tar.gz: 9f74fe0c15e67021261ec6941499b8f8a5f8c6da730fa150910442ce8c3a01a081aad08e0c580090353c5548795ac089fc8bab19104fe64af47ab198a71cfffb
6
+ metadata.gz: 810852861df35f09e0faccbca9d5ce89d78439a94d57a5bb53709f2efbac07b45ea75be8a1c9edf1fc2a552a539e81932d31016f62af042b68d3eb2552aa466b
7
+ data.tar.gz: 4b08122b7343ba7a62893cb88e8b1166476cc148af4a2b86b0168fcfbdf1cfb1dab493965ac11142768b9298c7b5a516b86f6d609f1785469f63cc6f23ed120e
data/.gitignore CHANGED
@@ -14,3 +14,5 @@
14
14
  .tool-versions
15
15
  # ignore built gems
16
16
  *.gem
17
+ .vscode/task.json
18
+ .vscode/
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- gitlab-qa (14.0.2)
4
+ gitlab-qa (14.2.0)
5
5
  activesupport (>= 6.1, < 7.2)
6
6
  gitlab (~> 4.19)
7
7
  http (~> 5.0)
@@ -188,10 +188,39 @@ module Gitlab
188
188
  )
189
189
  end
190
190
 
191
+ # Path of the log file to write to
192
+ # @note
193
+ # if an error occurs during #reconfigure,
194
+ # "retry-{n}" is prefixed to the file name where {n} is retry number
195
+ # @return [String] the path to the log file
196
+ def log_file
197
+ retries = 0
198
+ log_file = "#{Runtime::Env.host_artifacts_dir}/#{name}-reconfigure-logs.txt"
199
+ while File.exist?(log_file)
200
+ break unless File.exist?(log_file)
201
+
202
+ retries += 1
203
+ log_file = "#{Runtime::Env.host_artifacts_dir}/#{name}-retry-#{retries}-reconfigure-logs.txt"
204
+ end
205
+
206
+ log_file
207
+ end
208
+
209
+ private :log_file
210
+
191
211
  def reconfigure
192
212
  setup_omnibus
193
-
213
+ log_file_path = log_file
214
+ config_file = File.open(log_file_path, "w")
194
215
  @docker.attach(name) do |line, _wait|
216
+ config_file.write(line, mode: 'a')
217
+
218
+ if line.include?('There was an error running gitlab-ctl reconfigure')
219
+ Runtime::Logger.error(
220
+ "Failure while running gitlab-ctl reconfigure command. Please check the #{log_file_path} in the artefact for more info"
221
+ )
222
+ end
223
+
195
224
  # TODO, workaround which allows to detach from the container
196
225
  break if line.include?('gitlab Reconfigured!')
197
226
  end
@@ -53,12 +53,17 @@ module Gitlab
53
53
  def update(rspec_args)
54
54
  Docker::Volumes.new.with_temporary_volumes do |volumes|
55
55
  # deploy first release in upgrade path and run specs to populate db
56
+ Runtime::Logger.info("Running the first release in upgrade path: #{upgrade_path.first}")
56
57
  run_gitlab(upgrade_path.first, volumes, ["--", "--tag", "smoke"])
57
58
 
58
59
  # deploy releases in upgrade path
59
- upgrade_path[1..].each { |release| run_gitlab(release, volumes, skip_setup: true) }
60
+ upgrade_path[1..].each do |release|
61
+ Runtime::Logger.info("Upgrading GitLab to release: #{release}")
62
+ run_gitlab(release, volumes, skip_setup: true)
63
+ end
60
64
 
61
65
  # deploy current release and run tests
66
+ Runtime::Logger.info("Upgrading GitLab to current release: #{current_release}")
62
67
  run_gitlab(current_release, volumes, rspec_args, skip_setup: true)
63
68
  end
64
69
  end
@@ -94,7 +99,10 @@ module Gitlab
94
99
  # @param [Gitlab::QA::Release] release
95
100
  # @param [Array] rspec_args
96
101
  # @return [void]
97
- def run_specs(gitlab, release, rspec_args)
102
+ def run_specs(gitlab, release, rspec_args) # rubocop:disable Metrics/AbcSize
103
+ Runtime::Logger.info("Running smoke test to verify update and seed data in environment") unless upgrade_path.first != release
104
+ Runtime::Logger.info("Running smoke test to verify update") unless current_release != release
105
+
98
106
  Component::Specs.perform do |specs|
99
107
  specs.release = release
100
108
  specs.suite = 'Test::Instance::All'
@@ -105,7 +113,10 @@ module Gitlab
105
113
  specs.env = { 'QA_GENERATE_ALLURE_REPORT' => false } unless release == current_release
106
114
  end
107
115
  rescue Support::ShellCommand::StatusError => e
108
- raise e if release == current_release # only fail on current release
116
+ if release == current_release # only fail on current release
117
+ Runtime::Logger.error("Failed to run test suite after final upgrade to release '#{release}'")
118
+ raise e
119
+ end
109
120
 
110
121
  Runtime::Logger.warn("Test run for release '#{gitlab.release}' finished with errors!")
111
122
  end
@@ -68,7 +68,7 @@ module Gitlab
68
68
  #
69
69
  # @return [void]
70
70
  def fail!
71
- logger.error("Shell command output:\n#{string_output}") unless stream_output
71
+ logger.error("Shell command output:\n#{string_output}") unless @command.include?("docker attach") || stream_output
72
72
  raise StatusError, "Command `#{mask_secrets(command).truncate(100)}` failed! " + "✘".red
73
73
  end
74
74
 
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Gitlab
4
4
  module QA
5
- VERSION = '14.0.2'
5
+ VERSION = '14.2.0'
6
6
  end
7
7
  end
@@ -3,26 +3,28 @@
3
3
  class CodeSuggestionsSetup
4
4
  class << self
5
5
  def configure!
6
- puts 'Enabling code_suggestions_tokens_api feature flag...'
7
- Feature.enable(:code_suggestions_tokens_api)
8
-
9
6
  activate_cloud_license
10
7
 
11
8
  # Due to the various async Sidekiq processes involved, we wait to verify
12
9
  # that the code suggestions access token has been generated before proceeding
13
10
  verify_code_suggestions_access_token
14
11
 
12
+ # TODO: Remove after service start date
13
+ # This toggle will no longer be used to control access to code suggestions
14
+ # See https://gitlab.com/gitlab-org/gitlab/blob/master/ee/app/policies/ee/global_policy.rb#L62
15
15
  puts 'Enabling application setting instance_level_code_suggestions_enabled...'
16
16
  ApplicationSetting.last.update(instance_level_code_suggestions_enabled: true)
17
+
18
+ assign_code_suggestions_seat_to_admin
17
19
  end
18
20
 
19
21
  private
20
22
 
21
23
  def activate_cloud_license
22
24
  puts 'Activating cloud license...'
23
- activation_result = ::GitlabSubscriptions::ActivateService.new.execute(ENV.fetch('QA_EE_ACTIVATION_CODE', nil))
25
+ result = ::GitlabSubscriptions::ActivateService.new.execute(ENV.fetch('QA_EE_ACTIVATION_CODE', nil))
24
26
 
25
- if activation_result[:success]
27
+ if result[:success]
26
28
  puts 'Cloud license activation successful'
27
29
  else
28
30
  puts 'Cloud license activation failed!'
@@ -48,6 +50,26 @@ class CodeSuggestionsSetup
48
50
  puts "Failed to create code suggestions access token after #{max_attempts} attempts"
49
51
  exit 1
50
52
  end
53
+
54
+ def assign_code_suggestions_seat_to_admin
55
+ puts 'Assigning code suggestions seat to admin...'
56
+
57
+ admin = User.find_by(username: 'root')
58
+ add_on = GitlabSubscriptions::AddOnPurchase.find_by(add_on: GitlabSubscriptions::AddOn.code_suggestions.last)
59
+
60
+ result = ::GitlabSubscriptions::UserAddOnAssignments::SelfManaged::CreateService.new(
61
+ add_on_purchase: add_on, user: admin
62
+ ).execute
63
+
64
+ if result.is_a?(ServiceResponse) && result[:status] == :success
65
+ puts 'Seat assignment for admin successful'
66
+ else
67
+ puts 'Seat assignment for admin failed!'
68
+
69
+ error = result.is_a?(ServiceResponse) ? result[:message] : result
70
+ puts error
71
+ end
72
+ end
51
73
  end
52
74
  end
53
75
 
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.0.2
4
+ version: 14.2.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-02-02 00:00:00.000000000 Z
11
+ date: 2024-02-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: climate_control