packaging 0.105.0 → 0.106.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (66) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +4 -4
  3. data/lib/packaging/archive.rb +2 -2
  4. data/lib/packaging/artifactory/extensions.rb +1 -0
  5. data/lib/packaging/artifactory.rb +27 -23
  6. data/lib/packaging/config/params.rb +191 -199
  7. data/lib/packaging/config/validations.rb +0 -2
  8. data/lib/packaging/config.rb +8 -8
  9. data/lib/packaging/deb/repo.rb +11 -14
  10. data/lib/packaging/gem.rb +2 -2
  11. data/lib/packaging/metrics.rb +7 -7
  12. data/lib/packaging/nuget.rb +0 -1
  13. data/lib/packaging/paths.rb +11 -13
  14. data/lib/packaging/platforms.rb +10 -6
  15. data/lib/packaging/repo.rb +11 -12
  16. data/lib/packaging/retrieve.rb +1 -1
  17. data/lib/packaging/rpm/repo.rb +8 -8
  18. data/lib/packaging/sign/dmg.rb +8 -7
  19. data/lib/packaging/sign/ips.rb +64 -32
  20. data/lib/packaging/sign/msi.rb +84 -112
  21. data/lib/packaging/sign/rpm.rb +1 -1
  22. data/lib/packaging/sign.rb +0 -1
  23. data/lib/packaging/tar.rb +2 -4
  24. data/lib/packaging/util/date.rb +0 -1
  25. data/lib/packaging/util/distribution_server.rb +2 -2
  26. data/lib/packaging/util/execution.rb +2 -4
  27. data/lib/packaging/util/file.rb +2 -3
  28. data/lib/packaging/util/git.rb +1 -3
  29. data/lib/packaging/util/git_tags.rb +3 -3
  30. data/lib/packaging/util/gpg.rb +3 -4
  31. data/lib/packaging/util/jenkins.rb +0 -3
  32. data/lib/packaging/util/misc.rb +1 -1
  33. data/lib/packaging/util/net.rb +26 -22
  34. data/lib/packaging/util/repo.rb +0 -1
  35. data/lib/packaging/util/serialization.rb +1 -2
  36. data/lib/packaging/util/ship.rb +3 -3
  37. data/lib/packaging/util/sign.rb +8 -8
  38. data/lib/packaging/util/tool.rb +1 -4
  39. data/lib/packaging/util/version.rb +1 -5
  40. data/lib/packaging/util.rb +1 -1
  41. data/lib/packaging.rb +1 -2
  42. data/spec/lib/packaging/platforms_spec.rb +1 -1
  43. data/spec/lib/packaging/sign_spec.rb +1 -1
  44. data/spec/lib/packaging/util/git_spec.rb +2 -2
  45. data/spec/lib/packaging/util/git_tag_spec.rb +5 -5
  46. data/tasks/30_metrics.rake +2 -2
  47. data/tasks/apple.rake +8 -14
  48. data/tasks/archive.rake +1 -2
  49. data/tasks/deb.rake +7 -8
  50. data/tasks/doc.rake +5 -3
  51. data/tasks/education.rake +2 -4
  52. data/tasks/gem.rake +20 -12
  53. data/tasks/jenkins.rake +27 -15
  54. data/tasks/jenkins_dynamic.rake +10 -10
  55. data/tasks/mock.rake +8 -9
  56. data/tasks/nightly_repos.rake +14 -14
  57. data/tasks/pe_ship.rake +10 -17
  58. data/tasks/retrieve.rake +2 -2
  59. data/tasks/rpm.rake +1 -1
  60. data/tasks/ship.rake +23 -13
  61. data/tasks/sign.rake +5 -5
  62. data/tasks/tar.rake +2 -3
  63. data/tasks/update.rake +2 -2
  64. data/tasks/vendor_gems.rake +5 -7
  65. data/tasks/version.rake +2 -2
  66. metadata +62 -34
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 296bfdcecf936f80297894792d9b9a1bb3a83a422a61e4976aca3916dd6c9a2b
4
- data.tar.gz: 0c76c4482d82367cef9d988fc1e31080f718322e4eab1fe9a5176f4544c8a3ce
3
+ metadata.gz: 193d585363a1423508a90e96a1b3df94e8152e74c1dd72083f5b589b5b143501
4
+ data.tar.gz: 22492fe7cebbcda8a61742c5d1c1b88073d2b170a392c3f639ef01968a9ad456
5
5
  SHA512:
