packaging 0.99.72 → 0.99.77

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: 0d7bf70560a370066a2f9ab94c35c38093b5884e7baeabc9efe0926de62e262f
4
- data.tar.gz: c6bf09ab5b588fa500b3db7408372194e2b7a1ac154ea98e1481085166deb28b
3
+ metadata.gz: 365629e0e3cba195de934ccd1cee9ecff5c7ed684ac79e4befc883420037b191
4
+ data.tar.gz: 2498029caf73135b3ee7c5a2704e310ae6398c4eb7716c3687db487fc827dc0d
5
5
  SHA512:
6
- metadata.gz: 91aa048b12dfe8fd25867d9d5522db55559f2273284cafb3089362f0f14ee09ae536c3d039a04d63ebb95d0c1238a6467f60e27d8a1b41b512234ba609cb58ff
7
- data.tar.gz: b26d4ff051f2b7ff0cddfdb1a8f3237377d237a3bc59511cbef6785ccb566eac8917d100108acbe41488d2748e8439860f26038069fd8f818d72c7474e4468e8
6
+ metadata.gz: 4a73420699b6ce732c52c527468c5b9cef405c0565aab9b33c3e592109ddee4aa965f162b4d3950a7900584994dba2994cc07602d75e36b0a53bf8dbbfcd23ec
7
+ data.tar.gz: f871e9711752e70ac48956663402fa3f0cdf2693ae08eff8aa0ac59384a0081e1dd27fdbac01a3a17964de4a135a9ded98d381808cace9d9dd62c6ac37d20a8d
data/README.md CHANGED
@@ -404,7 +404,7 @@ deb_build_mirrors:
404
404
  # Who is packaging. Turns up in various packaging artifacts
405
405
  packager: 'puppetlabs'
406
406
  # GPG key ID of the signer
407
- gpg_key: '7F438280EF8D349F'
407
+ gpg_key: '4528B6CD9E61EF26'
408
408
  # Whether to require tarball signing as a prerequisite of other package building
409
409
  sign_tar: false
410
410
  # a space separated list of mock configs. These are the rpm distributions to package for. If a noarch package, only one arch of each is needed.
@@ -33,7 +33,7 @@ module Pkg::Archive
33
33
  sudo chmod g+w -R #{Pkg::Config.yum_archive_path}
34
34
  mv #{full_directory} #{archive_path}
35
35
  CMD
36
- Pkg::Util::Net.remote_ssh_cmd(Pkg::Config.staging_server, command)
36
+ Pkg::Util::Net.remote_execute(Pkg::Config.staging_server, command)
37
37
  end
38
38
 
39
39
  # Move directories from freight path (aka repo staging path) to archive staging paths
@@ -60,7 +60,7 @@ module Pkg::Archive
60
60
  mv $pool_directory /opt/tmp-apt
61
61
  done
62
62
  CMD
63
- Pkg::Util::Net.remote_ssh_cmd(Pkg::Config.staging_server, command)
63
+ Pkg::Util::Net.remote_execute(Pkg::Config.staging_server, command)
64
64
  end
65
65
 
66
66
  # Move downloads directories to archive staging path
@@ -85,7 +85,7 @@ module Pkg::Archive
85
85
  sudo chmod g+w -R #{Pkg::Config.downloads_archive_path}
86
86
  mv #{full_directory} #{archive_path}
87
87
  CMD
88
- Pkg::Util::Net.remote_ssh_cmd(Pkg::Config.staging_server, command)
88
+ Pkg::Util::Net.remote_execute(Pkg::Config.staging_server, command)
89
89
  end
90
90
 
91
91
  # Delete empty directories from repo paths on weth
@@ -104,7 +104,7 @@ module Pkg::Archive
104
104
  fi
105
105
  done
106
106
  CMD
107
- Pkg::Util::Net.remote_ssh_cmd(Pkg::Config.staging_server, command)
107
+ Pkg::Util::Net.remote_execute(Pkg::Config.staging_server, command)
108
108
  end
109
109
  end
110
110
 
@@ -112,7 +112,7 @@ module Pkg::Archive
112
112
  def remove_dead_symlinks
113
113
  base_paths.each do |path|
