packaging 0.99.76 → 0.99.80
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.
- checksums.yaml +4 -4
- data/lib/packaging/archive.rb +6 -6
- data/lib/packaging/artifactory.rb +0 -2
- data/lib/packaging/config.rb +5 -1
- data/lib/packaging/config/params.rb +1 -0
- data/lib/packaging/deb/repo.rb +5 -5
- data/lib/packaging/platforms.rb +22 -35
- data/lib/packaging/repo.rb +9 -3
- data/lib/packaging/rpm/repo.rb +4 -4
- data/lib/packaging/sign/dmg.rb +68 -30
- data/lib/packaging/sign/ips.rb +8 -8
- data/lib/packaging/sign/msi.rb +7 -3
- data/lib/packaging/util/net.rb +53 -31
- data/lib/packaging/util/ship.rb +4 -4
- data/spec/lib/packaging/artifactory_spec.rb +11 -11
- data/spec/lib/packaging/config_spec.rb +14 -15
- data/spec/lib/packaging/deb/repo_spec.rb +3 -3
- data/spec/lib/packaging/paths_spec.rb +8 -2
- data/spec/lib/packaging/platforms_spec.rb +15 -15
- data/spec/lib/packaging/repo_spec.rb +1 -1
- data/spec/lib/packaging/retrieve_spec.rb +4 -3
- data/spec/lib/packaging/rpm/repo_spec.rb +3 -3
- data/spec/lib/packaging/sign_spec.rb +0 -2
- data/spec/lib/packaging/util/net_spec.rb +22 -9
- data/spec/lib/packaging/util/ship_spec.rb +2 -2
- data/tasks/archive.rake +3 -4
- data/tasks/education.rake +5 -5
- data/tasks/gem.rake +17 -16
- data/tasks/nightly_repos.rake +9 -9
- data/tasks/pe_ship.rake +11 -19
- data/tasks/ship.rake +36 -18
- data/tasks/sign.rake +3 -3
- metadata +18 -18
data/lib/packaging/sign/msi.rb
CHANGED
|
@@ -8,7 +8,7 @@ module Pkg::Sign::Msi
|
|
|
8
8
|
rsync_host_string = "-e 'ssh #{use_identity}' Administrator@#{Pkg::Config.msi_signing_server}"
|
|
9
9
|
|
|
10
10
|
work_dir = "Windows/Temp/#{Pkg::Util.rand_string}"
|
|
11
|
-
Pkg::Util::Net.
|
|
11
|
+
Pkg::Util::Net.remote_execute(ssh_host_string, "mkdir -p C:/#{work_dir}")
|
|
12
12
|
msis = Dir.glob("#{target_dir}/windows*/**/*.msi")
|
|
13
13
|
Pkg::Util::Net.rsync_to(msis.join(" "), rsync_host_string, "/cygdrive/c/#{work_dir}",
|
|
14
14
|
extra_flags: ["--ignore-existing --relative"])
|
|
@@ -111,10 +111,14 @@ for msipath in #{msis.join(" ")}; do
|
|
|
111
111
|
done
|
|
112
112
|
CMD
|
|
113
113
|
|
|
114
|
-
Pkg::Util::Net.
|
|
114
|
+
Pkg::Util::Net.remote_execute(
|
|
115
|
+
ssh_host_string,
|
|
116
|
+
sign_command,
|
|
117
|
+
{ fail_fast: false }
|
|
118
|
+
)
|
|
115
119
|
msis.each do | msi |
|
|
116
120
|
Pkg::Util::Net.rsync_from("/cygdrive/c/#{work_dir}/#{msi}", rsync_host_string, File.dirname(msi))
|
|
117
121
|
end
|
|
118
|
-
Pkg::Util::Net.
|
|
122
|
+
Pkg::Util::Net.remote_execute(ssh_host_string, "if [ -d '/cygdrive/c/#{work_dir}' ]; then rm -rf '/cygdrive/c/#{work_dir}'; fi")
|
|
119
123
|
end
|
|
120
124
|
end
|
data/lib/packaging/util/net.rb
CHANGED
|
@@ -20,13 +20,11 @@ module Pkg::Util::Net
|
|
|
20
20
|
end
|
|
21
21
|
|
|
22
22
|
# Check that the current host matches the one we think it should
|
|
23
|
-
def check_host(host,
|
|
24
|
-
if hostname == host
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
return nil
|
|
29
|
-
end
|
|
23
|
+
def check_host(host, options = { required: true })
|
|
24
|
+
return true if hostname == host
|
|
25
|
+
|
|
26
|
+
fail "Error: #{hostname} does not match #{host}" if options[:required]
|
|
27
|
+
return nil
|
|
30
28
|
end
|
|
31
29
|
|
|
32
30
|
# @param hosts - An array of hosts to try ssh-ing into
|
|
@@ -38,7 +36,7 @@ module Pkg::Util::Net
|
|
|
38
36
|
errs = []
|
|
39
37
|
Array(hosts).flatten.each do |host|
|
|
40
38
|
begin
|
|
41
|
-
|
|
39
|
+
remote_execute(host, 'exit', { extra_options: '-oBatchMode=yes' })
|
|
42
40
|
rescue
|
|
43
41
|
errs << host
|
|
44
42
|
end
|
|
@@ -56,7 +54,8 @@ module Pkg::Util::Net
|
|
|
56
54
|
errs = []
|
|
57
55
|
Array(hosts).flatten.each do |host|
|
|
58
56
|
begin
|
|
59
|
-
|
|
57
|
+
remote_execute(host, "gpg --list-secret-keys #{gpg} > /dev/null 2&>1",
|
|
58
|
+
{ extra_options: '-oBatchMode=yes' })
|
|
60
59
|
rescue
|
|
61
60
|
errs << host
|
|
62
61
|
end
|
|
@@ -64,40 +63,62 @@ module Pkg::Util::Net
|
|
|
64
63
|
return errs
|
|
65
64
|
end
|
|
66
65
|
|
|
67
|
-
def
|
|
66
|
+
def remote_execute(target_host, command, user_options = {})
|
|
67
|
+
option_defaults = {
|
|
68
|
+
capture_output: false,
|
|
69
|
+
extra_options: '',
|
|
70
|
+
fail_fast: true,
|
|
71
|
+
trace: false
|
|
72
|
+
}
|
|
73
|
+
options = option_defaults.merge(user_options)
|
|
68
74
|
|
|
69
75
|
ssh = Pkg::Util::Tool.check_tool('ssh')
|
|
70
76
|
|
|
71
77
|
# we pass some pretty complicated commands in via ssh. We need this to fail
|
|
72
78
|
# if any part of the remote ssh command fails.
|
|
73
79
|
shell_flags = ''
|
|
74
|
-
shell_flags += 'set -e;' if fail_fast
|
|
75
|
-
shell_flags += 'set -x;' if trace
|
|
80
|
+
shell_flags += 'set -e;' if options[:fail_fast]
|
|
81
|
+
shell_flags += 'set -x;' if options[:trace]
|
|
76
82
|
shell_commands = "#{shell_flags}#{command}"
|
|
77
83
|
|
|
78
|
-
|
|
84
|
+
remote_command = "#{ssh} #{options[:extra_options]} -t #{target_host} " +
|
|
85
|
+
"'#{shell_commands.gsub("'", "'\\\\''")}'"
|
|
79
86
|
|
|
80
87
|
# This is NOT a good way to support this functionality.
|
|
81
|
-
# It needs to be refactored into a set of methods that
|
|
82
|
-
# other methods can use to safely and deterministically
|
|
83
|
-
# support dry-run operations.
|
|
84
|
-
# But I need to ship packages RIGHT NOW.
|
|
85
|
-
# - Ryan McKern, 13/01/2016
|
|
86
88
|
if ENV['DRYRUN']
|
|
87
89
|
puts "[DRY-RUN] Executing '#{command}' on #{target}"
|
|
88
90
|
puts "[DRY-RUN] #{cmd}"
|
|
89
|
-
return
|
|
91
|
+
return ''
|
|
90
92
|
end
|
|
91
93
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
94
|
+
# We're forced to make different calls depending on the capture_output option
|
|
95
|
+
# because something about our #capture3 method screws up gpg. This should
|
|
96
|
+
# be untangled.
|
|
97
|
+
if options[:capture_output]
|
|
98
|
+
stdout, stderr, exitstatus = Pkg::Util::Execution.capture3(remote_command)
|
|
99
|
+
Pkg::Util::Execution.success?(exitstatus) or
|
|
100
|
+
raise "Remote ssh command (\"#{remote_command}\") failed."
|
|
96
101
|
return stdout, stderr
|
|
97
|
-
else
|
|
98
|
-
Kernel.system(cmd)
|
|
99
|
-
Pkg::Util::Execution.success? or raise "Remote ssh command failed."
|
|
100
102
|
end
|
|
103
|
+
|
|
104
|
+
# Pkg::Util::Execution.capture3 reports its command but Kernel.system does not
|
|
105
|
+
# Let's print it out for some amount of consistency.
|
|
106
|
+
puts "Remote Execute: '#{remote_command}'"
|
|
107
|
+
Kernel.system(remote_command)
|
|
108
|
+
Pkg::Util::Execution.success? or
|
|
109
|
+
raise "Remote ssh command (\"#{remote_command}\") failed."
|
|
110
|
+
end
|
|
111
|
+
|
|
112
|
+
###
|
|
113
|
+
### Deprecated method implemented as a shim to the new `remote_execute` method
|
|
114
|
+
###
|
|
115
|
+
def remote_ssh_cmd(target, command, capture_output = false, extra_options = '', fail_fast = true, trace = false) # rubocop:disable Style/ParameterLists
|
|
116
|
+
puts "Warn: \"remote_ssh_cmd\" call in packaging is deprecated. Use \"remote_execute\" instead."
|
|
117
|
+
remote_execute(target, command, {
|
|
118
|
+
capture_output: capture_output,
|
|
119
|
+
extra_options: extra_options,
|
|
120
|
+
fail_fast: fail_fast,
|
|
121
|
+
trace: trace })
|
|
101
122
|
end
|
|
102
123
|
|
|
103
124
|
# Construct a valid rsync command
|
|
@@ -272,17 +293,17 @@ module Pkg::Util::Net
|
|
|
272
293
|
|
|
273
294
|
def remote_set_ownership(host, owner, group, files)
|
|
274
295
|
remote_cmd = "for file in #{files.join(" ")}; do if [[ -d $file ]] || ! `lsattr $file | grep -q '\\-i\\-'`; then sudo chown #{owner}:#{group} $file; else echo \"$file is immutable\"; fi; done"
|
|
275
|
-
Pkg::Util::Net.
|
|
296
|
+
Pkg::Util::Net.remote_execute(host, remote_cmd)
|
|
276
297
|
end
|
|
277
298
|
|
|
278
299
|
def remote_set_permissions(host, permissions, files)
|
|
279
300
|
remote_cmd = "for file in #{files.join(" ")}; do if [[ -d $file ]] || ! `lsattr $file | grep -q '\\-i\\-'`; then sudo chmod #{permissions} $file; else echo \"$file is immutable\"; fi; done"
|
|
280
|
-
Pkg::Util::Net.
|
|
301
|
+
Pkg::Util::Net.remote_execute(host, remote_cmd)
|
|
281
302
|
end
|
|
282
303
|
|
|
283
304
|
# Remotely set the immutable bit on a list of files
|
|
284
305
|
def remote_set_immutable(host, files)
|
|
285
|
-
Pkg::Util::Net.
|
|
306
|
+
Pkg::Util::Net.remote_execute(host, "sudo chattr +i #{files.join(" ")}")
|
|
286
307
|
end
|
|
287
308
|
|
|
288
309
|
# Create a symlink indicating the latest version of a package
|
|
@@ -328,7 +349,8 @@ module Pkg::Util::Net
|
|
|
328
349
|
ln -sf "$link_target" #{full_package_name}-latest.#{platform_ext}
|
|
329
350
|
CMD
|
|
330
351
|
|
|
331
|
-
_, err = Pkg::Util::Net.
|
|
352
|
+
_, err = Pkg::Util::Net.remote_execute(
|
|
353
|
+
Pkg::Config.staging_server, cmd, { capture_output: true })
|
|
332
354
|
$stderr.puts err
|
|
333
355
|
end
|
|
334
356
|
|
|
@@ -365,7 +387,7 @@ module Pkg::Util::Net
|
|
|
365
387
|
#{tar} -zxvf /tmp/#{tarball_name}.tar.gz -C /tmp/ ;
|
|
366
388
|
git clone --recursive /tmp/#{tarball_name} #{git_bundle_directory} ;
|
|
367
389
|
DOC
|
|
368
|
-
Pkg::Util::Net.
|
|
390
|
+
Pkg::Util::Net.remote_execute(host, command)
|
|
369
391
|
return git_bundle_directory
|
|
370
392
|
end
|
|
371
393
|
|
data/lib/packaging/util/ship.rb
CHANGED
|
@@ -86,7 +86,7 @@ module Pkg::Util::Ship
|
|
|
86
86
|
sub_string = 'pkg'
|
|
87
87
|
remote_pkg = pkg.sub(sub_string, remote_path)
|
|
88
88
|
remote_basepath = File.dirname(remote_pkg)
|
|
89
|
-
Pkg::Util::Net.
|
|
89
|
+
Pkg::Util::Net.remote_execute(staging_server, "mkdir -p #{remote_basepath}")
|
|
90
90
|
Pkg::Util::Net.rsync_to(
|
|
91
91
|
File.join(tmpdir, pkg),
|
|
92
92
|
staging_server,
|
|
@@ -202,7 +202,7 @@ module Pkg::Util::Ship
|
|
|
202
202
|
def create_rolling_repo_link(platform_tag, staging_server, repo_path, nonfinal = false)
|
|
203
203
|
command = rolling_repo_link_command(platform_tag, repo_path, nonfinal)
|
|
204
204
|
|
|
205
|
-
Pkg::Util::Net.
|
|
205
|
+
Pkg::Util::Net.remote_execute(staging_server, command) unless command.nil?
|
|
206
206
|
rescue => e
|
|
207
207
|
fail "Failed to create rolling repo link for '#{platform_tag}'.\n#{e}\n#{e.backtrace}"
|
|
208
208
|
end
|
|
@@ -265,13 +265,13 @@ module Pkg::Util::Ship
|
|
|
265
265
|
fi
|
|
266
266
|
ln -sf #{remote_path} #{link_path}
|
|
267
267
|
CMD
|
|
268
|
-
Pkg::Util::Net.
|
|
268
|
+
Pkg::Util::Net.remote_execute(Pkg::Config.staging_server, link_command)
|
|
269
269
|
end
|
|
270
270
|
end
|
|
271
271
|
|
|
272
272
|
def test_ship(vm, ship_task)
|
|
273
273
|
command = 'getent group release || groupadd release'
|
|
274
|
-
Pkg::Util::Net.
|
|
274
|
+
Pkg::Util::Net.remote_execute(vm, command)
|
|
275
275
|
hosts_to_override = %w(
|
|
276
276
|
APT_HOST
|
|
277
277
|
DMG_HOST
|
|
@@ -36,16 +36,16 @@ describe 'artifactory.rb' do
|
|
|
36
36
|
:repo_config => '',
|
|
37
37
|
:additional_artifacts => ["./windowsfips/puppet-agent-extras-5.3.1.34-x64.msi"],
|
|
38
38
|
},
|
|
39
|
-
'eos-4-i386' => {
|
|
40
|
-
:artifact => "./eos/4/PC1/i386/puppet-agent-5.3.1.34.gf65f9ef-1.eos4.i386.swix",
|
|
41
|
-
:repo_config => '',
|
|
42
|
-
:additional_artifacts => ["./eos/4/PC1/i386/puppet-agent-extras-5.3.1.34.gf65f9ef-1.eos4.i386.swix"],
|
|
43
|
-
},
|
|
44
39
|
'osx-10.15-x86_64' => {
|
|
45
40
|
:artifact => "./apple/10.15/PC1/x86_64/puppet-agent-5.3.1.34.gf65f9ef-1.osx10.15.dmg",
|
|
46
41
|
:repo_config => '',
|
|
47
42
|
:additional_artifacts => ["./apple/10.15/PC1/x86_64/puppet-agent-extras-5.3.1.34.gf65f9ef-1.osx10.15.dmg"],
|
|
48
43
|
},
|
|
44
|
+
'osx-11-x86_64' => {
|
|
45
|
+
:artifact => "./apple/11/PC1/x86_64/puppet-agent-5.3.1.34.gf65f9ef-1.osx11.dmg",
|
|
46
|
+
:repo_config => '',
|
|
47
|
+
:additional_artifacts => ["./apple/11/PC1/x86_64/puppet-agent-extras-5.3.1.34.gf65f9ef-1.osx11.dmg"],
|
|
48
|
+
},
|
|
49
49
|
'solaris-10-sparc' => {
|
|
50
50
|
:artifact => "./solaris/10/PC1/puppet-agent-5.3.1.34.gf65f9ef-1.sparc.pkg.gz",
|
|
51
51
|
:repo_config => '',
|
|
@@ -89,18 +89,18 @@ describe 'artifactory.rb' do
|
|
|
89
89
|
:package_name => 'path/to/a/windowsfips/package/puppet-agent-5.3.1.34-x64.msi',
|
|
90
90
|
:all_package_names => ['puppet-agent-5.3.1.34-x64.msi','puppet-agent-extras-5.3.1.34-x64.msi']
|
|
91
91
|
},
|
|
92
|
-
'eos-4-i386' => {
|
|
93
|
-
:toplevel_repo => 'generic',
|
|
94
|
-
:repo_subdirectories => "#{default_repo_name}/#{project}/#{project_version}/eos-4-i386",
|
|
95
|
-
:package_name => 'path/to/an/eos/4/package/puppet-agent-5.3.1.34.gf65f9ef-1.eos4.i386.swix',
|
|
96
|
-
:all_package_names => ['puppet-agent-5.3.1.34.gf65f9ef-1.eos4.i386.swix', 'puppet-agent-extras-5.3.1.34.gf65f9ef-1.eos4.i386.swix']
|
|
97
|
-
},
|
|
98
92
|
'osx-10.15-x86_64' => {
|
|
99
93
|
:toplevel_repo => 'generic',
|
|
100
94
|
:repo_subdirectories => "#{default_repo_name}/#{project}/#{project_version}/osx-10.15-x86_64",
|
|
101
95
|
:package_name => 'path/to/an/osx/10.15/package/puppet-agent-5.3.1.34.gf65f9ef-1.osx10.15.dmg',
|
|
102
96
|
:all_package_names => ['puppet-agent-5.3.1.34.gf65f9ef-1.osx10.15.dmg', 'puppet-agent-extras-5.3.1.34.gf65f9ef-1.osx10.15.dmg']
|
|
103
97
|
},
|
|
98
|
+
'osx-11-x86_64' => {
|
|
99
|
+
:toplevel_repo => 'generic',
|
|
100
|
+
:repo_subdirectories => "#{default_repo_name}/#{project}/#{project_version}/osx-11-x86_64",
|
|
101
|
+
:package_name => 'path/to/an/osx/11/package/puppet-agent-5.3.1.34.gf65f9ef-1.osx11.dmg',
|
|
102
|
+
:all_package_names => ['puppet-agent-5.3.1.34.gf65f9ef-1.osx11.dmg', 'puppet-agent-extras-5.3.1.34.gf65f9ef-1.osx11.dmg']
|
|
103
|
+
},
|
|
104
104
|
'solaris-10-sparc' => {
|
|
105
105
|
:toplevel_repo => 'generic',
|
|
106
106
|
:repo_subdirectories => "#{default_repo_name}/#{project}/#{project_version}/solaris-10-sparc",
|
|
@@ -52,6 +52,7 @@ describe "Pkg::Config" do
|
|
|
52
52
|
:gem_files,
|
|
53
53
|
:gem_forge_project,
|
|
54
54
|
:gem_host,
|
|
55
|
+
:gem_license,
|
|
55
56
|
:gem_name,
|
|
56
57
|
:gem_path,
|
|
57
58
|
:gem_platform_dependencies,
|
|
@@ -202,9 +203,8 @@ describe "Pkg::Config" do
|
|
|
202
203
|
|
|
203
204
|
describe "#platform_data" do
|
|
204
205
|
platform_tags = [
|
|
205
|
-
'eos-4-i386',
|
|
206
206
|
'osx-10.15-x86_64',
|
|
207
|
-
'
|
|
207
|
+
'osx-11-x86_64',
|
|
208
208
|
'ubuntu-16.04-i386',
|
|
209
209
|
'el-6-x86_64',
|
|
210
210
|
'el-7-ppc64le',
|
|
@@ -212,16 +212,15 @@ describe "Pkg::Config" do
|
|
|
212
212
|
]
|
|
213
213
|
|
|
214
214
|
artifacts = \
|
|
215
|
-
"./artifacts/eos/4/PC1/i386/puppet-agent-5.3.2-1.eos4.i386.swix\n" \
|
|
216
215
|
"./artifacts/apple/10.15/PC1/x86_64/puppet-agent-5.3.2.658.gc79ef9a-1.osx10.15.dmg\n" \
|
|
217
|
-
"./artifacts/
|
|
216
|
+
"./artifacts/apple/11/PC1/x86_64/puppet-agent-5.3.2.658.gc79ef9a-1.osx11.dmg\n" \
|
|
218
217
|
"./artifacts/deb/xenial/PC1/puppet-agent_5.3.2-1xenial_i386.deb\n" \
|
|
219
218
|
"./artifacts/el/6/PC1/x86_64/puppet-agent-5.3.2.658.gc79ef9a-1.el6.x86_64.rpm\n" \
|
|
220
219
|
"./artifacts/el/7/PC1/ppc64le/puppet-agent-5.3.2-1.el7.ppc64le.rpm\n" \
|
|
221
220
|
"./artifacts/sles/12/PC1/x86_64/puppet-agent-5.3.2-1.sles12.x86_64.rpm"
|
|
222
221
|
|
|
223
222
|
aix_artifacts = \
|
|
224
|
-
"./artifacts/aix/
|
|
223
|
+
"./artifacts/aix/7.1/PC1/ppc/puppet-agent-5.3.2-1.aix7.1.ppc.rpm"
|
|
225
224
|
|
|
226
225
|
fedora_artifacts = \
|
|
227
226
|
"./artifacts/fedora/31/PC1/x86_64/puppet-agent-5.3.2-1.fc31.x86_64.rpm"
|
|
@@ -259,7 +258,7 @@ describe "Pkg::Config" do
|
|
|
259
258
|
end
|
|
260
259
|
|
|
261
260
|
it "should return a hash mapping platform tags to paths" do
|
|
262
|
-
allow(Pkg::Util::Net).to receive(:
|
|
261
|
+
allow(Pkg::Util::Net).to receive(:remote_execute).and_return(artifacts, nil)
|
|
263
262
|
expect(Pkg::Config.platform_data.keys).to eql(platform_tags)
|
|
264
263
|
end
|
|
265
264
|
|
|
@@ -279,21 +278,21 @@ describe "Pkg::Config" do
|
|
|
279
278
|
end
|
|
280
279
|
|
|
281
280
|
it "should not use 'f' in fedora platform tags" do
|
|
282
|
-
allow(Pkg::Util::Net).to receive(:
|
|
281
|
+
allow(Pkg::Util::Net).to receive(:remote_execute).and_return(fedora_artifacts, nil)
|
|
283
282
|
data = Pkg::Config.platform_data
|
|
284
283
|
expect(data).to include('fedora-31-x86_64')
|
|
285
284
|
expect(data).not_to include('fedora-f31-x86_64')
|
|
286
285
|
end
|
|
287
286
|
|
|
288
287
|
it "should collect packages whose extname differ from package_format" do
|
|
289
|
-
allow(Pkg::Util::Net).to receive(:
|
|
288
|
+
allow(Pkg::Util::Net).to receive(:remote_execute).and_return(solaris_artifacts, nil)
|
|
290
289
|
data = Pkg::Config.platform_data
|
|
291
290
|
expect(data).to include('solaris-10-i386' => {:artifact => './solaris/10/PC1/puppet-agent-5.3.2-1.i386.pkg.gz', :repo_config => nil})
|
|
292
291
|
expect(data).to include('solaris-11-sparc' => {:artifact => './solaris/11/PC1/puppet-agent@5.3.2,5.11-1.sparc.p5p', :repo_config => nil})
|
|
293
292
|
end
|
|
294
293
|
|
|
295
294
|
it "should collect versioned msis" do
|
|
296
|
-
allow(Pkg::Util::Net).to receive(:
|
|
295
|
+
allow(Pkg::Util::Net).to receive(:remote_execute).and_return(windows_artifacts, nil)
|
|
297
296
|
data = Pkg::Config.platform_data
|
|
298
297
|
expect(data['windows-2012-x86']).to include(:artifact => './windows/puppet-agent-5.3.2-x86.msi')
|
|
299
298
|
expect(data['windows-2012-x64']).to include(:artifact => './windows/puppet-agent-5.3.2-x64.msi')
|
|
@@ -301,13 +300,13 @@ describe "Pkg::Config" do
|
|
|
301
300
|
end
|
|
302
301
|
|
|
303
302
|
it "should not collect debug packages" do
|
|
304
|
-
allow(Pkg::Util::Net).to receive(:
|
|
303
|
+
allow(Pkg::Util::Net).to receive(:remote_execute).and_return(stretch_artifacts, nil)
|
|
305
304
|
data = Pkg::Config.platform_data
|
|
306
305
|
expect(data['debian-9-amd64']).to include(:artifact => './deb/stretch/PC1/puppet-agent_5.3.2.658.gc79ef9a-1stretch_amd64.deb')
|
|
307
306
|
end
|
|
308
307
|
|
|
309
308
|
it "should collect packages that don't match the project name" do
|
|
310
|
-
allow(Pkg::Util::Net).to receive(:
|
|
309
|
+
allow(Pkg::Util::Net).to receive(:remote_execute).and_return(artifacts_not_matching_project, nil)
|
|
311
310
|
data = Pkg::Config.platform_data
|
|
312
311
|
expect(data['ubuntu-16.04-amd64']).to include(:artifact => './deb/xenial/pe-postgresql-contrib_2019.1.9.6.12-1xenial_amd64.deb')
|
|
313
312
|
expect(data['ubuntu-16.04-amd64'][:additional_artifacts].size).to eq(3)
|
|
@@ -317,15 +316,15 @@ describe "Pkg::Config" do
|
|
|
317
316
|
end
|
|
318
317
|
|
|
319
318
|
it "should use 'ppc' instead of 'power' in aix paths" do
|
|
320
|
-
allow(Pkg::Util::Net).to receive(:
|
|
319
|
+
allow(Pkg::Util::Net).to receive(:remote_execute).and_return(aix_artifacts, nil)
|
|
321
320
|
data = Pkg::Config.platform_data
|
|
322
|
-
expect(data['aix-
|
|
321
|
+
expect(data['aix-7.1-power']).to include(:artifact => './aix/7.1/PC1/ppc/puppet-agent-5.3.2-1.aix7.1.ppc.rpm')
|
|
323
322
|
end
|
|
324
323
|
|
|
325
324
|
it "should not record an aix repo config" do
|
|
326
|
-
allow(Pkg::Util::Net).to receive(:
|
|
325
|
+
allow(Pkg::Util::Net).to receive(:remote_execute).and_return(aix_artifacts, nil)
|
|
327
326
|
data = Pkg::Config.platform_data
|
|
328
|
-
expect(data['aix-
|
|
327
|
+
expect(data['aix-7.1-power'][:repo_config]).to be_nil
|
|
329
328
|
end
|
|
330
329
|
end
|
|
331
330
|
|
|
@@ -92,10 +92,10 @@ describe "Pkg::Deb::Repo" do
|
|
|
92
92
|
Pkg::Repo.should_receive(:directories_that_contain_packages).and_return(pkg_directories)
|
|
93
93
|
Pkg::Repo.should_receive(:populate_repo_directory)
|
|
94
94
|
Pkg::Deb::Repo.should_receive(:repo_creation_command).and_return(command)
|
|
95
|
-
Pkg::Util::Net.should_receive(:
|
|
95
|
+
Pkg::Util::Net.should_receive(:remote_execute).with(Pkg::Config.distribution_server, command)
|
|
96
96
|
Pkg::Deb::Repo.should_receive(:generate_repo_configs)
|
|
97
97
|
Pkg::Deb::Repo.should_receive(:ship_repo_configs)
|
|
98
|
-
Pkg::Util::Net.should_receive(:
|
|
98
|
+
Pkg::Util::Net.should_receive(:remote_execute).with(Pkg::Config.distribution_server, "rm -f #{artifact_directory}/repos/.lock" )
|
|
99
99
|
Pkg::Deb::Repo.create_repos
|
|
100
100
|
end
|
|
101
101
|
end
|
|
@@ -115,7 +115,7 @@ describe "Pkg::Deb::Repo" do
|
|
|
115
115
|
repo_dir = "#{Pkg::Config.jenkins_repo_path}/#{Pkg::Config.project}/#{Pkg::Config.ref}/repo_configs/deb"
|
|
116
116
|
Pkg::Util::File.should_receive(:empty_dir?).with("pkg/repo_configs/deb").and_return(false)
|
|
117
117
|
Pkg::Util::RakeUtils.should_receive(:invoke_task).with("pl:fetch")
|
|
118
|
-
Pkg::Util::Net.should_receive(:
|
|
118
|
+
Pkg::Util::Net.should_receive(:remote_execute).with(Pkg::Config.distribution_server, "mkdir -p #{repo_dir}")
|
|
119
119
|
Pkg::Util::Execution.should_receive(:retry_on_fail).with(:times => 3)
|
|
120
120
|
Pkg::Deb::Repo.ship_repo_configs
|
|
121
121
|
end
|
|
@@ -3,7 +3,6 @@ require 'spec_helper'
|
|
|
3
3
|
describe 'Pkg::Paths' do
|
|
4
4
|
describe '#arch_from_artifact_path' do
|
|
5
5
|
arch_transformations = {
|
|
6
|
-
['artifacts/aix/6.1/puppet6/ppc/puppet-agent-6.9.0-1.aix6.1.ppc.rpm', 'aix', '6.1'] => 'power',
|
|
7
6
|
['pkg/el-8-x86_64/puppet-agent-6.9.0-1.el8.x86_64.rpm', 'el', '8'] => 'x86_64',
|
|
8
7
|
['pkg/el/8/puppet6/aarch64/puppet-agent-6.5.0.3094.g16b6fa6f-1.el8.aarch64.rpm', 'el', '8'] => 'aarch64',
|
|
9
8
|
['artifacts/fedora/32/puppet6/x86_64/puppet-agent-6.9.0-1.fc30.x86_64.rpm', 'fedora', '32'] => 'x86_64',
|
|
@@ -24,7 +23,6 @@ describe 'Pkg::Paths' do
|
|
|
24
23
|
|
|
25
24
|
describe '#tag_from_artifact_path' do
|
|
26
25
|
path_tranformations = {
|
|
27
|
-
'artifacts/aix/6.1/puppet6/ppc/puppet-agent-6.9.0-1.aix6.1.ppc.rpm' => 'aix-6.1-power',
|
|
28
26
|
'pkg/el-7-x86_64/puppet-agent-5.5.22-1.el8.x86_64.rpm' => 'el-7-x86_64',
|
|
29
27
|
'pkg/ubuntu-20.04-amd64/puppet-agent_5.5.22-1xenial_amd64.deb' => 'ubuntu-20.04-amd64',
|
|
30
28
|
'pkg/windows/puppet-agent-5.5.22-x86.msi' => 'windows-2012-x86',
|
|
@@ -35,6 +33,7 @@ describe 'Pkg::Paths' do
|
|
|
35
33
|
'pkg/pe/deb/bionic/pe-puppetserver_2019.8.2.32-1bionic_all.deb' => 'ubuntu-18.04-amd64',
|
|
36
34
|
'artifacts/deb/focal/puppet6/puppetdb_6.13.0-1focal_all.deb' => 'ubuntu-20.04-amd64',
|
|
37
35
|
'pkg/apple/10.15/puppet6/x86_64/puppet-agent-6.19.0-1.osx10.15.dmg' => 'osx-10.15-x86_64',
|
|
36
|
+
'pkg/apple/11/puppet6/x86_64/puppet-agent-6.19.0-1.osx11.dmg' => 'osx-11-x86_64',
|
|
38
37
|
'pkg/windows/puppet-agent-1.9.0-x86.msi' => 'windows-2012-x86',
|
|
39
38
|
'pkg/pe/rpm/el-6-i386/pe-puppetserver-2017.3.0.3-1.el6.src.rpm' => 'el-6-SRPMS',
|
|
40
39
|
'pkg/pe/deb/xenial/pe-puppetserver_2017.3.0.3-1puppet1.orig.tar.gz' => 'ubuntu-16.04-source',
|
|
@@ -125,6 +124,11 @@ describe 'Pkg::Paths' do
|
|
|
125
124
|
.to eq('artifacts/mac/puppet6/10.15/x86_64')
|
|
126
125
|
end
|
|
127
126
|
|
|
127
|
+
it 'should be correct for osx11' do
|
|
128
|
+
expect(Pkg::Paths.artifacts_path('osx-11-x86_64'))
|
|
129
|
+
.to eq('artifacts/mac/puppet6/11/x86_64')
|
|
130
|
+
end
|
|
131
|
+
|
|
128
132
|
it 'should be correct for windows' do
|
|
129
133
|
expect(Pkg::Paths.artifacts_path('windows-2012-x64'))
|
|
130
134
|
.to eq('artifacts/windows/puppet6')
|
|
@@ -368,6 +372,7 @@ describe 'Pkg::Paths' do
|
|
|
368
372
|
end
|
|
369
373
|
it 'returns nil for package formats that do not have release packages' do
|
|
370
374
|
expect(Pkg::Paths.release_package_link_path('osx-10.15-x86_64')).to eq(nil)
|
|
375
|
+
expect(Pkg::Paths.release_package_link_path('osx-11-x86_64')).to eq(nil)
|
|
371
376
|
expect(Pkg::Paths.release_package_link_path('windows-2012-x86')).to eq(nil)
|
|
372
377
|
end
|
|
373
378
|
end
|
|
@@ -405,6 +410,7 @@ describe 'Pkg::Paths' do
|
|
|
405
410
|
end
|
|
406
411
|
it 'returns nil for package formats that do not have release packages' do
|
|
407
412
|
expect(Pkg::Paths.release_package_link_path('osx-10.15-x86_64')).to eq(nil)
|
|
413
|
+
expect(Pkg::Paths.release_package_link_path('osx-11-x86_64')).to eq(nil)
|
|
408
414
|
expect(Pkg::Paths.release_package_link_path('windows-2012-x86')).to eq(nil)
|
|
409
415
|
end
|
|
410
416
|
end
|
|
@@ -4,7 +4,7 @@ describe 'Pkg::Platforms' do
|
|
|
4
4
|
describe '#by_package_format' do
|
|
5
5
|
it 'should return an array of platforms that use a given format' do
|
|
6
6
|
deb_platforms = ['debian', 'ubuntu']
|
|
7
|
-
rpm_platforms = ['aix', '
|
|
7
|
+
rpm_platforms = ['aix', 'el', 'fedora', 'redhatfips', 'sles']
|
|
8
8
|
expect(Pkg::Platforms.by_package_format('deb')).to match_array(deb_platforms)
|
|
9
9
|
expect(Pkg::Platforms.by_package_format('rpm')).to match_array(rpm_platforms)
|
|
10
10
|
end
|
|
@@ -12,14 +12,14 @@ describe 'Pkg::Platforms' do
|
|
|
12
12
|
|
|
13
13
|
describe '#formats' do
|
|
14
14
|
it 'should return all package formats' do
|
|
15
|
-
fmts = ['rpm', 'deb', '
|
|
15
|
+
fmts = ['rpm', 'deb', 'dmg', 'svr4', 'ips', 'msi']
|
|
16
16
|
expect(Pkg::Platforms.formats).to match_array(fmts)
|
|
17
17
|
end
|
|
18
18
|
end
|
|
19
19
|
|
|
20
20
|
describe '#supported_platforms' do
|
|
21
21
|
it 'should return all supported platforms' do
|
|
22
|
-
platforms = ['aix', '
|
|
22
|
+
platforms = ['aix', 'debian', 'el', 'fedora', 'osx', 'redhatfips', 'sles', 'solaris', 'ubuntu', 'windows', 'windowsfips']
|
|
23
23
|
expect(Pkg::Platforms.supported_platforms).to match_array(platforms)
|
|
24
24
|
end
|
|
25
25
|
end
|
|
@@ -36,7 +36,7 @@ describe 'Pkg::Platforms' do
|
|
|
36
36
|
|
|
37
37
|
describe '#codenames' do
|
|
38
38
|
it 'should return all codenames for a given platform' do
|
|
39
|
-
codenames = ['focal', 'bionic', 'buster', 'cosmic', 'jessie', 'stretch', 'trusty', 'xenial']
|
|
39
|
+
codenames = ['focal', 'bionic', 'bullseye', 'buster', 'cosmic', 'jessie', 'stretch', 'trusty', 'xenial']
|
|
40
40
|
expect(Pkg::Platforms.codenames).to match_array(codenames)
|
|
41
41
|
end
|
|
42
42
|
end
|
|
@@ -97,14 +97,16 @@ describe 'Pkg::Platforms' do
|
|
|
97
97
|
end
|
|
98
98
|
|
|
99
99
|
describe '#platform_lookup' do
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
100
|
+
['osx-10.15-x86_64', 'osx-11-x86_64'].each do |platform|
|
|
101
|
+
it 'should return a hash of platform info' do
|
|
102
|
+
expect(Pkg::Platforms.platform_lookup(platform)).to be_instance_of(Hash)
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
it 'should include at least arch and package format keys' do
|
|
106
|
+
expect(Pkg::Platforms.platform_lookup(platform).keys).to include(:architectures)
|
|
107
|
+
expect(Pkg::Platforms.platform_lookup(platform).keys).to include(:package_format)
|
|
108
|
+
end
|
|
109
|
+
end
|
|
108
110
|
end
|
|
109
111
|
|
|
110
112
|
describe '#get_attribute' do
|
|
@@ -113,7 +115,7 @@ describe 'Pkg::Platforms' do
|
|
|
113
115
|
end
|
|
114
116
|
|
|
115
117
|
it 'fails with a reasonable error when specified attribute is not defined' do
|
|
116
|
-
expect { Pkg::Platforms.get_attribute('
|
|
118
|
+
expect { Pkg::Platforms.get_attribute('osx-10.15-x86_64', :signature_format) }.to raise_error(/doesn't have information/)
|
|
117
119
|
end
|
|
118
120
|
end
|
|
119
121
|
|
|
@@ -129,8 +131,6 @@ describe 'Pkg::Platforms' do
|
|
|
129
131
|
'windows-2012-x86' => ['windows', '2012', 'x86'],
|
|
130
132
|
'windowsfips-2012-x64' => ['windowsfips', '2012', 'x64'],
|
|
131
133
|
'el-7-x86_64' => ['el', '7', 'x86_64'],
|
|
132
|
-
'cisco-wrlinux-7-x86_64' => ['cisco-wrlinux', '7', 'x86_64'],
|
|
133
|
-
'cisco-wrlinux-7' => ['cisco-wrlinux', '7', ''],
|
|
134
134
|
'el-6' => ['el', '6', ''],
|
|
135
135
|
'xenial-amd64' => ['ubuntu', '16.04', 'amd64'],
|
|
136
136
|
'xenial' => ['ubuntu', '16.04', ''],
|