gitlab-qa 12.2.0 → 12.3.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: 3bc6e7f6460f83e7480215fa4b9c99738237ee4e300af3ea3ae2817cc9f734f6
4
- data.tar.gz: 0535dfb574921a9dd757ef2d628380827f856165c6921fbbfd79458a92e36ae1
3
+ metadata.gz: 0e4cc0696035cf54be7b10e0153ffb42d59a5da480b4f87b8e313fc19ac50d96
4
+ data.tar.gz: d773ed2ef468d85328eee38811f03738c97cb8b6679a1e65d6c22d3a91a76936
5
5
  SHA512:
6
- metadata.gz: d6550c937cdf6c29884168e3aff9f75baaecc1e8919054a49807435f08cdb68fdbab42fb2061fe125228be2be7932cc534a303e831e023967e187add5ec53255
7
- data.tar.gz: e6f34c0cbba1f8b35b0ad96cb92fd43234aec4931eae947ad95378f5b8c5d58c9fdaf689acd16a8968eb24c5b2a8cc86a30ca744ee2a0c7166623b51b8fe18c2
6
+ metadata.gz: eef1ff7b5b65693659df80f4bfb78891238b07a0bdba06d1348d068c780bf52cd6f2b65faf753a700511f0fb28a4bfe2cc6dead51cc8873933bc5fa420445fe3
7
+ data.tar.gz: bb30bec072843a3939966e1beda00b2468f85f4bf201cd32c4f8d80c42824440d24884f86447b885d687fd627b75f7cf93d74cf20c778ada16986a5c51282d92
data/.gitlab-ci.yml CHANGED
@@ -34,7 +34,7 @@ workflow:
34
34
  # For merge requests, create a pipeline.
35
35
  - if: '$CI_MERGE_REQUEST_IID'
36
36
  # For the default branch, create a pipeline (this includes on schedules, pushes, merges, etc.).
37
- - if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'
37
+ - if: '$CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH || $CI_COMMIT_REF_NAME =~ /^[\d-]+-stable$/'
38
38
  # For tags, create a pipeline.
39
39
  - if: '$CI_COMMIT_TAG'
40
40
  # When using Run pipeline button in the GitLab UI, from the project’s CI/CD > Pipelines section, create a pipeline.
@@ -47,6 +47,12 @@ variables:
47
47
  BUNDLE_SILENCE_ROOT_WARNING: "true"
48
48
  BUNDLE_SUPPRESS_INSTALL_USING_MESSAGES: "true"
49
49
 
50
+ # Override rules to allow creating backport releases
51
+ .release-base:
52
+ rules:
53
+ - if: '$CI_PIPELINE_SOURCE == "push" && ($CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH || $CI_COMMIT_REF_NAME =~ /^[\d-]+-stable$/)'
54
+ changes: ["lib/**/version.rb"]
55
+
50
56
  package-and-test-env:
51
57
  image: ${CI_DEPENDENCY_PROXY_GROUP_IMAGE_PREFIX}/alpine:latest
52
58
  stage: .pre
@@ -135,7 +141,6 @@ package-and-test:
135
141
  variables:
136
142
  - RUBY_VERSION
137
143
  - DEBIAN_VERSION
138
- when: manual
139
144
  trigger:
140
145
  strategy: depend
141
146
  forward:
@@ -145,3 +150,8 @@ package-and-test:
145
150
  - project: gitlab-org/gitlab
146
151
  ref: master
147
152
  file: .gitlab/ci/package-and-test/main.gitlab-ci.yml
153
+ rules:
154
+ - if: '$CI_MERGE_REQUEST_IID'
155
+ when: manual
156
+ allow_failure: true
157
+ - when: always
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- gitlab-qa (12.2.0)
4
+ gitlab-qa (12.3.0)
5
5
  activesupport (>= 6.1, < 7.1)
6
6
  gitlab (~> 4.19)
7
7
  http (~> 5.0)
@@ -24,6 +24,7 @@ GEM
24
24
  ast (2.4.2)
25
25
  backport (1.2.0)
26
26
  benchmark (0.2.0)
27
+ byebug (11.1.3)
27
28
  claide (1.1.0)
28
29
  claide-plugins (0.9.2)
29
30
  cork
@@ -149,6 +150,9 @@ GEM
149
150
  pry (0.14.1)
150
151
  coderay (~> 1.1)
151
152
  method_source (~> 1.0)
153
+ pry-byebug (3.10.1)
154
+ byebug (~> 11.0)
155
+ pry (>= 0.13, < 0.15)
152
156
  public_suffix (5.0.0)
153
157
  racc (1.6.0)
154
158
  rack (3.0.7)
