packaging 0.106.0 → 0.106.1

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.
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 -193
  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 +48 -48
  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 +25 -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 +6 -6
  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 +42 -42
@@ -87,7 +87,7 @@ module Pkg::Util::Ship
87
87
  puts "Do you want to ship the above files to (#{staging_server})?"
88
88
  return false unless Pkg::Util.ask_yes_or_no
89
89
 
90
- extra_flags = %w(--ignore-existing --delay-updates)
90
+ extra_flags = %w[--ignore-existing --delay-updates]
91
91
  extra_flags << '--dry-run' if ENV['DRYRUN']
92
92
 
93
93
  staged_pkgs.each do |pkg|
@@ -330,7 +330,7 @@ module Pkg::Util::Ship
330
330
  def test_ship(vm, ship_task)
331
331
  command = 'getent group release || groupadd release'
332
332
  Pkg::Util::Net.remote_execute(vm, command)
333
- hosts_to_override = %w(
333
+ hosts_to_override = %w[
334
334
  APT_HOST
335
335
  DMG_HOST
336
336
  GEM_HOST
@@ -349,7 +349,7 @@ module Pkg::Util::Ship
349
349
  TAR_STAGING_SERVER
350
350
  YUM_STAGING_SERVER
351
351
  STAGING_SERVER
352
- )
352
+ ]
353
353
  hosts_to_override.each do |host|
354
354
  ENV[host] = vm
355
355
  end
@@ -20,7 +20,7 @@ module Pkg::Util::Sign
20
20
  # containing a git bundle to be used as the environment for the packaging
21
21
  # repo in a signing operation.
22
22
  signing_bundle = ENV['SIGNING_BUNDLE']
23
- sign_tasks = ["pl:sign_rpms"]
23
+ sign_tasks = ["pl:sign_rpms"]
24
24
  sign_tasks << "pl:sign_deb_changes" unless Dir["#{root_directory}/**/*.changes"].empty?
25
25
  sign_tasks << "pl:sign_tar" if Pkg::Config.build_tar
26
26
  sign_tasks << "pl:sign_gem" if Pkg::Config.build_gem
@@ -29,14 +29,14 @@ module Pkg::Util::Sign
29
29
  sign_tasks << "pl:sign_svr4" if Pkg::Config.vanagon_project
30
30
  sign_tasks << "pl:sign_ips" if Pkg::Config.vanagon_project
31
31
  sign_tasks << "pl:sign_msi" if Pkg::Config.build_msi || Pkg::Config.vanagon_project
32
- remote_repo = Pkg::Util::Net.remote_unpack_git_bundle(Pkg::Config.signing_server, 'HEAD', nil, signing_bundle)
33
- build_params = Pkg::Util::Net.remote_buildparams(Pkg::Config.signing_server, Pkg::Config)
32
+ remote_repo = Pkg::Util::Net.remote_unpack_git_bundle(Pkg::Config.signing_server, 'HEAD', nil, signing_bundle)
33
+ build_params = Pkg::Util::Net.remote_buildparams(Pkg::Config.signing_server, Pkg::Config)
34
34
  Pkg::Util::Net.rsync_to(root_directory, Pkg::Config.signing_server, remote_repo)
35
- rake_command = <<-DOC
36
- cd #{remote_repo} ;
37
- #{Pkg::Util::Net.remote_bundle_install_command}
38
- bundle exec rake #{sign_tasks.map { |task| task + "[#{root_directory}]" }.join(" ")} PARAMS_FILE=#{build_params}
39
- DOC
35
+ rake_command = <<~DOC
36
+ cd #{remote_repo} ;
37
+ #{Pkg::Util::Net.remote_bundle_install_command}
38
+ bundle exec rake #{sign_tasks.map { |task| task + "[#{root_directory}]" }.join(' ')} PARAMS_FILE=#{build_params}
39
+ DOC
40
40
  Pkg::Util::Net.remote_execute(Pkg::Config.signing_server, rake_command)
41
41
  Pkg::Util::Net.rsync_from("#{remote_repo}/#{root_directory}/", Pkg::Config.signing_server, "#{root_directory}/")
42
42
  Pkg::Util::Net.remote_execute(Pkg::Config.signing_server, "rm -rf #{remote_repo}")
@@ -1,7 +1,6 @@
1
1
  # Utility methods for handling system binaries
2
2
 
3
3
  module Pkg::Util::Tool
4
-
5
4
  # Set up utility methods for handling system binaries
6
5
  #
7
6
  class << self