114
114
  command = "find #{path} -xtype l -delete"
115
- Pkg::Util::Net.remote_ssh_cmd(Pkg::Config.staging_server, command)
115
+ Pkg::Util::Net.remote_execute(Pkg::Config.staging_server, command)
116
116
  end
117
117
  end
118
118
 
@@ -120,7 +120,7 @@ module Pkg::Archive
120
120
  def delete_staged_archives
121
121
  archive_paths.each do |archive_path|
122
122
  command = "sudo rm -rf #{File.join(archive_path, '*')}"
123
- Pkg::Util::Net.remote_ssh_cmd(Pkg::Config.staging_server, command)
123
+ Pkg::Util::Net.remote_execute(Pkg::Config.staging_server, command)
124
124
  end
125
125
  end
126
126
  end
@@ -6,6 +6,7 @@ module Pkg
6
6
  #
7
7
  class Config
8
8
  require 'packaging/config/params.rb'
9
+ require 'packaging/config/validations.rb'
9
10
  require 'yaml'
10
11
 
11
12
  class << self
@@ -80,7 +81,11 @@ module Pkg
80
81
  dir = "/opt/jenkins-builds/#{self.project}/#{self.ref}"
81
82
  cmd = "if [ -s \"#{dir}/artifacts\" ]; then cd #{dir};"\
82
83
  "find ./artifacts/ -mindepth 2 -type f; fi"
83
- artifacts, _ = Pkg::Util::Net.remote_ssh_cmd(self.builds_server, cmd, true)
84
+ artifacts, _ = Pkg::Util::Net.remote_execute(
85
+ self.builds_server,
86
+ cmd,
87
+ { capture_output: true }
88
+ )
84
89
 
85
90
  artifacts = artifacts.split("\n")
86
91
  data = {}
@@ -389,6 +394,31 @@ module Pkg
389
394
  end
390
395
  end
391
396
 
397
+ ##
398
+ # Ask for validation of BUILD_PARAMS
399
+ #
400
+ # Issued as warnings initially but the intent is to turn this into
401
+ # a failure.
402
+ #
403
+ def perform_validations
404
+ error_count = 0
405
+ Pkg::Params::VALIDATIONS.each do |v|
406
+ variable_name = v[:var]
407
+ variable_value = self.instance_variable_get("@#{v[:var]}")
408
+ validations = v[:validations]
409
+ validations.each do |validation|
410
+ unless Pkg::ConfigValidations.send(validation, variable_value)
411
+ warn "Warning: variable \"#{variable_name}\" failed validation \"#{validation}\""
412
+ error_count += 1
413
+ end
414
+ end
415
+ end
416
+
417
+ if error_count != 0
418
+ warn "Warning: #{error_count} validation failure(s)."
419
+ end
420
+ end
421
+
392
422
  def string_to_array(str)
393
423
  delimiters = /[,\s;]/
394
424
  return str if str.respond_to?('each')
@@ -363,6 +363,7 @@ module Pkg::Params
363
363
  { :oldvar => :yum_host, :newvar => :tar_host },
364
364
  ]
365
365
 
366
+
366
367
  # These are variables that we have deprecated. If they are encountered in a
367
368
  # project's config, we issue deprecations for them.
368
369
  #