@@ -263,6 +267,7 @@ DEPENDENCIES
263
267
  gitlab-styles (~> 10)
264
268
  lefthook (~> 1.2.6)
265
269
  pry (~> 0.11)
270
+ pry-byebug (~> 3.10.1)
266
271
  rake (~> 13.0)
267
272
  rspec (~> 3.7)
268
273
  simplecov (~> 0.22)
data/gitlab-qa.gemspec CHANGED
@@ -27,6 +27,7 @@ Gem::Specification.new do |spec|
27
27
  spec.add_development_dependency 'gitlab-styles', '~> 10'
28
28
  spec.add_development_dependency 'lefthook', '~> 1.2.6'
29
29
  spec.add_development_dependency 'pry', '~> 0.11'
30
+ spec.add_development_dependency 'pry-byebug', '~> 3.10.1'
30
31
  spec.add_development_dependency 'rake', '~> 13.0'
31
32
  spec.add_development_dependency 'rspec', '~> 3.7'
32
33
  spec.add_development_dependency 'simplecov', '~> 0.22'
@@ -85,6 +85,7 @@ module Gitlab
85
85
  'KNAPSACK_REPORT_PATH' => :knapsack_report_path,
86
86
  'KNAPSACK_TEST_FILE_PATTERN' => :knapsack_test_file_pattern,
87
87
  'KNAPSACK_TEST_DIR' => :knapsack_test_dir,
88
+ 'NO_KNAPSACK' => :no_knapsack,
88
89
  'QA_KNAPSACK_REPORT_GCS_CREDENTIALS' => :qa_knapsack_report_gcs_credentials,
89
90
  'QA_KNAPSACK_REPORT_PATH' => :qa_knapsack_report_path,
90
91
  'QA_RSPEC_REPORT_PATH' => :qa_rspec_report_path,
@@ -53,28 +53,134 @@ module Gitlab
53
53
  # NOT gitlab_rails['packages_enabled']=true
54
54
 
55
55
  v.nil? ? k.strip : "#{k.strip} = #{v.strip.tr('"', "'")}".strip
56
- end.uniq
56
+ end
57
57
 
58
- errors = []
58
+ sanitized = split_items(sanitized).uniq
59
+
60
+ sanitized = merge_arrays(sanitized)
59
61
 
60
62
  # check for duplicates
61
63
  duplicate_keys = []
62
64
  duplicates = sanitized.reject do |n|
63
65
  key = n.split('=').first
66
+
64
67
  duplicate_keys << key unless duplicate_keys.include?(key)
65
68
  end
66
69
 
70
+ errors = []
67
71
  duplicates.each { |duplicate| errors << "Duplicate entry found: `#{duplicate}`" }
68
72
 
69
73
  raise "Errors exist within the Omnibus Configuration!\n#{errors.join(',')}" if errors.any?
70
74
 
71
75
  @config = sanitized
72
76
  end
77
+
73
78
  # rubocop:enable Metrics/AbcSize
74
79
 
75
80
  def <<(config)
76
81
  @config << config.strip unless config.strip.empty?
77
82
  end