@@ -15,7 +14,7 @@ module Pkg::Util::Tool
15
14
 
16
15
  if Pkg::Util::OS.windows? && File.extname(location).empty?
17
16
  exts = ENV['PATHEXT']
18
- exts = exts ? exts.split(File::PATH_SEPARATOR) : %w(.EXE .BAT .CMD .COM)
17
+ exts = exts ? exts.split(File::PATH_SEPARATOR) : %w[.EXE .BAT .CMD .COM]
19
18
  exts.each do |ext|
20
19
  locationext = File.expand_path(location + ext)
21
20
 
@@ -30,12 +29,10 @@ module Pkg::Util::Tool
30
29
  end
31
30
 
32
31
  alias :has_tool :find_tool
33
-
34
32
  end
35
33
 
36
34
  # Set up paths to system tools we use in the packaging repo
37
35
  # no matter what distribution we're packaging for.
38
36
 
39
37
  GIT = Pkg::Util::Tool.check_tool('git')
40
-
41
38
  end
@@ -80,7 +80,6 @@ module Pkg::Util::Version
80
80
  # 5.3.0.rc4-1
81
81
  # 3.0.5.rc6.24.g431768c-1
82
82
  #
83
- # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
84
83
  def base_pkg_version(version = Pkg::Config.version)
85
84
  return "#{dot_version(version)}-#{Pkg::Config.release}".split('-') if final?(version) || Pkg::Config.vanagon_project
86
85
 
@@ -142,9 +141,6 @@ module Pkg::Util::Version
142
141
  # If you invoke this the version will only be modified in the temporary copy,
143
142
  # with the intent that it never change the official source tree.
144
143
  #
145
- # rubocop:disable Metrics/AbcSize
146
- # rubocop:disable Metrics/CyclomaticComplexity
147
- # rubocop:disable Metrics/PerceivedComplexity
148
144
  def versionbump(workdir = nil)
149
145
  version = ENV['VERSION'] || Pkg::Config.version.to_s.strip
150
146
  new_version = '"' + version + '"'
@@ -182,7 +178,7 @@ module Pkg::Util::Version
182
178
  # input json file and output if it "looks tagged" or not
183
179
  #
184
180
  # @param json_data [hash] json data hash containing the ref to check
185
- def report_json_tags(json_data) # rubocop:disable Metrics/AbcSize
181
+ def report_json_tags(json_data)
186
182
  puts 'component: ' + File.basename(json_data['url'])
187
183
  puts 'ref: ' + json_data['ref'].to_s
188
184
  if Pkg::Util::Git.remote_tagged?(json_data['url'], json_data['ref'].to_s)
@@ -29,7 +29,7 @@ module Pkg::Util
29
29
  require 'packaging/util/repo'
30
30
 
31
31
  def self.boolean_value(var)
32
- return true if var == true || ( var.is_a?(String) && ( var.downcase == 'true' || var.downcase =~ /^y$|^yes$/))
32
+ return true if var == true || (var.is_a?(String) && (var.downcase == 'true' || var.downcase =~ /^y$|^yes$/))
33
33
  return false
34
34
  end
35
35
 
data/lib/packaging.rb CHANGED
@@ -1,6 +1,5 @@
1
1
  module Pkg
2
-
3
- LIBDIR = File.expand_path(File.dirname(__FILE__))
2
+ LIBDIR = __dir__
4
3
 
5
4
  $:.unshift(LIBDIR) unless
6
5
  $:.include?(File.dirname(__FILE__)) || $:.include?(LIBDIR)
@@ -97,7 +97,7 @@ describe 'Pkg::Platforms' do
97
97
  end
98
98
 
99
99
  describe '#platform_lookup' do
100
- ['osx-10.15-x86_64', 'osx-11-x86_64'].each do |platform|
100
+ ['osx-10.15-x86_64', 'osx-11-x86_64', 'osx-12-x86_64'].each do |platform|
101
101
  it 'should return a hash of platform info' do
102
102
  expect(Pkg::Platforms.platform_lookup(platform)).to be_instance_of(Hash)
103
103
  end
@@ -52,7 +52,7 @@ DOC
52
52
  end
53
53
 
54
54
  describe '#sign_all' do
55
- let(:rpm_directory) { 'foo' }
55
+ let(:rpm_directory) { Dir.mktmpdir }
56
56
  let(:rpms_not_to_sign) { [
57
57
  "#{rpm_directory}/aix/7.1/PC1/ppc/puppet-agent-5.5.3-1.aix7.1.ppc.rpm",
58
58
  ] }
