1
1
require 'omnibus'
2
- require 'net/http'
3
- require 'json'
4
2
5
3
require_relative '../build_iteration'
6
4
require_relative "../util.rb"
@@ -236,15 +234,6 @@ def log_level
236
234
end
237
235
end
238
236
239
- # Fetch the package from an S3 bucket
240
- def deb_package_download_url ( arch : 'amd64' )
241
- folder = 'ubuntu-jammy'
242
- folder = "#{ folder } _aarch64" if arch == 'arm64'
243
-
244
- package_filename_url_safe = Info . release_version . gsub ( "+" , "%2B" )
245
- "https://#{ Info . release_bucket } .#{ Info . release_bucket_s3_endpoint } /#{ folder } /#{ Info . package } _#{ package_filename_url_safe } _#{ arch } .deb"
246
- end
247
-
248
237
# Fetch the package used in AWS AMIs from an S3 bucket
249
238
def ami_deb_package_download_url ( arch : 'amd64' )
250
239
folder = 'ubuntu-focal'
@@ -254,53 +243,6 @@ def ami_deb_package_download_url(arch: 'amd64')
254
243
"https://#{ Info . release_bucket } .#{ Info . release_bucket_s3_endpoint } /#{ folder } /#{ Info . package } _#{ package_filename_url_safe } _#{ arch } .deb"
255
244
end
256
245
257
- def rpm_package_download_url ( arch : 'x86_64' )
258
- folder = 'el-8'
259
- folder = "#{ folder } _aarch64" if arch == 'arm64'
260
- folder = "#{ folder } _fips" if Build ::Check . use_system_ssl?
261
-
262
- package_filename_url_safe = Info . release_version . gsub ( "+" , "%2B" )
263
- "https://#{ Info . release_bucket } .#{ Info . release_bucket_s3_endpoint } /#{ folder } /#{ Info . package } -#{ package_filename_url_safe } .el8.#{ arch } .rpm"
264
- end
265
-
266
- def get_api ( path , token : nil )
267
- uri = URI ( "https://gitlab.com/api/v4/#{ path } " )
268
- req = Net ::HTTP ::Get . new ( uri )
269
- req [ 'PRIVATE-TOKEN' ] = token || Gitlab ::Util . get_env ( 'TRIGGER_PRIVATE_TOKEN' )
270
- http = Net ::HTTP . new ( uri . hostname , uri . port )
271
- http . use_ssl = true
272
- res = http . request ( req )
273
- JSON . parse ( res . body ) if res . code == '200'
274
- end
275
-
276
- def fetch_artifact_url ( project_id , pipeline_id , fips : Build ::Check . use_system_ssl? )
277
- job_name = 'Trigger:package'
278
- job_name = "#{ job_name } :fips" if fips
279
-
280
- output = get_api ( "projects/#{ project_id } /pipelines/#{ pipeline_id } /jobs" ) || { }
281
- output . map { |job | job [ 'id' ] if job [ 'name' ] == job_name } . compact . max
282
- end
283
-
284
- def fetch_pipeline_jobs ( project_id , pipeline_id , token )
285
- get_api ( "projects/#{ project_id } /pipelines/#{ pipeline_id } /jobs" )
286
- end
287
-
288
- def triggered_build_package_url ( fips : Build ::Check . use_system_ssl? )
289
- project_id = Gitlab ::Util . get_env ( 'CI_PROJECT_ID' )
290
- pipeline_id = Gitlab ::Util . get_env ( 'CI_PIPELINE_ID' )
291
- return unless project_id && !project_id . empty? && pipeline_id && !pipeline_id . empty?
292
-
293
- id = fetch_artifact_url ( project_id , pipeline_id , fips : fips )
294
-
295
- return unless id
296
-
297
- # Ubuntu 22.04 is still not FIPS compliant, so we use 20.04 packages
298
- # there.
299
- folder = fips ? 'ubuntu-focal_fips' : 'ubuntu-jammy'
300
-
301
- "https://gitlab.com/api/v4/projects/#{ Gitlab ::Util . get_env ( 'CI_PROJECT_ID' ) } /jobs/#{ id } /artifacts/pkg/#{ folder } /gitlab.deb"
302
- end
303
-
304
246
def tag_match_pattern
305
247
return '*[+.]ee.*' if Check . is_ee?
306
248
0 commit comments