83
+
84
+ private
85
+
86
+ # Merge Omnibus configuration values if the value is an array
87
+ # @example
88
+ # array = ['a["setting"] = [1]', 'a["setting"] = [2]']
89
+ # merge_arrays(array) #=> ['a["setting"] = [1, 2]']
90
+ #
91
+ # @param [Array] arr
92
+ #
93
+ # @return [Array]
94
+ def merge_arrays(arr)
95
+ entries_with_array = {}
96
+
97
+ arr.reject! do |item|
98
+ key, value = item.split("=", 2)
99
+
100
+ array_content_match = value&.match(/^\s?\[([\s\S]+)\][\s;]?$/)
101
+
102
+ if array_content_match
103
+ if entries_with_array[key]
104
+ entries_with_array[key] << array_content_match[1]
105
+ else
106
+ entries_with_array[key] = [array_content_match[1]]
107
+ end
108
+ end
109
+ end
110
+
111
+ entries_with_array.each do |k, v|
112
+ arr << "#{k}= [#{v.map(&:chomp).join(', ')}]".strip
113
+ end
114
+
115
+ arr
116
+ end
117
+
118
+ # Split each Omnibus setting into an array item
119
+ # @example
120
+ # input = ["a['setting_1'] = true",
121
+ # "a['setting_2'] = [
122
+ # {
123
+ # name: 'setting_2a_name'
124
+ # }
125
+ # ]
126
+ # a['setting_3'] = false"]
127
+ #
128
+ # split_items(input) #=>
129
+ # ["a['setting_1'] = true",
130
+ # "a['setting_2'] = [
131
+ # {
132
+ # name: 'setting_2a_name'
133
+ # }
134
+ # ]",
135
+ # "a['setting_3'] = false"]
136
+ #
137
+ # @param [Array] input
138
+ #
139
+ # @return [Array]
140
+ #
141
+ # rubocop:disable Metrics/AbcSize
142
+ def split_items(input)
143
+ items = []
144
+
145
+ input.each do |item|
146
+ if count_occurrences(item, ' = ') > 1
147
+ multi_line_item = []
148
+ item.split("\n").each do |line|
149
+ if /( = |external_url)/.match?(line)
150
+
151
+ if multi_line_item.count > 1
152
+ items.pop
153
+ items << multi_line_item.join("\n")
154
+ end
155
+
156
+ items << line
157
+ multi_line_item = [line]
158
+ else
159
+ multi_line_item << line
160
+ end
161
+ end
162
+
163
+ if multi_line_item.count > 1
164
+ items.pop
165
+ items << multi_line_item.join("\n")
166
+ end
167
+ else
168
+ items << item
169
+ end
170
+ end
171
+
172
+ items
173
+ end
174
+ # rubocop:enable Metrics/AbcSize
175
+
176
+ # Count occurrences of a substring in a string
177
+ # @param [String] str
178
+ # @param [String] substr
179
+ #
180
+ # @return [Array]
181
+ def count_occurrences(str, substr)
182
+ str.scan(/(?=#{substr})/).count
183
+ end
78
184
  end
79
185
  end
80
186
  end
@@ -47,6 +47,10 @@ module Gitlab
47
47
 
48
48
  private
49
49
 
50
+ MAX_TAGS_HTTP_REQUESTS = 50
51
+ # https://docs.docker.com/docker-hub/api/latest/#tag/images/operation/GetNamespacesRepositoriesImages
52
+ TAGS_PER_PAGE = 100
53
+
50
54
  attr_reader :current_version, :edition, :logger
51
55
 
52
56
  # Current versions major version
@@ -158,22 +162,40 @@ module Gitlab
158
162
  def tags
159
163
  return @tags if defined?(@tags)
160
164
 
161
- logger.info("Fetching docker tags from 'gitlab/gitlab-#{edition}' registry")
165
+ MAX_TAGS_HTTP_REQUESTS.times do |index|
166
+ tag_list, more_data = fetch_tags(page: index + 1)
167
+
168
+ if tag_list
169
+ @tags = Array(@tags)
170
+ @tags += tag_list
171
+ end
172
+
173
+ break if tag_list.nil? || more_data.nil?
174
+ end
175
+
176
+ @tags
177
+ end
178
+
179
+ def fetch_tags(page:, per_page: TAGS_PER_PAGE)
180
+ logger.info("Fetching Docker tags page #{page} from 'gitlab/gitlab-#{edition}' registry")
162
181
  response = HttpRequest.make_http_request(
163
- url: "https://registry.hub.docker.com/v2/namespaces/gitlab/repositories/gitlab-#{edition}/tags?page_size=1000",
182
+ url: "https://registry.hub.docker.com/v2/namespaces/gitlab/repositories/gitlab-#{edition}/tags?page=#{page}&page_size=#{per_page}",
164
183
  fail_on_error: false
165
184
  )
166
185
 
167
186
  unless response.code == 200
168
187
  logger.error(" failed to fetch docker tags - code: #{response.code}, response: '#{response.body}'")
169
- return @tags = nil
188
+ return nil
170
189
  end
171
190
 
172
- @tags = JSON
173
- .parse(response.body, symbolize_names: true)
191
+ response = JSON.parse(response.body, symbolize_names: true)
192
+ matching_tags = response
174
193
  .fetch(:results)
175
194
  .map { |tag| tag[:name] }
176
195
  .grep(VERSION_PATTERN)
196
+ more_data = response.fetch(:next)
197
+
198
+ [matching_tags, more_data]
177
199
  end
178
200
  end
179
201
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Gitlab
4
4
  module QA
5
- VERSION = '12.2.0'
5
+ VERSION = '12.3.0'
6
6
  end
7
7
  end
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: 12.2.0
4
+ version: 12.3.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: 2023-07-20 00:00:00.000000000 Z
11
+ date: 2023-08-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: climate_control
@@ -80,6 +80,20 @@ dependencies:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0.11'
83
+ - !ruby/object:Gem::Dependency
84
+ name: pry-byebug
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: 3.10.1
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: 3.10.1
83
97
  - !ruby/object:Gem::Dependency
84
98
  name: rake
85
99
  requirement: !ruby/object:Gem::Requirement