@@ -150,11 +150,11 @@ describe 'Pkg::Util::Git' do
150
150
 
151
151
  context '#remote_tagged?' do
152
152
  it 'reports Yes on tagged component' do
153
- expect(Pkg::Util::Git.remote_tagged?('git://github.com/puppetlabs/leatherman.git', 'refs/tags/0.6.2')).to be(true)
153
+ expect(Pkg::Util::Git.remote_tagged?('https://github.com/puppetlabs/leatherman.git', 'refs/tags/0.6.2')).to be(true)
154
154
  end
155
155
 
156
156
  it 'reports No on non-tagged component' do
157
- expect(Pkg::Util::Git.remote_tagged?('git://github.com/puppetlabs/leatherman.git', '4eef05389ebf418b62af17406c7f9f13fa51f975')).to be(false)
157
+ expect(Pkg::Util::Git.remote_tagged?('https://github.com/puppetlabs/leatherman.git', '4eef05389ebf418b62af17406c7f9f13fa51f975')).to be(false)
158
158
  end
159
159
  end
160
160
  end
@@ -4,32 +4,32 @@ require 'spec_helper'
4
4
  describe "Pkg::Util::Git_tag" do
5
5
  context "parse_ref!" do
6
6
  it "fails for a ref that doesn't exist'" do
7
- expect { Pkg::Util::Git_tag.new("git://github.com/puppetlabs/leatherman.git", "garbagegarbage") }.to raise_error(RuntimeError, /ERROR : Not a ref or sha!/)
7
+ expect { Pkg::Util::Git_tag.new("https://github.com/puppetlabs/leatherman.git", "garbagegarbage") }.to raise_error(RuntimeError, /ERROR : Not a ref or sha!/)
8
8
  end
9
9
  end
10
10
 
11
11
  context "sha?" do
12
12
  it "sets ref type as a sha when passed a sha" do
13
- git_tag = Pkg::Util::Git_tag.new("git://github.com/puppetlabs/leatherman.git", "4eef05389ebf418b62af17406c7f9f13fa51f975")
13
+ git_tag = Pkg::Util::Git_tag.new("https://github.com/puppetlabs/leatherman.git", "4eef05389ebf418b62af17406c7f9f13fa51f975")
14
14
  expect(git_tag.sha?).to eq(true)
15
15
  end
16
16
  end
17
17
 
18
18
  context "branch?" do
19
19
  it "sets ref type as a branch when passed a branch" do
20
- git_tag = Pkg::Util::Git_tag.new("git://github.com/puppetlabs/leatherman.git", "main")
20
+ git_tag = Pkg::Util::Git_tag.new("https://github.com/puppetlabs/leatherman.git", "main")
21
21
  expect(git_tag.branch?).to eq(true)
22
22
  end
23
23
  end
24
24
 
25
25
  context "tag?" do
26
26
  it "sets ref type as a tag when passed a tag" do
27
- git_tag = Pkg::Util::Git_tag.new("git://github.com/puppetlabs/leatherman.git", "tags/0.6.2")
27
+ git_tag = Pkg::Util::Git_tag.new("https://github.com/puppetlabs/leatherman.git", "tags/0.6.2")
28
28
  expect(git_tag.tag?).to eq(true)
29
29
  end
30
30
 
31
31
  it "sets ref type as a tag when passed a fully qualified tag" do
32
- git_tag = Pkg::Util::Git_tag.new("git://github.com/puppetlabs/leatherman.git", "refs/tags/0.6.2")
32
+ git_tag = Pkg::Util::Git_tag.new("https://github.com/puppetlabs/leatherman.git", "refs/tags/0.6.2")
33
33
  expect(git_tag.tag?).to eq(true)
34
34
  end
35
35
  end
@@ -1,4 +1,4 @@
1
- @metrics = []
1
+ @metrics = []
2
2
  def add_shipped_metrics(args)