6
- metadata.gz: 071534bcce41eb8b11517d21592399a9f94c45b20a70259aa5a13c4bf3ec5bfd6cab5e517698e6f8884736a932a62d0212d945cb97ad549bdf8c80242f594f8e
7
- data.tar.gz: 532cca35cd6eeea218c8a6cdcdf00f0802f0c0ae33fc009f6f42bd7c39056f45b147abaf971879e2f5532541e1d08c0c6267425d32aa69dad9c11f036697c183
6
+ metadata.gz: edc24fcef7b4c1fcc6d63796628a094d3d1d299cc0d29b761af91146c11dfa8627af60b49ee368d15366b324f1d163af013796c6137ea5de08e035d3633811a4
7
+ data.tar.gz: 297b0577830caeef96526ee289d5d2c31da95237f3d57af53af8a650387a936e3ba1064c790bf1a9b9269f21b859a031f91e30ad49e43cd121d014e193d8123e
data/README.md CHANGED
@@ -433,18 +433,18 @@ build_doc: false
433
433
  build_msi:
434
434
  puppet_for_the_win:
435
435
  ref: 'origin/master'
436
- repo: 'git://github.com/puppetlabs/puppet_for_the_win.git'
436
+ repo: 'https://github.com/puppetlabs/puppet_for_the_win.git'
437
437
  facter:
438
438
  ref: 'refs/tags/2.1.0'
439
- repo: 'git://github.com/puppetlabs/facter.git'
439
+ repo: 'https://github.com/puppetlabs/facter.git'
440
440
  hiera:
441
441
  ref: 'refs/tags/1.3.4'
442
- repo: 'git://github.com/puppetlabs/hiera.git'
442
+ repo: 'https://github.com/puppetlabs/hiera.git'
443
443
  sys:
444
444
  ref:
445
445
  x86: 'origin/1.9.3-x86'
446
446
  x64: 'origin/2.0.0-x64'
447
- repo: 'git://github.com/puppetlabs/puppet-win32-ruby.git'
447
+ repo: 'https://github.com/puppetlabs/puppet-win32-ruby.git'
448
448
  # Whether to present the Solaris 11 IPS packaging tasks
449
449
  # This requires suitable IPS packaging artifacts in the project in ext/ips
450
450
  build_ips: false
@@ -3,12 +3,12 @@ module Pkg::Archive
3
3
 
4
4
  # Array of base paths for foss artifacts on weth
5
5
  def base_paths
6
- [Pkg::Config.yum_repo_path, Pkg::Config.apt_repo_staging_path, Pkg::Config.apt_repo_path, '/opt/downloads'].compact.freeze
6
+ [Pkg::Config.yum_repo_path, Pkg::Config.apt_repo_staging_path, Pkg::Config.apt_repo_path, '/opt/downloads'].compact
7
7
  end
8
8
 
9
9
  # Array of paths for temporarily staging artifacts before syncing to release-archives on s3
10
10
  def archive_paths
11
- [Pkg::Config.yum_archive_path, Pkg::Config.apt_archive_path, Pkg::Config.freight_archive_path, Pkg::Config.downloads_archive_path, '/opt/tmp-apt'].compact.freeze
11
+ [Pkg::Config.yum_archive_path, Pkg::Config.apt_archive_path, Pkg::Config.freight_archive_path, Pkg::Config.downloads_archive_path, '/opt/tmp-apt'].compact
12
12
  end
13
13
 
14
14
  # Move yum directories from repo path to archive staging path
@@ -46,6 +46,7 @@ module ArtifactoryExtensions
46
46
  unless repo_uri.include?('/api/storage/')
47
47
  # rubocop:disable Style/PercentLiteralDelimiters