@@ -373,4 +374,14 @@ module Pkg::Params
373
374
  { :var => :gpg_name, :message => "
374
375
  DEPRECATED, 29-Jul-2014: 'gpg_name' has been replaced with 'gpg_key'.
375
376
  Please update this field in your build_defaults.yaml" }]
377
+
378
+ # Provide an open-ended template for validating BUILD_PARAMS.
379
+ #
380
+ # Each validatation contains the variable name as ':var' and a list of validations it
381
+ # must pass from the Pkg::Params::Validations class.
382
+ #
383
+ VALIDATIONS = [
384
+ { :var => :project, :validations => [:not_empty?] }
385
+ ]
386
+
376
387
  end
@@ -0,0 +1,13 @@
1
+ module Pkg
2
+ class ConfigValidations
3
+
4
+ class << self
5
+
6
+ # As a validation, this one is kindof lame but is intended as a seed pattern for possibly
7
+ # more robust ones.
8
+ def not_empty?(value)
9
+ value.to_s.empty? ? false : true
10
+ end
11
+ end
12
+ end
13
+ end
@@ -125,7 +125,7 @@ Description: Apt repository for acceptance testing" >> conf/distributions ; )
125
125
  command = repo_creation_command(File.join(artifact_directory, 'repos'), artifact_paths)
126
126
 
127
127
  begin
128
- Pkg::Util::Net.remote_ssh_cmd(Pkg::Config.distribution_server, command)
128
+ Pkg::Util::Net.remote_execute(Pkg::Config.distribution_server, command)
129
129
  # Now that we've created our package repositories, we can generate repo
130
130
  # configurations for use with downstream jobs, acceptance clients, etc.
131
131
  Pkg::Deb::Repo.generate_repo_configs
@@ -134,7 +134,7 @@ Description: Apt repository for acceptance testing" >> conf/distributions ; )
134
134
  Pkg::Deb::Repo.ship_repo_configs
135
135
  ensure
136
136
  # Always remove the lock file, even if we've failed
137
- Pkg::Util::Net.remote_ssh_cmd(Pkg::Config.distribution_server, "rm -f #{artifact_directory}/repos/.lock")
137
+ Pkg::Util::Net.remote_execute(Pkg::Config.distribution_server, "rm -f #{artifact_directory}/repos/.lock")
138
138
  end
139
139
  end
140
140
 
@@ -146,7 +146,7 @@ Description: Apt repository for acceptance testing" >> conf/distributions ; )
146
146
 
147
147
  Pkg::Util::RakeUtils.invoke_task("pl:fetch")
148
148
  repo_dir = "#{Pkg::Config.jenkins_repo_path}/#{Pkg::Config.project}/#{Pkg::Config.ref}/#{target}/deb"
149
- Pkg::Util::Net.remote_ssh_cmd(Pkg::Config.distribution_server, "mkdir -p #{repo_dir}")
149
+ Pkg::Util::Net.remote_execute(Pkg::Config.distribution_server, "mkdir -p #{repo_dir}")
150
150
  Pkg::Util::Execution.retry_on_fail(:times => 3) do
151
151
  Pkg::Util::Net.rsync_to("pkg/#{target}/deb/", Pkg::Config.distribution_server, repo_dir)
152
152
  end
@@ -252,11 +252,11 @@ SignWith: #{Pkg::Config.gpg_key}"
252
252
  rsync_command = repo_deployment_command(apt_path, destination_staging_path, destination_server, dryrun)
253
253
  cp_command = repo_deployment_command(destination_staging_path, apt_path, nil, dryrun)
254
254
 
255
- Pkg::Util::Net.remote_ssh_cmd(origin_server, rsync_command)
255
+ Pkg::Util::Net.remote_execute(origin_server, rsync_command)
256
256
  if dryrun
257
257
  puts "[DRYRUN] not executing #{cp_command} on #{destination_server}"
258
258
  else
259
- Pkg::Util::Net.remote_ssh_cmd(destination_server, cp_command)
259
+ Pkg::Util::Net.remote_execute(destination_server, cp_command)
260
260
  end
261
261
  end
262
262
 
@@ -16,9 +16,9 @@ module Pkg::Paths
16
16
  if source_formats.find { |fmt| path =~ /#{fmt}$/ }
17
17
  return Pkg::Platforms.get_attribute_for_platform_version(platform, version, :source_architecture)
18
18
  end
19
- arches.find { |a| path.include?(a) } || arches[0]
19
+ arches.find { |a| path.include?(package_arch(platform, a)) } || arches[0]
20
20
  rescue
21
- arches.find { |a| path.include?(a) } || arches[0]
21
+ arches.find { |a| path.include?(package_arch(platform, a)) } || arches[0]
22
22
  end
23
23
 
24
24
  # Given a path to an artifact, divine the appropriate platform tag associated
@@ -117,7 +117,7 @@ module Pkg::Paths
117
117
 
118
118
  # In puppet7 and beyond, we moved the repo_name to the top to allow each
119
119
  # puppet major release to have its own apt repo.
120
- if %w(puppet7 puppet7-nightly).include? repo_name
120
+ if %w(FUTURE-puppet7 FUTURE-puppet7-nightly).include? repo_name
121
121
  return File.join(prefix, apt_repo_name(is_nonfinal), debian_code_name)
122
122
  end
123
123
 
@@ -313,13 +313,17 @@ module Pkg::Paths
313
313
  # In puppet7 and beyond, we moved the puppet major version to near the top to allow each
314
314
  # puppet major release to have its own apt repo, for example:
315
315
  # /opt/repository/apt/puppet7/pool/bionic/p/puppet-agent
316
- if %w(puppet7 puppet7-nightly).include? repo_name
316
+ if %w(FUTURE-puppet7 FUTURE-puppet7-nightly).include? repo_name
317
317
  return File.join(remote_repo_path, repo_name, 'pool', code_name, project[0], project)
318
318
  end
319
319
 
320
320
  # For repos prior to puppet7, the puppet version was part of the repository
321
321
  # For example: /opt/repository/apt/pool/bionic/puppet6/p/puppet-agent
322
- if %w(puppet puppet5 puppet6 puppet-nightly puppet5-nightly puppet6-nightly).include? repo_name
322
+ if %w(puppet7 puppet7-nightly
323
+ puppet6 puppet6-nightly
324
+ puppet5 puppet5-nightly
325
+ puppet puppet-nightly
326
+ puppet-tools).include? repo_name
323
327
  return File.join(remote_repo_path, 'pool', code_name, repo_name, project[0], project)
324
328
  end
325
329
 
@@ -358,4 +362,15 @@ module Pkg::Paths
358
362
  return base_component if component_qualifier == 'repos'
359
363
  return full_component
360
364
  end
365
+
366
+ #for ubuntu-20.04-aarch64, debian package architecture is arm64
367
+ def package_arch(platform, arch)
368
+ if platform == 'ubuntu' && arch == 'aarch64'
369
+ return 'arm64'
370
+ end
371
+ arch
372
+ end
373
+
374
+ private :package_arch
375
+
361
376
  end
@@ -12,13 +12,6 @@ module Pkg
12
12
  # Each element in this hash
13
13
  PLATFORM_INFO = {
14
14
  'aix' => {
15
- '6.1' => {
16
- architectures: ['power'],
17
- source_architecture: 'SRPMS',
18
- package_format: 'rpm',
19
- source_package_formats: ['src.rpm'],
20
- repo: false,
21
- },
22
15
  '7.1' => {
23
16
  architectures: ['power'],
24
17
  source_architecture: 'SRPMS',
@@ -28,25 +21,6 @@ module Pkg
28
21
  },
29
22
  },
30
23
 
31
- 'cisco-wrlinux' => {
32
- '5' => {
33
- architectures: ['x86_64'],
34
- source_architecture: 'SRPMS',
35
- package_format: 'rpm',
36
- source_package_formats: ['src.rpm'],
37
- signature_format: 'v4',
38
- repo: true,
39
- },
40
- '7' => {
41
- architectures: ['x86_64'],
42
- source_architecture: 'SRPMS',
43
- package_format: 'rpm',
44
- source_package_formats: ['src.rpm'],
45
- signature_format: 'v4',
46
- repo: true,
47
- },
48
- },
49
-
50
24
  'debian' => {
51
25
  '8' => {
52
26
  codename: 'jessie',
@@ -100,7 +74,7 @@ module Pkg
100
74
  repo: true,
101
75
  },
102
76
  '8' => {
103
- architectures: ['x86_64', 'aarch64'],
77
+ architectures: ['x86_64', 'ppc64le', 'aarch64'],
104
78
  source_architecture: 'SRPMS',
105
79
  package_format: 'rpm',
106
80
  source_package_formats: ['src.rpm'],
@@ -109,14 +83,6 @@ module Pkg
109
83
  }
110
84
  },
111
85
 
112
- 'eos' => {
113
- '4' => {
114
- architectures: ['i386'],
115
- package_format: 'swix',
116
- repo: false,
117
- },
118
- },
119
-
120
86
  'fedora' => {
121
87
  '30' => {
122
88
  architectures: ['x86_64'],
@@ -142,6 +108,14 @@ module Pkg
142
108
  signature_format: 'v4',
143
109
  repo: true,
144
110
  },
111
+ '34' => {
112
+ architectures: ['x86_64'],
113
+ source_architecture: 'SRPMS',
114
+ package_format: 'rpm',
115
+ source_package_formats: ['src.rpm'],
116
+ signature_format: 'v4',
117
+ repo: true,
118
+ },
145
119
  },
146
120
 
147
121
  'osx' => {
@@ -160,6 +134,11 @@ module Pkg
160
134
  package_format: 'dmg',
161
135
  repo: false,
162
136
  },
137
+ '11' => {
138
+ architectures: ['x86_64'],
139
+ package_format: 'dmg',
140
+ repo: false,
141
+ },
163
142
  },
164
143
 
165
144
  'redhatfips' => {
@@ -248,7 +227,7 @@ module Pkg
248
227
  },
249
228
  '20.04' => {
250
229
  codename: 'focal',
251
- architectures: ['amd64'],
230
+ architectures: ['amd64', 'aarch64'],
252
231
  source_architecture: 'source',
253
232
  package_format: 'deb',
254
233
  source_package_formats: DEBIAN_SOURCE_FORMATS,
@@ -110,7 +110,11 @@ module Pkg::Repo
110
110
  cmd = "[ -d #{artifact_directory} ] || exit 1 ; "
111
111
  cmd << "pushd #{artifact_directory} > /dev/null && "
112
112
  cmd << "find . -name '*.#{pkg_ext}' -print0 | xargs --no-run-if-empty -0 -I {} dirname {} "
113
- stdout, stderr = Pkg::Util::Net.remote_ssh_cmd(Pkg::Config.distribution_server, cmd, true)
113
+ stdout, _ = Pkg::Util::Net.remote_execute(
114
+ Pkg::Config.distribution_server,
115
+ cmd,
116
+ { capture_output: true }
117
+ )
114
118
  return stdout.split
115
119
  rescue => e
116
120
  fail "Error: Could not retrieve directories that contain #{pkg_ext} packages in #{Pkg::Config.distribution_server}:#{artifact_directory}"
@@ -120,7 +124,7 @@ module Pkg::Repo
120
124
  cmd = "[ -d #{artifact_parent_directory}/artifacts ] || exit 1 ; "
121
125
  cmd << "pushd #{artifact_parent_directory} > /dev/null && "
122
126
  cmd << 'rsync --archive --verbose --one-file-system --ignore-existing artifacts/ repos/ '
123
- Pkg::Util::Net.remote_ssh_cmd(Pkg::Config.distribution_server, cmd)
127
+ Pkg::Util::Net.remote_execute(Pkg::Config.distribution_server, cmd)
124
128
  rescue => e
125
129
  fail "Error: Could not populate repos directory in #{Pkg::Config.distribution_server}:#{artifact_parent_directory}"
126
130
  end
@@ -143,7 +147,9 @@ module Pkg::Repo
143
147
  __APT_PLATFORMS__: Pkg::Config.apt_releases.join(' '),
144
148
  __GPG_KEY__: Pkg::Util::Gpg.key
145
149
  }
146
- Pkg::Util::Net.remote_ssh_cmd(remote_host, Pkg::Util::Misc.search_and_replace(command, whitelist))
150
+ Pkg::Util::Net.remote_execute(
151
+ remote_host,
152
+ Pkg::Util::Misc.search_and_replace(command, whitelist))
147
153
  end
148
154
  end
149
155
  end
@@ -16,7 +16,7 @@ module Pkg::Rpm::Repo
16
16
 
17
17
  Pkg::Util::RakeUtils.invoke_task("pl:fetch")
18
18
  repo_dir = "#{Pkg::Config.jenkins_repo_path}/#{Pkg::Config.project}/#{Pkg::Config.ref}/#{target}/rpm"
19
- Pkg::Util::Net.remote_ssh_cmd(Pkg::Config.distribution_server, "mkdir -p #{repo_dir}")
19
+ Pkg::Util::Net.remote_execute(Pkg::Config.distribution_server, "mkdir -p #{repo_dir}")
20
20
  Pkg::Util::Execution.retry_on_fail(:times => 3) do
21
21
  Pkg::Util::Net.rsync_to("pkg/#{target}/rpm/", Pkg::Config.distribution_server, repo_dir)
22
22
  end
@@ -215,7 +215,7 @@ module Pkg::Rpm::Repo
215
215
  command = Pkg::Rpm::Repo.repo_creation_command(File.join(artifact_directory, directory), artifact_paths)
216
216
 
217
217
  begin
218
- Pkg::Util::Net.remote_ssh_cmd(Pkg::Config.distribution_server, command)
218
+ Pkg::Util::Net.remote_execute(Pkg::Config.distribution_server, command)
219
219
  # Now that we've created our package repositories, we can generate repo
220
220
  # configurations for use with downstream jobs, acceptance clients, etc.
221
221
  Pkg::Rpm::Repo.generate_repo_configs
@@ -224,7 +224,7 @@ module Pkg::Rpm::Repo
224
224
  Pkg::Rpm::Repo.ship_repo_configs
225
225
  ensure
226
226
  # Always remove the lock file, even if we've failed
227
- Pkg::Util::Net.remote_ssh_cmd(Pkg::Config.distribution_server, "rm -f #{artifact_directory}/repos/.lock")
227
+ Pkg::Util::Net.remote_execute(Pkg::Config.distribution_server, "rm -f #{artifact_directory}/repos/.lock")
228
228
  end
229
229
  end
230
230
 
@@ -248,7 +248,7 @@ module Pkg::Rpm::Repo
248
248
  def deploy_repos(yum_path, origin_server, destination_server, dryrun = false)
249
249
  rsync_command = repo_deployment_command(yum_path, yum_path, destination_server, dryrun)
250
250
 
251
- Pkg::Util::Net.remote_ssh_cmd(origin_server, rsync_command)
251
+ Pkg::Util::Net.remote_execute(origin_server, rsync_command)
252
252
  end
253
253
  end
254
254
  end
@@ -15,10 +15,10 @@ module Pkg::Sign::Dmg
15
15
  work_dir = "/tmp/#{Pkg::Util.rand_string}"
16
16
  mount = File.join(work_dir, "mount")
17
17
  signed = File.join(work_dir, "signed")
18
- Pkg::Util::Net.remote_ssh_cmd(ssh_host_string, "mkdir -p #{mount} #{signed}")
18
+ Pkg::Util::Net.remote_execute(ssh_host_string, "mkdir -p #{mount} #{signed}")
19
19
  dmgs = Dir.glob("#{target_dir}/apple/**/*.dmg")
20
20
  Pkg::Util::Net.rsync_to(dmgs.join(" "), rsync_host_string, work_dir)
21
- Pkg::Util::Net.remote_ssh_cmd(ssh_host_string, %Q[for dmg in #{dmgs.map { |d| File.basename(d, ".dmg") }.join(" ")}; do
21
+ Pkg::Util::Net.remote_execute(ssh_host_string, %Q[for dmg in #{dmgs.map { |d| File.basename(d, ".dmg") }.join(" ")}; do
22
22
  /usr/bin/hdiutil attach #{work_dir}/$dmg.dmg -mountpoint #{mount} -nobrowse -quiet ;
23
23
  /usr/bin/security -q unlock-keychain -p "#{Pkg::Config.osx_signing_keychain_pw}" "#{Pkg::Config.osx_signing_keychain}" ;
24
24
  for pkg in $(ls #{mount}/*.pkg | xargs -n 1 basename); do
@@ -36,6 +36,6 @@ module Pkg::Sign::Dmg
36
36
  dmgs.each do | dmg |
37
37
  Pkg::Util::Net.rsync_from("#{work_dir}/#{File.basename(dmg)}", rsync_host_string, File.dirname(dmg))
38
38
  end
39
- Pkg::Util::Net.remote_ssh_cmd(ssh_host_string, "if [ -d '#{work_dir}' ]; then rm -rf '#{work_dir}'; fi")
39
+ Pkg::Util::Net.remote_execute(ssh_host_string, "if [ -d '#{work_dir}' ]; then rm -rf '#{work_dir}'; fi")
40
40
  end
41
41
  end