3
3
  @metrics << {
4
4
  :type => 'shipped',
@@ -19,7 +19,7 @@ def post_shipped_metrics
19
19
  is_rc = metric[:is_rc]
20
20
 
21
21
  uri = URI(Pkg::Config.metrics_url)
22
- res = Net::HTTP.post_form(
22
+ Net::HTTP.post_form(
23
23
  uri,
24
24
  {
25
25
  'type' => type,
data/tasks/apple.rake CHANGED
@@ -18,8 +18,8 @@ PKGBUILD = '/usr/bin/pkgbuild'
18
18
  task :setup do
19
19
  # Read the Apple file-mappings
20
20
  begin
21
- @source_files = Pkg::Util::Serialization.load_yaml('ext/osx/file_mapping.yaml')
22
- rescue => e
21
+ @source_files = Pkg::Util::Serialization.load_yaml('ext/osx/file_mapping.yaml')
22
+ rescue StandardError => e
23
23
  fail "Could not load Apple file mappings from 'ext/osx/file_mapping.yaml'\n#{e}"
24
24
  end
25
25
  @package_name = Pkg::Config.project
@@ -58,11 +58,11 @@ def make_directory_tree
58
58
  end
59
59
 
60
60
  if File.exists?('ext/osx/postflight.erb')
61
- Pkg::Util::File.erb_file 'ext/osx/postflight.erb', "#{@working_tree["scripts"]}/postinstall", false, :binding => binding
61
+ Pkg::Util::File.erb_file 'ext/osx/postflight.erb', "#{@working_tree['scripts']}/postinstall", false, :binding => binding
62
62
  end
63
63
 
64
64
  if File.exists?('ext/osx/preflight.erb')
65
- Pkg::Util::File.erb_file 'ext/osx/preflight.erb', "#{@working_tree["scripts"]}/preinstall", false, :binding => binding
65
+ Pkg::Util::File.erb_file 'ext/osx/preflight.erb', "#{@working_tree['scripts']}/preinstall", false, :binding => binding
66
66
  end
67
67
 
68
68
  if File.exists?('ext/osx/prototype.plist.erb')
@@ -72,7 +72,6 @@ def make_directory_tree
72
72
  if File.exists?('ext/packaging/static_artifacts/PackageInfo.plist')
73
73
  cp 'ext/packaging/static_artifacts/PackageInfo.plist', "#{@scratch}/PackageInfo.plist"
74
74
  end
75
-
76
75
  end
77
76
 
78
77
  # method: build_dmg
@@ -113,14 +112,9 @@ def build_dmg
113
112
  -format #{dmg_format} \
114
113
  #{dmg_file}")
115
114
 
116
- if File.directory?("#{pwd}/pkg/apple")
117
- sh "sudo mv #{pwd}/#{dmg_file} #{pwd}/pkg/apple/#{dmg_file}"
118
- puts "moved: #{dmg_file} has been moved to #{pwd}/pkg/apple/#{dmg_file}"
119
- else
120
- mkdir_p("#{pwd}/pkg/apple")
121
- sh "sudo mv #{pwd}/#{dmg_file} #{pwd}/pkg/apple/#{dmg_file}"
122
- puts "moved: #{dmg_file} has been moved to #{pwd}/pkg/apple/#{dmg_file}"
123
- end
115
+ mkdir_p("#{pwd}/pkg/apple") unless File.directory?("#{pwd}/pkg/apple")
116
+ sh "sudo mv #{pwd}/#{dmg_file} #{pwd}/pkg/apple/#{dmg_file}"
117
+ puts "moved: #{dmg_file} has been moved to #{pwd}/pkg/apple/#{dmg_file}"
124
118
  end
125
119
 
126
120
  # method: pack_source
@@ -131,7 +125,7 @@ end
131
125
  # installed as the package's payload.
132
126
  #
133
127
  def pack_source
134
- work = "#{@working_tree['working']}"
128
+ work = (@working_tree['working']).to_s
135
129
  source = pwd
136
130
 
137
131
  # Make all necessary directories
data/tasks/archive.rake CHANGED
@@ -1,8 +1,7 @@
1
1
  namespace :pl do
2
2
  namespace :remote do
3
-
4
3
  desc "Move packages from repo paths to archive staging paths"
5
- task :stage_archives, [:yum_directories, :apt_directories, :downloads_directories] => 'pl:fetch' do |_t, args|
4
+ task :stage_archives, %i[yum_directories apt_directories downloads_directories] => 'pl:fetch' do |_t, args|
6
5
  yum_directories = args.yum_directories ? args.yum_directories.split(' ') : []
7
6
  apt_directories = args.apt_directories ? args.apt_directories.split(' ') : []
8
7
  downloads_directories = args.downloads_directories ? args.downloads_directories.split(' ') : []
data/tasks/deb.rake CHANGED
@@ -24,7 +24,7 @@ def debuild(args)
24
24
  results_dir = args[:work_dir]
25
25
  begin
26
26
  sh "debuild --no-lintian -uc -us"
27
- rescue => e
27
+ rescue StandardError => e
28
28
  fail "Something went wrong. Hopefully the backscroll or #{results_dir}/#{Pkg::Config.project}_#{Pkg::Config.debversion}.build file has a clue.\n#{e}"
29
29
  end
30
30
  end
@@ -47,12 +47,11 @@ task :prep_deb_tars, :work_dir do |t, args|
47
47
  pkg_dir = "#{work_dir}/#{Pkg::Config.project}-#{Pkg::Config.debversion}"
48
48
  cd 'ext' do
49
49
  Pathname('debian').find do |file|
50
- case
51
- when file.to_s =~ /~$/, file.to_s =~ /^#/
50
+ if file.to_s =~ /~$/ || file.to_s =~ /^#/
52
51
  next
53
- when file.directory?
52
+ elsif file.directory?
54
53
  mkdir_p "#{pkg_dir}/#{file}"
55
- when file.extname == '.erb'
54
+ elsif file.extname == '.erb'
56
55
  Pkg::Util::File.erb_file(file, "#{pkg_dir}/#{file.sub(/\.[^\.]*$/, '')}", false, :binding => Pkg::Config.get_binding)
57
56
  else
58
57
  cp file, "#{pkg_dir}/#{file}"
@@ -70,10 +69,10 @@ task :build_deb, :deb_command, :cow do |t, args|
70
69
  work_dir = Pkg::Util::File.mktemp
71
70
  subdir = 'pe/' if Pkg::Config.build_pe
72
71
  codename = /base-(.*)-(.*)\.cow/.match(cow)[1] unless cow.nil?
73
- dest_dir = File.join(Pkg::Config.project_root, "pkg", "#{subdir}deb", codename.to_s, subrepo.to_s)
72
+ dest_dir = File.join(Pkg::Config.project_root, "pkg", "#{subdir}deb", codename.to_s, subrepo.to_s)
74
73
  Pkg::Util::Tool.check_tool(deb_build)
75
74
  mkdir_p dest_dir
76
- deb_args = { :work_dir => work_dir, :cow => cow }
75
+ deb_args = { :work_dir => work_dir, :cow => cow }
77
76
  Rake::Task[:prep_deb_tars].reenable
78
77
  Rake::Task[:prep_deb_tars].invoke(work_dir)
79
78
  cd "#{work_dir}/#{Pkg::Config.project}-#{Pkg::Config.debversion}" do
@@ -112,7 +111,7 @@ end
112
111
 
113
112
  namespace :pl do
114
113
  desc "Create a deb from this repo using the default cow #{Pkg::Config.default_cow}."
115
- task :deb => "package:tar" do
114
+ task :deb => "package:tar" do
116
115
  Pkg::Util.check_var('PE_VER', Pkg::Config.pe_version) if Pkg::Config.build_pe
117
116
  Rake::Task[:build_deb].invoke('pdebuild', Pkg::Config.default_cow)
118
117
  end
data/tasks/doc.rake CHANGED
@@ -12,9 +12,11 @@ if Pkg::Config.build_doc
12
12
  RDoc::Task.new(:doc) do |rdoc|
13
13
  rdoc.rdoc_dir = 'doc'
14
14
  rdoc.title = "#{Pkg::Config.project} version #{Pkg::Config.version}"
15
- Pkg::Config.gem_rdoc_options.each do |option|
16
- rdoc.options << option
17
- end unless Pkg::Config.gem_rdoc_options.nil?
15
+ unless Pkg::Config.gem_rdoc_options.nil?
16
+ Pkg::Config.gem_rdoc_options.each do |option|
17
+ rdoc.options << option
18
+ end
19
+ end
18
20
  end
19
21
  end
20
22
  end
data/tasks/education.rake CHANGED
@@ -1,7 +1,6 @@
1
1
  namespace :pl do
2
2
  namespace :jenkins do
3
- task :deploy_learning_vm, [:vm, :md5, :target_bucket, :target_directory] => "pl:fetch" do |t, args|
4
-
3
+ task :deploy_learning_vm, %i[vm md5 target_bucket target_directory] => "pl:fetch" do |t, args|
5
4
  vm = args.vm or fail ":vm is a required argument for #{t}"
6
5
  md5 = args.md5 or fail ":md5 is a required argument for #{t}"
7
6
  target_bucket = args.target_bucket or fail ":target_bucket is a required argument for #{t}"
@@ -13,8 +12,7 @@ namespace :pl do
13
12
  puts "'#{vm}' and '#{md5}' have been shipped via s3 to '#{target_bucket}/#{target_directory}'"
14
13
  end
15
14
 
16
- task :deploy_training_vm, [:vm, :md5, :target_host, :target_directory] => "pl:fetch" do |t, args|
17
-
15
+ task :deploy_training_vm, %i[vm md5 target_host target_directory] => "pl:fetch" do |t, args|
18
16
  vm = args.vm or fail ":vm is a required argument for #{t}"
19
17
  md5 = args.md5 or fail ":md5 is a required argument for #{t}"
20
18
  target_host = args.target_host or fail ":target_host is a required argument for #{t}"
data/tasks/gem.rake CHANGED
@@ -57,18 +57,24 @@ def create_default_gem_spec
57
57
  s.test_files = FileList[Pkg::Config.gem_test_files.split(' ')] unless Pkg::Config.gem_test_files.nil?
58
58
  s.license = Pkg::Config.gem_license unless Pkg::Config.gem_license.nil?
59
59
  s.rubyforge_project = Pkg::Config.gem_forge_project unless Pkg::Config.gem_forge_project.nil?
60
- Pkg::Config.gem_rdoc_options.each do |option|
61
- s.rdoc_options << option
62
- end unless Pkg::Config.gem_rdoc_options.nil?
60
+ unless Pkg::Config.gem_rdoc_options.nil?
61
+ Pkg::Config.gem_rdoc_options.each do |option|
62
+ s.rdoc_options << option
63
+ end
64
+ end
63
65
  end
64
66
 
65
- Pkg::Config.gem_runtime_dependencies.each do |gem, version|
66
- spec = add_gem_dependency(:spec => spec, :gem => gem, :version => version, :type => :runtime)
67
- end unless Pkg::Config.gem_runtime_dependencies.nil?
67
+ unless Pkg::Config.gem_runtime_dependencies.nil?
68
+ Pkg::Config.gem_runtime_dependencies.each do |gem, version|
69
+ spec = add_gem_dependency(:spec => spec, :gem => gem, :version => version, :type => :runtime)
70
+ end
71
+ end
68
72
 
69
- Pkg::Config.gem_development_dependencies.each do |gem, version|
70
- spec = add_gem_dependency(:spec => spec, :gem => gem, :version => version, :type => :development)
71
- end unless Pkg::Config.gem_development_dependencies.nil?
73
+ unless Pkg::Config.gem_development_dependencies.nil?
74
+ Pkg::Config.gem_development_dependencies.each do |gem, version|
75
+ spec = add_gem_dependency(:spec => spec, :gem => gem, :version => version, :type => :development)
76
+ end
77
+ end
72
78
  spec
73
79
  end
74
80
 
@@ -107,9 +113,11 @@ def create_platform_specific_gems
107
113
  Pkg::Config.gem_platform_dependencies.each do |platform, dependency_hash|
108
114
  spec = create_default_gem_spec
109
115
  pf = Gem::Platform.new(platform)
110
- fail "
111
- Platform: '#{platform}' is not recognized by rubygems.
112
- This is probably an erroneous 'gem_platform_dependencies' entry!" if unknown_gems_platform?(pf)
116
+ if unknown_gems_platform?(pf)
117
+ fail "
118
+ Platform: '#{platform}' is not recognized by rubygems.
119
+ This is probably an erroneous 'gem_platform_dependencies' entry!"
120
+ end
113
121
  spec.platform = pf
114
122
  dependency_hash.each do |type, gems|
115
123
  t = case type
data/tasks/jenkins.rake CHANGED
@@ -103,7 +103,7 @@ namespace :pl do
103
103
  # a PE build, so we always this along as an environment variable task
104
104
  # argument if its the case.
105
105
  #
106
- Pkg::Config.task = { :task => "#{build_task}", :args => nil }
106
+ Pkg::Config.task = { :task => build_task.to_s, :args => nil }
107
107
  Pkg::Config.task[:args] = ["PE_BUILD=true"] if @build_pe
108
108
  #
109
109
  # Determine the type of build we're doing to inform jenkins
@@ -150,9 +150,9 @@ namespace :pl do
150
150
  # Construct the parameters, which is an array of hashes we turn into JSON
151
151
  parameters = [{ "name" => "BUILD_PROPERTIES", "file" => "file0" },
152
152
  { "name" => "PROJECT_BUNDLE", "file" => "file1" },
153
- { "name" => "PROJECT", "value" => "#{Pkg::Config.project}" },
154
- { "name" => "BUILD_TYPE", "label" => "#{build_type}" },
155
- { "name" => "METRICS", "value" => "#{metrics}" }]
153
+ { "name" => "PROJECT", "value" => Pkg::Config.project.to_s },
154
+ { "name" => "BUILD_TYPE", "label" => build_type.to_s },
155
+ { "name" => "METRICS", "value" => metrics.to_s }]
156
156
 
157
157
  # Initialize the args array that will hold all of the arguments we pass
158
158
  # to the curl utility method.
@@ -172,7 +172,7 @@ namespace :pl do
172
172
  # Construct the remaining form arguments. For visual clarity, params that are tied
173
173
  # together are on the same line.
174
174
  #
175
- args << [
175
+ args << [
176
176
  "-Fname=BUILD_PROPERTIES", "-Ffile0=@#{properties}",
177
177
  "-Fname=PROJECT_BUNDLE", "-Ffile1=@#{bundle}",
178
178
  "-Fname=PROJECT", "-Fvalue=#{Pkg::Config.project}",
@@ -250,7 +250,7 @@ namespace :pl do
250
250
  end
251
251
 
252
252
  task :uber_ship_lite => "pl:fetch" do
253
- tasks = %w(
253
+ tasks = %w[
254
254
  jenkins:retrieve
255
255
  jenkins:sign_all
256
256
  ship_rpms
@@ -260,9 +260,9 @@ namespace :pl do
260
260
  ship_tar
261
261
  ship_msi
262
262
  ship_gem
263
- )
263
+ ]
264
264
  tasks.map { |t| "pl:#{t}" }.each do |t|
265
- puts "Running #{t} . . ."
265
+ puts "Running \"#{t}\""
266
266
  Rake::Task[t].invoke
267
267
  end
268
268
  # mark the build as successfully shipped
@@ -270,13 +270,16 @@ namespace :pl do
270
270
  # add the release to release-metrics
271
271
  begin
272
272
  Rake::Task["pl:update_release_metrics"].invoke
273
- rescue => e
273
+ rescue StandardError => e
274
274
  fail "Error updating release-metrics:\n#{e}\nYou will need to add this release manually."
275
275
  end
276
276
  end
277
277
 
278
278
  task :stage_nightlies => "pl:fetch" do
279
- tasks = %w(
279
+ # debian weirdness: ship_nightly_debs uses the old methodology that posts to
280
+ # apt.puppet.com; stage_nightly_debs uses the updated methodology that posts to
281
+ # apt.repos.puppet.com
282
+ tasks = %w[
280
283
  jenkins:retrieve
281
284
  jenkins:sign_all
282
285
  ship_nightly_rpms
@@ -284,17 +287,26 @@ namespace :pl do
284
287
  ship_nightly_dmg
285
288
  ship_nightly_swix
286
289
  ship_nightly_msi
287
- )
290
+ ]
288
291
  tasks.map { |t| "pl:#{t}" }.each do |t|
289
- puts "Running #{t}:"
292
+ puts "Running \"#{t}\""
290
293
  Rake::Task[t].invoke
291
294
  end
292
295
  end
293
296
 
294
297
  task :ship_nightlies => "pl:fetch" do
298
+ ## nightlies.puppet.com
295
299
  Rake::Task['pl:jenkins:stage_nightlies'].invoke
296
300
  Rake::Task['pl:remote:update_nightly_repos'].invoke
297
301
  Rake::Task['pl:remote:deploy_nightlies_to_s3'].invoke
302
+
303
+ # This serves as a cheap feature toggle to avoid things not ready to
304
+ # use it. It should be removed in future versions.
305
+ if ENV['NIGHTLY_SHIP_TO_GCP']
306
+ ## apt.repos.puppet.com
307
+ Rake::Task['pl:stage_nightly_debs'].invoke
308
+ Rake::Task['pl:remote:sync_apt_repo_to_gcp'].invoke
309
+ end
298
310
  end
299
311
 
300
312
  task :ship_final => "pl:fetch" do
@@ -324,7 +336,7 @@ namespace :pl do
324
336
 
325
337
  desc "Retrieve packages built by jenkins, sign, and ship all!"
326
338
  task :uber_ship => "pl:fetch" do
327
- uber_tasks = %w(
339
+ uber_tasks = %w[
328
340
  jenkins:retrieve
329
341
  jenkins:sign_all
330
342
  uber_ship
@@ -342,7 +354,7 @@ namespace :pl do
342
354
  remote:deploy_yum_repo_to_s3
343
355
  remote:deploy_downloads_to_s3
344
356
  remote:deploy_to_rsync_server
345
- )
357
+ ]
346
358
 
347
359
  if Pkg::Util.boolean_value(Pkg::Config.answer_override) && !Pkg::Config.foss_only
348
360
  fail "Using ANSWER_OVERRIDE without FOSS_ONLY=true is dangerous!"
@@ -518,7 +530,7 @@ namespace :pl do
518
530
  end
519
531
 
520
532
  # Assemble the JSON string for the JSON parameter
521
- json = JSON.generate("parameter" => [{ "name" => "SHA", "value" => "#{Pkg::Config.ref}" }])
533
+ json = JSON.generate("parameter" => [{ "name" => "SHA", "value" => Pkg::Config.ref.to_s }])
522
534
 
523
535
  # Assemble our arguments to the post
524
536
  args = [
@@ -36,27 +36,27 @@ namespace :pl do
36
36
 
37
37
  # Generate an XML file for every job configuration erb and attempt to
38
38
  # create a jenkins job from that XML config
39
- templates.each do |t|
40
- erb_template = File.join(template_dir, t)
41
- xml_file = File.join(work_dir, t.gsub('.erb', ''))
39
+ templates.each do |template|
40
+ erb_template = File.join(template_dir, template)
41
+ xml_file = File.join(work_dir, template.gsub('.erb', ''))
42
42
  Pkg::Util::File.erb_file(erb_template, xml_file, nil, :binding => Pkg::Config.get_binding)
43
43
  # If we're creating a job meant to run on a windows box, we need to limit the path length
44
44
  # Max path length allowed is 260 chars, which we manage to exceed with this job name. Luckily,
45
45
  # simply using the short sha rather than the long sha gets us just under the length limit. Gross fix,
46
46
  # I know, but hey, it works for now.
47
- if t == "msi.xml.erb"
47
+ if template == "msi.xml.erb"
48
48
  ref = Pkg::Config.short_ref
49
49
  else
50
50
  ref = Pkg::Config.ref
51
51
  end
52
- job_name = "#{Pkg::Config.project}-#{t.gsub('.xml.erb', '')}-#{Pkg::Config.build_date}-#{ref}"
52
+ job_name = "#{Pkg::Config.project}-#{template.gsub('.xml.erb', '')}-#{Pkg::Config.build_date}-#{ref}"
53
53
  puts "Checking for existence of #{job_name}..."
54
54
  if Pkg::Util::Jenkins.jenkins_job_exists?(job_name)
55
55
  raise "Job #{job_name} already exists on #{Pkg::Config.jenkins_build_host}"
56
56
  else
57
57
  Pkg::Util::Execution.retry_on_fail(:times => 3) do
58
58
  url = Pkg::Util::Jenkins.create_jenkins_job(job_name, xml_file)
59
- if t == "packaging.xml.erb"
59
+ if template == "packaging.xml.erb"
60
60
  ENV["PACKAGE_BUILD_URL"] = url
61
61
  end
62
62
  puts "Verifying job created successfully..."
@@ -71,7 +71,7 @@ namespace :pl do
71
71
  packaging_name = "#{Pkg::Config.project}-packaging-#{Pkg::Config.build_date}-#{Pkg::Config.ref}"
72
72
  Pkg::Util::RakeUtils.invoke_task("pl:jenkins:trigger_dynamic_job", packaging_name)
73
73
 
74
- if poll_interval > 0
74
+ if poll_interval.positive?
75
75
  ##
76
76
  # Wait for the '*packaging*' job to finish.
77
77
  #
@@ -155,15 +155,15 @@ namespace :pl do
155
155
  # Construct the parameters, which is an array of hashes we turn into JSON
156
156
  parameters = [{ "name" => "BUILD_PROPERTIES", "file" => "file0" },
157
157
  { "name" => "PROJECT_BUNDLE", "file" => "file1" },
158
- { "name" => "PROJECT", "value" => "#{Pkg::Config.project}" },
159
- { "name" => "METRICS", "value" => "#{metrics}" }]
158
+ { "name" => "PROJECT", "value" => Pkg::Config.project.to_s },
159
+ { "name" => "METRICS", "value" => metrics.to_s }]
160
160
 
161
161
  # Contruct the json string
162
162
  json = JSON.generate("parameter" => parameters)
163
163
 
164
164
  # The args array that holds all of the arguments we pass
165
165
  # to the curl utility method.
166
- curl_args = [
166
+ curl_args = [
167
167
  "-Fname=BUILD_PROPERTIES", "-Ffile0=@#{properties}",
168
168
  "-Fname=PROJECT_BUNDLE", "-Ffile1=@#{bundle}",
169
169
  "-Fname=PROJECT", "-Fvalue=#{Pkg::Config.project}",