packaging 0.99.76 → 0.99.77
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/packaging/archive.rb +6 -6
- data/lib/packaging/config.rb +5 -1
- data/lib/packaging/deb/repo.rb +5 -5
- data/lib/packaging/platforms.rb +13 -34
- data/lib/packaging/repo.rb +9 -3
- data/lib/packaging/rpm/repo.rb +4 -4
- data/lib/packaging/sign/dmg.rb +3 -3
- 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 +13 -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 +14 -14
- 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/nightly_repos.rake +9 -9
- data/tasks/pe_ship.rake +11 -19
- data/tasks/ship.rake +25 -17
- data/tasks/sign.rake +3 -3
- metadata +17 -17
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",
|
@@ -202,9 +202,8 @@ describe "Pkg::Config" do
|
|
202
202
|
|
203
203
|
describe "#platform_data" do
|
204
204
|
platform_tags = [
|
205
|
-
'eos-4-i386',
|
206
205
|
'osx-10.15-x86_64',
|
207
|
-
'
|
206
|
+
'osx-11-x86_64',
|
208
207
|
'ubuntu-16.04-i386',
|
209
208
|
'el-6-x86_64',
|
210
209
|
'el-7-ppc64le',
|
@@ -212,16 +211,15 @@ describe "Pkg::Config" do
|
|
212
211
|
]
|
213
212
|
|
214
213
|
artifacts = \
|
215
|
-
"./artifacts/eos/4/PC1/i386/puppet-agent-5.3.2-1.eos4.i386.swix\n" \
|
216
214
|
"./artifacts/apple/10.15/PC1/x86_64/puppet-agent-5.3.2.658.gc79ef9a-1.osx10.15.dmg\n" \
|
217
|
-
"./artifacts/
|
215
|
+
"./artifacts/apple/11/PC1/x86_64/puppet-agent-5.3.2.658.gc79ef9a-1.osx11.dmg\n" \
|
218
216
|
"./artifacts/deb/xenial/PC1/puppet-agent_5.3.2-1xenial_i386.deb\n" \
|
219
217
|
"./artifacts/el/6/PC1/x86_64/puppet-agent-5.3.2.658.gc79ef9a-1.el6.x86_64.rpm\n" \
|
220
218
|
"./artifacts/el/7/PC1/ppc64le/puppet-agent-5.3.2-1.el7.ppc64le.rpm\n" \
|
221
219
|
"./artifacts/sles/12/PC1/x86_64/puppet-agent-5.3.2-1.sles12.x86_64.rpm"
|
222
220
|
|
223
221
|
aix_artifacts = \
|
224
|
-
"./artifacts/aix/
|
222
|
+
"./artifacts/aix/7.1/PC1/ppc/puppet-agent-5.3.2-1.aix7.1.ppc.rpm"
|
225
223
|
|
226
224
|
fedora_artifacts = \
|
227
225
|
"./artifacts/fedora/31/PC1/x86_64/puppet-agent-5.3.2-1.fc31.x86_64.rpm"
|
@@ -259,7 +257,7 @@ describe "Pkg::Config" do
|
|
259
257
|
end
|
260
258
|
|
261
259
|
it "should return a hash mapping platform tags to paths" do
|
262
|
-
allow(Pkg::Util::Net).to receive(:
|
260
|
+
allow(Pkg::Util::Net).to receive(:remote_execute).and_return(artifacts, nil)
|
263
261
|
expect(Pkg::Config.platform_data.keys).to eql(platform_tags)
|
264
262
|
end
|
265
263
|
|
@@ -279,21 +277,21 @@ describe "Pkg::Config" do
|
|
279
277
|
end
|
280
278
|
|
281
279
|
it "should not use 'f' in fedora platform tags" do
|
282
|
-
allow(Pkg::Util::Net).to receive(:
|
280
|
+
allow(Pkg::Util::Net).to receive(:remote_execute).and_return(fedora_artifacts, nil)
|
283
281
|
data = Pkg::Config.platform_data
|
284
282
|
expect(data).to include('fedora-31-x86_64')
|
285
283
|
expect(data).not_to include('fedora-f31-x86_64')
|
286
284
|
end
|
287
285
|
|
288
286
|
it "should collect packages whose extname differ from package_format" do
|
289
|
-
allow(Pkg::Util::Net).to receive(:
|
287
|
+
allow(Pkg::Util::Net).to receive(:remote_execute).and_return(solaris_artifacts, nil)
|
290
288
|
data = Pkg::Config.platform_data
|
291
289
|
expect(data).to include('solaris-10-i386' => {:artifact => './solaris/10/PC1/puppet-agent-5.3.2-1.i386.pkg.gz', :repo_config => nil})
|
292
290
|
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
291
|
end
|
294
292
|
|
295
293
|
it "should collect versioned msis" do
|
296
|
-
allow(Pkg::Util::Net).to receive(:
|
294
|
+
allow(Pkg::Util::Net).to receive(:remote_execute).and_return(windows_artifacts, nil)
|
297
295
|
data = Pkg::Config.platform_data
|
298
296
|
expect(data['windows-2012-x86']).to include(:artifact => './windows/puppet-agent-5.3.2-x86.msi')
|
299
297
|
expect(data['windows-2012-x64']).to include(:artifact => './windows/puppet-agent-5.3.2-x64.msi')
|
@@ -301,13 +299,13 @@ describe "Pkg::Config" do
|
|
301
299
|
end
|
302
300
|
|
303
301
|
it "should not collect debug packages" do
|
304
|
-
allow(Pkg::Util::Net).to receive(:
|
302
|
+
allow(Pkg::Util::Net).to receive(:remote_execute).and_return(stretch_artifacts, nil)
|
305
303
|
data = Pkg::Config.platform_data
|
306
304
|
expect(data['debian-9-amd64']).to include(:artifact => './deb/stretch/PC1/puppet-agent_5.3.2.658.gc79ef9a-1stretch_amd64.deb')
|
307
305
|
end
|
308
306
|
|
309
307
|
it "should collect packages that don't match the project name" do
|
310
|
-
allow(Pkg::Util::Net).to receive(:
|
308
|
+
allow(Pkg::Util::Net).to receive(:remote_execute).and_return(artifacts_not_matching_project, nil)
|
311
309
|
data = Pkg::Config.platform_data
|
312
310
|
expect(data['ubuntu-16.04-amd64']).to include(:artifact => './deb/xenial/pe-postgresql-contrib_2019.1.9.6.12-1xenial_amd64.deb')
|
313
311
|
expect(data['ubuntu-16.04-amd64'][:additional_artifacts].size).to eq(3)
|
@@ -317,15 +315,15 @@ describe "Pkg::Config" do
|
|
317
315
|
end
|
318
316
|
|
319
317
|
it "should use 'ppc' instead of 'power' in aix paths" do
|
320
|
-
allow(Pkg::Util::Net).to receive(:
|
318
|
+
allow(Pkg::Util::Net).to receive(:remote_execute).and_return(aix_artifacts, nil)
|
321
319
|
data = Pkg::Config.platform_data
|
322
|
-
expect(data['aix-
|
320
|
+
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
321
|
end
|
324
322
|
|
325
323
|
it "should not record an aix repo config" do
|
326
|
-
allow(Pkg::Util::Net).to receive(:
|
324
|
+
allow(Pkg::Util::Net).to receive(:remote_execute).and_return(aix_artifacts, nil)
|
327
325
|
data = Pkg::Config.platform_data
|
328
|
-
expect(data['aix-
|
326
|
+
expect(data['aix-7.1-power'][:repo_config]).to be_nil
|
329
327
|
end
|
330
328
|
end
|
331
329
|
|
@@ -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
|
@@ -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', ''],
|
@@ -128,7 +128,7 @@ describe "#Pkg::Repo" do
|
|
128
128
|
end
|
129
129
|
|
130
130
|
it 'should execute command if optional params are nil' do
|
131
|
-
expect(Pkg::Util::Net).to receive(:
|
131
|
+
expect(Pkg::Util::Net).to receive(:remote_execute).with(remote_host, "some command with #{repo_name} and #{repo_path} and stuff")
|
132
132
|
Pkg::Repo.update_repo(remote_host, repo_command, { :repo_name => repo_name, :repo_path => repo_path })
|
133
133
|
end
|
134
134
|
end
|
@@ -7,11 +7,12 @@ describe 'Pkg::Retrieve' do
|
|
7
7
|
remote_target = 'repos'
|
8
8
|
project = 'puppet-agent'
|
9
9
|
ref = 'b25e64984dd505391f248fe5501ad81e2645b6d2'
|
10
|
-
foss_platforms = ['el-7-x86_64', 'ubuntu-16.04-amd64', 'osx-10.11-x86_64', 'windows-2012-x64']
|
10
|
+
foss_platforms = ['el-7-x86_64', 'ubuntu-16.04-amd64', 'osx-10.15-x86_64', 'osx-11-x86_64', 'windows-2012-x64']
|
11
11
|
platform_data = {:platform_data => {
|
12
|
-
'aix-
|
12
|
+
'aix-7.1-power' => {:artifact => './aix/7.1/PC1/ppc/puppet-agent-5.3.2.155.gb25e649-1.aix7.1.ppc.rpm'},
|
13
13
|
'el-7-x86_64' => {:artifact => './el/7/PC1/x86_64/puppet-agent-5.3.2.155.gb25e649-1.el7.x86_64.rpm'},
|
14
|
-
'osx-10.
|
14
|
+
'osx-10.15-x86_64' => {:artifact => './apple/10.15/PC1/x86_64/puppet-agent-5.3.2.155.gb25e649-1.osx10.15.dmg'},
|
15
|
+
'osx-11-x86_64' => {:artifact => './apple/11/PC1/x86_64/puppet-agent-5.3.2.155.gb25e649-1.osx11.dmg'},
|
15
16
|
'sles-11-i386' => {:artifact => './sles/11/PC1/i386/puppet-agent-5.3.2.155.gb25e649-1.sles11.i386.rpm'},
|
16
17
|
'solaris-10-sparc' => {:artifact => './solaris/10/PC1/puppet-agent-5.3.2.155.gb25e649-1.sparc.pkg.gz'},
|
17
18
|
'ubuntu-16.04-amd64' => {:artifact => './deb/xenial/PC1/puppet-agent_5.3.2.155.gb25e649-1xenial_amd64.deb'},
|
@@ -102,10 +102,10 @@ describe "Pkg::Rpm::Repo" do
|
|
102
102
|
Pkg::Repo.should_receive(:directories_that_contain_packages).and_return(pkg_directories)
|
103
103
|
Pkg::Repo.should_receive(:populate_repo_directory)
|
104
104
|
Pkg::Rpm::Repo.should_receive(:repo_creation_command).and_return(command)
|
105
|
-
Pkg::Util::Net.should_receive(:
|
105
|
+
Pkg::Util::Net.should_receive(:remote_execute).with(Pkg::Config.distribution_server, command)
|
106
106
|
Pkg::Rpm::Repo.should_receive(:generate_repo_configs)
|
107
107
|
Pkg::Rpm::Repo.should_receive(:ship_repo_configs)
|
108
|
-
Pkg::Util::Net.should_receive(:
|
108
|
+
Pkg::Util::Net.should_receive(:remote_execute).with(Pkg::Config.distribution_server, "rm -f #{artifact_directory}/repos/.lock" )
|
109
109
|
Pkg::Rpm::Repo.create_remote_repos
|
110
110
|
end
|
111
111
|
end
|
@@ -125,7 +125,7 @@ describe "Pkg::Rpm::Repo" do
|
|
125
125
|
repo_dir = "#{Pkg::Config.jenkins_repo_path}/#{Pkg::Config.project}/#{Pkg::Config.ref}/repo_configs/rpm"
|
126
126
|
Pkg::Util::File.should_receive(:empty_dir?).with("pkg/repo_configs/rpm").and_return(false)
|
127
127
|
Pkg::Util::RakeUtils.should_receive(:invoke_task).with("pl:fetch")
|
128
|
-
Pkg::Util::Net.should_receive(:
|
128
|
+
Pkg::Util::Net.should_receive(:remote_execute).with(Pkg::Config.distribution_server, "mkdir -p #{repo_dir}")
|
129
129
|
Pkg::Util::Execution.should_receive(:retry_on_fail).with(:times => 3)
|
130
130
|
Pkg::Rpm::Repo.ship_repo_configs
|
131
131
|
end
|
@@ -65,7 +65,6 @@ DOC
|
|
65
65
|
describe '#sign_all' do
|
66
66
|
let(:rpm_directory) { 'foo' }
|
67
67
|
let(:rpms_not_to_sign) { [
|
68
|
-
"#{rpm_directory}/aix/6.1/PC1/ppc/puppet-agent-5.5.3-1.aix6.1.ppc.rpm",
|
69
68
|
"#{rpm_directory}/aix/7.1/PC1/ppc/puppet-agent-5.5.3-1.aix7.1.ppc.rpm",
|
70
69
|
] }
|
71
70
|
let(:v3_rpms) { [
|
@@ -77,7 +76,6 @@ DOC
|
|
77
76
|
] }
|
78
77
|
let(:rpms) { rpms_not_to_sign + v3_rpms + v4_rpms }
|
79
78
|
let(:already_signed_rpms) { [
|
80
|
-
"#{rpm_directory}/cisco-wrlinux/7/PC1/x86_64/puppet-agent-5.5.3-1.cisco_wrlinux7.x86_64.rpm",
|
81
79
|
"#{rpm_directory}/el/6/PC1/x86_64/puppet-agent-5.5.3-1.el6.x86_64.rpm",
|
82
80
|
] }
|
83
81
|
let(:noarch_rpms) { [
|
@@ -54,24 +54,35 @@ describe "Pkg::Util::Net" do
|
|
54
54
|
end
|
55
55
|
|
56
56
|
describe "remote_ssh_cmd" do
|
57
|
+
it "should be able to call via deprecated shim" do
|
58
|
+
Pkg::Util::Tool.should_receive(:check_tool).with("ssh").and_return(ssh)
|
59
|
+
Pkg::Util::Execution.should_receive(:capture3).with("#{ssh} -t foo 'set -e;bar'")
|
60
|
+
Pkg::Util::Execution.should_receive(:success?).and_return(true)
|
61
|
+
Pkg::Util::Net.remote_ssh_cmd("foo", "bar", true)
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
describe "remote_execute" do
|
57
66
|
it "should fail if ssh is not present" do
|
58
67
|
Pkg::Util::Tool.stub(:find_tool).with("ssh") { fail }
|
59
68
|
Pkg::Util::Tool.should_receive(:check_tool).with("ssh").and_raise(RuntimeError)
|
60
|
-
expect{ Pkg::Util::Net.
|
69
|
+
expect{ Pkg::Util::Net.remote_execute("foo", "bar") }.to raise_error(RuntimeError)
|
61
70
|
end
|
62
71
|
|
63
72
|
it "should be able to not fail fast" do
|
64
73
|
Pkg::Util::Tool.should_receive(:check_tool).with("ssh").and_return(ssh)
|
65
74
|
Kernel.should_receive(:system).with("#{ssh} -t foo 'bar'")
|
66
75
|
Pkg::Util::Execution.should_receive(:success?).and_return(true)
|
67
|
-
Pkg::Util::Net.
|
76
|
+
Pkg::Util::Net.remote_execute(
|
77
|
+
"foo", "bar", capture_output: false, extra_options: '', fail_fast: false)
|
68
78
|
end
|
69
79
|
|
70
80
|
it "should be able to trace output" do
|
71
81
|
Pkg::Util::Tool.should_receive(:check_tool).with("ssh").and_return(ssh)
|
72
82
|
Kernel.should_receive(:system).with("#{ssh} -t foo 'set -x;bar'")
|
73
83
|
Pkg::Util::Execution.should_receive(:success?).and_return(true)
|
74
|
-
Pkg::Util::Net.
|
84
|
+
Pkg::Util::Net.remote_execute(
|
85
|
+
"foo", "bar", capture_output: false, fail_fast: false, trace: true)
|
75
86
|
end
|
76
87
|
|
77
88
|
context "without output captured" do
|
@@ -79,21 +90,22 @@ describe "Pkg::Util::Net" do
|
|
79
90
|
Pkg::Util::Tool.should_receive(:check_tool).with("ssh").and_return(ssh)
|
80
91
|
Kernel.should_receive(:system).with("#{ssh} -t foo 'set -e;bar'")
|
81
92
|
Pkg::Util::Execution.should_receive(:success?).and_return(true)
|
82
|
-
Pkg::Util::Net.
|
93
|
+
Pkg::Util::Net.remote_execute("foo", "bar")
|
83
94
|
end
|
84
95
|
|
85
96
|
it "should escape single quotes in the command" do
|
86
97
|
Pkg::Util::Tool.should_receive(:check_tool).with("ssh").and_return(ssh)
|
87
98
|
Kernel.should_receive(:system).with("#{ssh} -t foo 'set -e;b'\\''ar'")
|
88
99
|
Pkg::Util::Execution.should_receive(:success?).and_return(true)
|
89
|
-
Pkg::Util::Net.
|
100
|
+
Pkg::Util::Net.remote_execute("foo", "b'ar")
|
90
101
|
end
|
91
102
|
|
92
103
|
it "should raise an error if ssh fails" do
|
93
104
|
Pkg::Util::Tool.should_receive(:check_tool).with("ssh").and_return(ssh)
|
94
105
|
Kernel.should_receive(:system).with("#{ssh} -t foo 'set -e;bar'")
|
95
106
|
Pkg::Util::Execution.should_receive(:success?).and_return(false)
|
96
|
-
expect{ Pkg::Util::Net.
|
107
|
+
expect{ Pkg::Util::Net.remote_execute("foo", "bar") }
|
108
|
+
.to raise_error(RuntimeError, /failed./)
|
97
109
|
end
|
98
110
|
end
|
99
111
|
|
@@ -102,21 +114,22 @@ describe "Pkg::Util::Net" do
|
|
102
114
|
Pkg::Util::Tool.should_receive(:check_tool).with("ssh").and_return(ssh)
|
103
115
|
Pkg::Util::Execution.should_receive(:capture3).with("#{ssh} -t foo 'set -e;bar'")
|
104
116
|
Pkg::Util::Execution.should_receive(:success?).and_return(true)
|
105
|
-
Pkg::Util::Net.
|
117
|
+
Pkg::Util::Net.remote_execute("foo", "bar", capture_output: true)
|
106
118
|
end
|
107
119
|
|
108
120
|
it "should escape single quotes in the command" do
|
109
121
|
Pkg::Util::Tool.should_receive(:check_tool).with("ssh").and_return(ssh)
|
110
122
|
Pkg::Util::Execution.should_receive(:capture3).with("#{ssh} -t foo 'set -e;b'\\''ar'")
|
111
123
|
Pkg::Util::Execution.should_receive(:success?).and_return(true)
|
112
|
-
Pkg::Util::Net.
|
124
|
+
Pkg::Util::Net.remote_execute("foo", "b'ar", capture_output: true)
|
113
125
|
end
|
114
126
|
|
115
127
|
it "should raise an error if ssh fails" do
|
116
128
|
Pkg::Util::Tool.should_receive(:check_tool).with("ssh").and_return(ssh)
|
117
129
|
Pkg::Util::Execution.should_receive(:capture3).with("#{ssh} -t foo 'set -e;bar'")
|
118
130
|
Pkg::Util::Execution.should_receive(:success?).and_return(false)
|
119
|
-
expect{ Pkg::Util::Net.
|
131
|
+
expect{ Pkg::Util::Net.remote_execute("foo", "bar", capture_output: true) }
|
132
|
+
.to raise_error(RuntimeError, /failed./)
|
120
133
|
end
|
121
134
|
end
|
122
135
|
end
|