48
48
  repo_uri.sub!(%r(/#{params[:repo]}$), "/api/storage/#{params[:repo]}")
49
+ # rubocop:enable Style/PercentLiteralDelimiters
49
50
  end
50
51
  response['files'].map do |file_path|
51
52
  from_url("#{repo_uri}/#{file_path}", client: client)
@@ -5,13 +5,11 @@ require 'digest'
5
5
  require 'packaging/artifactory/extensions'
6
6
 
7
7
  module Pkg
8
-
9
8
  # The Artifactory class
10
9
  # This class provides automation to access the artifactory repos maintained
11
10
  # by the Release Engineering team at Puppet. It has the ability to both push
12
11
  # artifacts to the repos, and to retrieve them back from the repos.
13
12
  class ManageArtifactory
14
-
15
13
  # The Artifactory property that the artifactCleanup user plugin
16
14
  # {https://github.com/jfrog/artifactory-user-plugins/tree/master/cleanup/artifactCleanup}
17
15
  # uses to tell it to not clean a particular artifact
@@ -233,8 +231,8 @@ module Pkg
233
231
  # @return [String] The contents of the YAML file
234
232
  def retrieve_yaml_data(pkg, ref)
235
233
  yaml_url = "#{@artifactory_uri}/#{DEFAULT_REPO_TYPE}/#{DEFAULT_REPO_BASE}/#{pkg}/#{ref}/#{ref}.yaml"
236
- open(yaml_url) { |f| f.read }
237
- rescue
234
+ URI.open(yaml_url, &:read)
235
+ rescue StandardError
238
236
  raise "Failed to load YAML data for #{pkg} at #{ref} from #{yaml_url}!"
239
237
  end
240
238
 
@@ -245,7 +243,7 @@ module Pkg
245
243
  # project_version, and platform_tag
246
244
  def package_name(platform_data, platform_tag)
247
245
  return File.basename(platform_data[platform_tag][:artifact])
248
- rescue
246
+ rescue StandardError
249
247
  fail_message = <<-DOC
250
248
  Package name could not be found from loaded yaml data. Either this package
251
249
  does not exist, or '#{platform_tag}' is not present in this dataset.
@@ -267,7 +265,7 @@ module Pkg
267
265
  packages.flatten!
268
266
  packages.reject! { |package| package.nil? || package.empty? }
269
267
  packages.map { |package| File.basename(package) }
270
- rescue
268
+ rescue StandardError
271
269
  fail_message = <<-DOC
272
270
  Package name could not be found from loaded yaml data. Either this package
273
271
  does not exist, or '#{platform_tag}' is not present in this dataset.
@@ -294,13 +292,14 @@ module Pkg
294
292
  def promote_package(pkg, ref, platform_tag, repository, debian_component = nil)
295
293
  # load package metadata
296
294
  yaml_content = retrieve_yaml_data(pkg, ref)
297
- yaml_data = YAML::load(yaml_content)
295
+ yaml_data = YAML::safe_load(yaml_content, [Symbol])
298
296
 
299
297
  # get the artifact name
300
298
  artifact_names = all_package_names(yaml_data[:platform_data], platform_tag)
301
299
  artifact_names.each do |artifact_name|
302
300
  artifact_search_results = Artifactory::Resource::Artifact.search(
303
- name: artifact_name, :artifactory_uri => @artifactory_uri)
301
+ name: artifact_name, :artifactory_uri => @artifactory_uri
302
+ )
304
303
 
305
304
  if artifact_search_results.empty?
306
305
  raise "Error: could not find PKG=#{pkg} at REF=#{ref} for #{platform_tag}"
@@ -332,10 +331,10 @@ module Pkg
332
331
  if e.message =~ /(destination and source are the same|user doesn't have permissions to override)/i
333
332
  puts "Skipping promotion of #{artifact_name}; it has already been promoted"
334
333
  else
335
- puts "#{e.message}"
334
+ puts e.message.to_s
336
335
  raise e
337
336
  end
338
- rescue => e
337
+ rescue StandardError => e
339
338
  puts "Something went wrong promoting #{artifact_name}!"
340
339
  raise e
341
340
  end
@@ -352,17 +351,21 @@ module Pkg
352
351
  # Used to specify which subdirectories packages will be downloaded from.
353
352
  def download_packages(staging_directory, manifest, remote_path = '')
354
353
  check_authorization
355
- download_repositories = %w(rpm_enterprise__local debian_enterprise__local)
354
+ download_repositories = %w[rpm_enterprise__local debian_enterprise__local]
356
355
  manifest.each do |dist, packages|
356
+ if packages.nil?
357
+ warn "Package list for #{dist} is empty, skipping"
358
+ next
359
+ end
357
360
  packages.each do |name, info|
358
361
  package_file_name = info['filename']
359
362
  puts format(
360
- "Searching Artifactory [%s]%s for %s (md5: %s)",
363
+ "Searching Artifactory [%s]%s for %s (md5: %s)",
361
364
  download_repositories.join(', '),
362
365
  remote_path.empty? ? '' : "/#{remote_path}",
363
366
  package_file_name,
364
367
  info['md5']
365
- )
368
+ )
366
369
  artifacts = Artifactory::Resource::Artifact.checksum_search(
367
370
  md5: info['md5'],
368
371
  repos: download_repositories,
@@ -418,14 +421,15 @@ module Pkg
418
421
  check_authorization
419
422
  ship_paths.each do |path|
420
423
  Dir.foreach(local_tarball_directory) do |pe_tarball|
421
- next if pe_tarball == '.' || pe_tarball == ".."
424
+ next if ['.', '..'].include?(pe_tarball)
422
425
  begin
423
426
  puts "Uploading #{pe_tarball} to #{target_repo}/#{path}#{pe_tarball}"
424
427
  artifact = Artifactory::Resource::Artifact.new(
425
- local_path: "#{local_tarball_directory}/#{pe_tarball}")
428
+ local_path: "#{local_tarball_directory}/#{pe_tarball}"
429
+ )
426
430
  artifact.upload(target_repo, "#{path}#{pe_tarball}")
427
431
  rescue Errno::EPIPE
428
- STDERR.puts "Warning: Could not upload #{pe_tarball} to #{target_repo}/#{path}. Skipping."
432
+ warn "Warning: Could not upload #{pe_tarball} to #{target_repo}/#{path}. Skipping."
429
433
  next
430
434
  end
431
435
  end
@@ -449,7 +453,7 @@ module Pkg
449
453
  begin
450
454
  puts "Uploading #{local_path} to #{target_repo}/#{full_upload_path} . . ."
451
455
  artifact.upload(target_repo, full_upload_path, properties, headers)
452
- rescue Artifactory::Error::HTTPError => e
456
+ rescue Artifactory::Error::HTTPError
453
457
  fail "Error: Upload failed. Ensure path #{target_path} exists in the #{target_repo} repository."
454
458
  end
455
459
  end
@@ -584,7 +588,7 @@ module Pkg
584
588
  begin
585
589
  artifact.copy(artifactory_target_path)
586
590
  rescue Artifactory::Error::HTTPError
587
- STDERR.puts "Could not copy #{artifactory_target_path}. Source and destination are the same. Skipping..."
591
+ warn "Could not copy #{artifactory_target_path}. Source and destination are the same. Skipping..."
588
592
  end
589
593
 
590
594
  if File.extname(filename) == '.deb'
@@ -606,9 +610,9 @@ module Pkg
606
610
  puts "Copying #{dist} packages..."
607
611
  packages.each do |name, info|
608
612
  filename = info["filename"]
609
- artifact = Artifactory::Resource::Artifact.checksum_search(md5: "#{info["md5"]}", repos: ["rpm_enterprise__local", "debian_enterprise__local"], name: filename).first
613
+ artifact = Artifactory::Resource::Artifact.checksum_search(md5: (info['md5']).to_s, repos: ["rpm_enterprise__local", "debian_enterprise__local"], name: filename).first
610
614
  if artifact.nil?
611
- raise "Error: what the hell, could not find package #{filename} with md5sum #{info["md5"]}"
615
+ raise "Error: what the hell, could not find package #{filename} with md5sum #{info['md5']}"
612
616
  end
613
617
  copy_artifact(artifact, artifact.repo, "#{target_path}/#{dist}/#{filename}")
614
618
  end
@@ -640,7 +644,7 @@ module Pkg
640
644
  packages.each do |package_name, info|
641
645
  next unless package_name == package
642
646
  filename = info["filename"]
643
- artifacts = Artifactory::Resource::Artifact.checksum_search(md5: "#{info["md5"]}", repos: repos, name: filename)
647
+ artifacts = Artifactory::Resource::Artifact.checksum_search(md5: (info['md5']).to_s, repos: repos, name: filename)
644
648
  artifacts.each do |artifact|
645
649
  next unless artifact.download_uri.include? remote_path
646
650
  puts "Removing reverted package #{artifact.download_uri}"
@@ -658,7 +662,7 @@ module Pkg
658
662
  def purge_copied_pe_tarballs(tarball_path, pe_repo)
659
663
  check_authorization
660
664
  Dir.foreach("#{tarball_path}/") do |pe_tarball|
661
- next if pe_tarball == '.' || pe_tarball == ".."
665
+ next if ['.', '..'].include?(pe_tarball)
662
666
  md5 = Digest::MD5.file("#{tarball_path}/#{pe_tarball}").hexdigest
663
667
  artifacts_to_delete = Artifactory::Resource::Artifact.checksum_search(md5: md5, repos: pe_repo, name: pe_tarball)
664
668
  next if artifacts_to_delete.nil?
@@ -668,7 +672,7 @@ module Pkg
668
672
  artifact.delete
669
673
  end
670
674
  rescue Artifactory::Error::HTTPError
671
- STDERR.puts "Error: cannot remove #{pe_tarball}, do you have the right permissions?"
675
+ warn "Error: cannot remove #{pe_tarball}, do you have the right permissions?"
672
676
  end
673
677
  end
674
678
  end