packaging 0.88.77 → 0.99.0
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 +5 -5
- data/README.md +128 -74
- data/lib/packaging/artifactory.rb +60 -433
- data/lib/packaging/config/params.rb +7 -28
- data/lib/packaging/config.rb +50 -150
- data/lib/packaging/deb/repo.rb +19 -20
- data/lib/packaging/gem.rb +83 -41
- data/lib/packaging/ips.rb +57 -0
- data/lib/packaging/msi.rb +89 -0
- data/lib/packaging/nuget.rb +1 -1
- data/lib/packaging/osx.rb +36 -0
- data/lib/packaging/paths.rb +87 -225
- data/lib/packaging/platforms.rb +416 -443
- data/lib/packaging/repo.rb +22 -122
- data/lib/packaging/retrieve.rb +7 -36
- data/lib/packaging/rpm/repo.rb +8 -5
- data/lib/packaging/tar.rb +0 -9
- data/lib/packaging/util/date.rb +0 -5
- data/lib/packaging/util/execution.rb +2 -2
- data/lib/packaging/util/git.rb +1 -1
- data/lib/packaging/util/gpg.rb +1 -5
- data/lib/packaging/util/net.rb +37 -79
- data/lib/packaging/util/rake_utils.rb +0 -1
- data/lib/packaging/util/ship.rb +13 -142
- data/lib/packaging/util/tool.rb +1 -1
- data/lib/packaging/util/version.rb +0 -8
- data/lib/packaging/util.rb +2 -2
- data/lib/packaging.rb +3 -3
- data/spec/fixtures/config/params.yaml +2 -0
- data/spec/lib/packaging/artifactory_spec.rb +16 -66
- data/spec/lib/packaging/config_spec.rb +29 -49
- data/spec/lib/packaging/deb/repo_spec.rb +7 -16
- data/spec/lib/packaging/paths_spec.rb +56 -321
- data/spec/lib/packaging/platforms_spec.rb +21 -46
- data/spec/lib/packaging/repo_spec.rb +40 -78
- data/spec/lib/packaging/retrieve_spec.rb +8 -47
- data/spec/lib/packaging/rpm/repo_spec.rb +4 -4
- data/spec/lib/packaging/tar_spec.rb +40 -34
- data/spec/lib/packaging/util/git_tag_spec.rb +1 -1
- data/spec/lib/packaging/util/gpg_spec.rb +1 -1
- data/spec/lib/packaging/util/net_spec.rb +15 -35
- data/spec/lib/packaging/util/ship_spec.rb +63 -145
- data/spec/spec_helper.rb +14 -0
- data/tasks/00_utils.rake +6 -4
- data/tasks/apple.rake +0 -2
- data/tasks/config.rake +0 -5
- data/tasks/education.rake +5 -5
- data/tasks/fetch.rake +14 -17
- data/tasks/gem.rake +121 -134
- data/tasks/jenkins.rake +7 -51
- data/tasks/nightly_repos.rake +69 -20
- data/tasks/pe_ship.rake +11 -16
- data/tasks/retrieve.rake +6 -13
- data/tasks/ship.rake +256 -196
- data/tasks/sign.rake +135 -63
- data/tasks/tar.rake +6 -0
- data/templates/packaging.xml.erb +7 -9
- data/templates/repo.xml.erb +3 -6
- metadata +27 -80
- data/lib/packaging/archive.rb +0 -126
- data/lib/packaging/artifactory/extensions.rb +0 -94
- data/lib/packaging/config/validations.rb +0 -13
- data/lib/packaging/metrics.rb +0 -15
- data/lib/packaging/sign/deb.rb +0 -9
- data/lib/packaging/sign/dmg.rb +0 -41
- data/lib/packaging/sign/ips.rb +0 -57
- data/lib/packaging/sign/msi.rb +0 -124
- data/lib/packaging/sign/rpm.rb +0 -115
- data/lib/packaging/sign.rb +0 -8
- data/spec/lib/packaging/gem_spec.rb +0 -86
- data/spec/lib/packaging/sign_spec.rb +0 -133
- data/tasks/archive.rake +0 -69
data/lib/packaging/util/ship.rb
CHANGED
@@ -24,14 +24,14 @@ module Pkg::Util::Ship
|
|
24
24
|
#
|
25
25
|
# If this is platform_independent the packages will not get reorganized,
|
26
26
|
# just copied under the tmp directory for more consistent workflows
|
27
|
-
def reorganize_packages(pkgs, tmp, platform_independent = false
|
27
|
+
def reorganize_packages(pkgs, tmp, platform_independent = false)
|
28
28
|
new_pkgs = []
|
29
29
|
pkgs.each do |pkg|
|
30
30
|
if platform_independent
|
31
31
|
path = 'pkg'
|
32
32
|
else
|
33
33
|
platform_tag = Pkg::Paths.tag_from_artifact_path(pkg)
|
34
|
-
path = Pkg::Paths.artifacts_path(platform_tag, 'pkg'
|
34
|
+
path = Pkg::Paths.artifacts_path(platform_tag, 'pkg')
|
35
35
|
end
|
36
36
|
FileUtils.mkdir_p File.join(tmp, path)
|
37
37
|
FileUtils.cp pkg, File.join(tmp, path)
|
@@ -64,16 +64,15 @@ module Pkg::Util::Ship
|
|
64
64
|
options = {
|
65
65
|
excludes: [],
|
66
66
|
chattr: true,
|
67
|
-
platform_independent: false
|
68
|
-
nonfinal: false }.merge(opts)
|
67
|
+
platform_independent: false }.merge(opts)
|
69
68
|
|
70
69
|
# First find the packages to be shipped. We must find them before moving
|
71
70
|
# to our temporary staging directory
|
72
71
|
local_packages = collect_packages(pkg_exts, options[:excludes])
|
73
|
-
return
|
72
|
+
return if local_packages.empty?
|
74
73
|
|
75
74
|
tmpdir = Dir.mktmpdir
|
76
|
-
staged_pkgs = reorganize_packages(local_packages, tmpdir, options[:platform_independent]
|
75
|
+
staged_pkgs = reorganize_packages(local_packages, tmpdir, options[:platform_independent])
|
77
76
|
|
78
77
|
puts staged_pkgs.sort
|
79
78
|
puts "Do you want to ship the above files to (#{staging_server})?"
|
@@ -86,7 +85,7 @@ module Pkg::Util::Ship
|
|
86
85
|
sub_string = 'pkg'
|
87
86
|
remote_pkg = pkg.sub(sub_string, remote_path)
|
88
87
|
remote_basepath = File.dirname(remote_pkg)
|
89
|
-
Pkg::Util::Net.
|
88
|
+
Pkg::Util::Net.remote_ssh_cmd(staging_server, "mkdir -p #{remote_basepath}")
|
90
89
|
Pkg::Util::Net.rsync_to(
|
91
90
|
File.join(tmpdir, pkg),
|
92
91
|
staging_server,
|
@@ -100,77 +99,11 @@ module Pkg::Util::Ship
|
|
100
99
|
Pkg::Util::Net.remote_set_immutable(staging_server, [remote_pkg]) if options[:chattr]
|
101
100
|
end
|
102
101
|
end
|
103
|
-
return true
|
104
102
|
end
|
105
103
|
end
|
106
104
|
|
107
|
-
def
|
108
|
-
|
109
|
-
"#{local_staging_directory}/**/*.rpm",
|
110
|
-
"#{local_staging_directory}/**/*.srpm"
|
111
|
-
]
|
112
|
-
ship_pkgs(things_to_ship, Pkg::Config.yum_staging_server, remote_path, opts)
|
113
|
-
end
|
114
|
-
|
115
|
-
def ship_debs(local_staging_directory, remote_path, opts = {})
|
116
|
-
things_to_ship = [
|
117
|
-
"#{local_staging_directory}/**/*.debian.tar.gz",
|
118
|
-
"#{local_staging_directory}/**/*.orig.tar.gz",
|
119
|
-
"#{local_staging_directory}/**/*.dsc",
|
120
|
-
"#{local_staging_directory}/**/*.deb",
|
121
|
-
"#{local_staging_directory}/**/*.changes"
|
122
|
-
]
|
123
|
-
ship_pkgs(things_to_ship, Pkg::Config.apt_signing_server, remote_path, opts)
|
124
|
-
end
|
125
|
-
|
126
|
-
def ship_svr4(local_staging_directory, remote_path, opts = {})
|
127
|
-
ship_pkgs(["#{local_staging_directory}/**/*.pkg.gz"], Pkg::Config.svr4_host, remote_path, opts)
|
128
|
-
end
|
129
|
-
|
130
|
-
def ship_p5p(local_staging_directory, remote_path, opts = {})
|
131
|
-
ship_pkgs(["#{local_staging_directory}/**/*.p5p"], Pkg::Config.p5p_host, remote_path, opts)
|
132
|
-
end
|
133
|
-
|
134
|
-
def ship_dmg(local_staging_directory, remote_path, opts = {})
|
135
|
-
packages_have_shipped = ship_pkgs(["#{local_staging_directory}/**/*.dmg"],
|
136
|
-
Pkg::Config.dmg_staging_server, remote_path, opts)
|
137
|
-
|
138
|
-
if packages_have_shipped
|
139
|
-
Pkg::Platforms.platform_tags_for_package_format('dmg').each do |platform_tag|
|
140
|
-
# Create the latest symlink for the current supported repo
|
141
|
-
Pkg::Util::Net.remote_create_latest_symlink(
|
142
|
-
Pkg::Config.project,
|
143
|
-
Pkg::Paths.artifacts_path(platform_tag, remote_path, opts[:nonfinal]),
|
144
|
-
'dmg'
|
145
|
-
)
|
146
|
-
end
|
147
|
-
end
|
148
|
-
end
|
149
|
-
|
150
|
-
def ship_swix(local_staging_directory, remote_path, opts = {})
|
151
|
-
ship_pkgs(["#{local_staging_directory}/**/*.swix"], Pkg::Config.swix_staging_server, remote_path, opts)
|
152
|
-
end
|
153
|
-
|
154
|
-
def ship_msi(local_staging_directory, remote_path, opts = {})
|
155
|
-
packages_have_shipped = ship_pkgs(["#{local_staging_directory}/**/*.msi"], Pkg::Config.msi_staging_server, remote_path, opts)
|
156
|
-
|
157
|
-
if packages_have_shipped
|
158
|
-
# Create the symlinks for the latest supported repo
|
159
|
-
Pkg::Util::Net.remote_create_latest_symlink(Pkg::Config.project, Pkg::Paths.artifacts_path(Pkg::Platforms.generic_platform_tag('windows'), remote_path, opts[:nonfinal]), 'msi', arch: 'x64')
|
160
|
-
Pkg::Util::Net.remote_create_latest_symlink(Pkg::Config.project, Pkg::Paths.artifacts_path(Pkg::Platforms.generic_platform_tag('windows'), remote_path, opts[:nonfinal]), 'msi', arch: 'x86')
|
161
|
-
end
|
162
|
-
end
|
163
|
-
|
164
|
-
def ship_gem(local_staging_directory, remote_path, opts = {})
|
165
|
-
ship_pkgs(["#{local_staging_directory}/*.gem*"], Pkg::Config.gem_host, remote_path, opts)
|
166
|
-
end
|
167
|
-
|
168
|
-
def ship_tar(local_staging_directory, remote_path, opts = {})
|
169
|
-
ship_pkgs(["#{local_staging_directory}/*.tar.gz*"], Pkg::Config.tar_staging_server, remote_path, opts)
|
170
|
-
end
|
171
|
-
|
172
|
-
def rolling_repo_link_command(platform_tag, repo_path, nonfinal = false)
|
173
|
-
base_path, link_path = Pkg::Paths.artifacts_base_path_and_link_path(platform_tag, repo_path, nonfinal)
|
105
|
+
def rolling_repo_link_command(platform_tag, repo_path)
|
106
|
+
base_path, link_path = Pkg::Paths.artifacts_base_path_and_link_path(platform_tag, repo_path)
|
174
107
|
|
175
108
|
if link_path.nil?
|
176
109
|
puts "No link target set, not creating rolling repo link for #{base_path}"
|
@@ -199,79 +132,17 @@ module Pkg::Util::Ship
|
|
199
132
|
CMD
|
200
133
|
end
|
201
134
|
|
202
|
-
def create_rolling_repo_link(platform_tag, staging_server, repo_path
|
203
|
-
command = rolling_repo_link_command(platform_tag, repo_path
|
135
|
+
def create_rolling_repo_link(platform_tag, staging_server, repo_path)
|
136
|
+
command = rolling_repo_link_command(platform_tag, repo_path)
|
204
137
|
|
205
|
-
Pkg::Util::Net.
|
138
|
+
Pkg::Util::Net.remote_ssh_cmd(staging_server, command) unless command.nil?
|
206
139
|
rescue => e
|
207
|
-
fail "Failed to create rolling repo link for '#{platform_tag}'.\n#{e}
|
208
|
-
end
|
209
|
-
|
210
|
-
# create all of the rolling repo links in one step
|
211
|
-
def create_rolling_repo_links(nonfinal = false)
|
212
|
-
yum_path = Pkg::Paths.remote_repo_base(nonfinal: nonfinal, package_format: 'rpm')
|
213
|
-
dmg_path = Pkg::Paths.remote_repo_base(nonfinal: nonfinal, package_format: 'dmg')
|
214
|
-
swix_path = Pkg::Paths.remote_repo_base(nonfinal: nonfinal, package_format: 'swix')
|
215
|
-
msi_path = Pkg::Paths.remote_repo_base(nonfinal: nonfinal, package_format: 'msi')
|
216
|
-
|
217
|
-
create_rolling_repo_link(Pkg::Platforms.generic_platform_tag('el'), Pkg::Config.yum_staging_server, yum_path, nonfinal)
|
218
|
-
create_rolling_repo_link(Pkg::Platforms.generic_platform_tag('osx'), Pkg::Config.dmg_staging_server, dmg_path, nonfinal)
|
219
|
-
create_rolling_repo_link(Pkg::Platforms.generic_platform_tag('eos'), Pkg::Config.swix_staging_server, swix_path, nonfinal)
|
220
|
-
create_rolling_repo_link(Pkg::Platforms.generic_platform_tag('windows'), Pkg::Config.msi_staging_server, msi_path, nonfinal)
|
221
|
-
|
222
|
-
# We need to iterate through all the supported platforms here because of
|
223
|
-
# how deb repos are set up. Each codename will have its own link from the
|
224
|
-
# current versioned repo (e.g. puppet5) to the rolling repo. The one thing
|
225
|
-
# we don't care about is architecture, so we just grab the first supported
|
226
|
-
# architecture for the code name we're working with at the moment. [written
|
227
|
-
# by Melissa, copied by Molly]
|
228
|
-
|
229
|
-
apt_path = Pkg::Config.apt_repo_staging_path
|
230
|
-
if nonfinal
|
231
|
-
apt_path = Pkg::Config.nonfinal_apt_repo_staging_path
|
232
|
-
end
|
233
|
-
Pkg::Platforms.codenames.each do |codename|
|
234
|
-
create_rolling_repo_link(Pkg::Platforms.codename_to_tags(codename)[0], Pkg::Config.apt_signing_server, apt_path, nonfinal)
|
235
|
-
end
|
236
|
-
end
|
237
|
-
|
238
|
-
def update_release_package_symlinks(local_staging_directory, nonfinal = false)
|
239
|
-
local_packages = collect_packages(["#{local_staging_directory}/**/*.rpm", "#{local_staging_directory}/**/*.deb"])
|
240
|
-
local_packages.each do |package|
|
241
|
-
platform_tag = Pkg::Paths.tag_from_artifact_path(package)
|
242
|
-
package_format = Pkg::Platforms.package_format_for_tag(platform_tag)
|
243
|
-
case package_format
|
244
|
-
when 'rpm'
|
245
|
-
remote_base = Pkg::Paths.artifacts_path(platform_tag, Pkg::Paths.remote_repo_base(platform_tag, nonfinal: nonfinal), nonfinal)
|
246
|
-
when 'deb'
|
247
|
-
remote_base = Pkg::Paths.apt_package_base_path(platform_tag, Pkg::Paths.repo_name(nonfinal), Pkg::Config.project, nonfinal)
|
248
|
-
else
|
249
|
-
fail "Unexpected package format #{package_format}, cannot create symlinks."
|
250
|
-
end
|
251
|
-
remote_path = File.join(remote_base, File.basename(package))
|
252
|
-
link_path = Pkg::Paths.release_package_link_path(platform_tag, nonfinal)
|
253
|
-
link_command = <<-CMD
|
254
|
-
if [ ! -e #{remote_path} ]; then
|
255
|
-
echo "Uh oh! #{remote_path} doesn't exist! Can't create symlink."
|
256
|
-
exit 1
|
257
|
-
fi
|
258
|
-
if [ -e #{link_path} ] && [ ! -L #{link_path} ]; then
|
259
|
-
echo "Uh oh! #{link_path} exists but isn't a link, I don't know what to do with this."
|
260
|
-
exit 1
|
261
|
-
fi
|
262
|
-
if [ -L #{link_path} ] && [ ! #{remote_path} -ef #{link_path} ]; then
|
263
|
-
echo "Removing old link from $(readlink #{link_path}) to #{link_path} . . ."
|
264
|
-
rm #{link_path}
|
265
|
-
fi
|
266
|
-
ln -sf #{remote_path} #{link_path}
|
267
|
-
CMD
|
268
|
-
Pkg::Util::Net.remote_execute(Pkg::Config.staging_server, link_command)
|
269
|
-
end
|
140
|
+
fail "Failed to create rolling repo link for '#{platform_tag}'.\n#{e}"
|
270
141
|
end
|
271
142
|
|
272
143
|
def test_ship(vm, ship_task)
|
273
144
|
command = 'getent group release || groupadd release'
|
274
|
-
Pkg::Util::Net.
|
145
|
+
Pkg::Util::Net.remote_ssh_cmd(vm, command)
|
275
146
|
hosts_to_override = %w(
|
276
147
|
APT_HOST
|
277
148
|
DMG_HOST
|
data/lib/packaging/util/tool.rb
CHANGED
@@ -50,20 +50,12 @@ module Pkg::Util::Version
|
|
50
50
|
end
|
51
51
|
end
|
52
52
|
|
53
|
-
def extended_dash_version
|
54
|
-
Pkg::Util::Git.describe(['--tags', '--dirty', '--abbrev=7'])
|
55
|
-
end
|
56
|
-
|
57
53
|
# This version is used for gems and platform types that do not support
|
58
54
|
# dashes in the package version
|
59
55
|
def dot_version(version = Pkg::Config.version)
|
60
56
|
version.tr('-', '.')
|
61
57
|
end
|
62
58
|
|
63
|
-
def extended_dot_version
|
64
|
-
dot_version(extended_dash_version)
|
65
|
-
end
|
66
|
-
|
67
59
|
# Given a version, reformat it to be appropriate for a final package
|
68
60
|
# version. This means we need to add a `0.` before the release version
|
69
61
|
# for non-final builds
|
data/lib/packaging/util.rb
CHANGED
@@ -22,8 +22,8 @@ module Pkg::Util
|
|
22
22
|
require 'packaging/util/git_tags'
|
23
23
|
|
24
24
|
def self.boolean_value(var)
|
25
|
-
return
|
26
|
-
|
25
|
+
return TRUE if var == TRUE || ( var.is_a?(String) && ( var.downcase == 'true' || var.downcase =~ /^y$|^yes$/))
|
26
|
+
FALSE
|
27
27
|
end
|
28
28
|
|
29
29
|
def self.in_project_root(&blk)
|
data/lib/packaging.rb
CHANGED
@@ -12,14 +12,14 @@ module Pkg
|
|
12
12
|
require 'packaging/tar'
|
13
13
|
require 'packaging/deb'
|
14
14
|
require 'packaging/rpm'
|
15
|
+
require 'packaging/osx'
|
16
|
+
require 'packaging/ips'
|
15
17
|
require 'packaging/nuget'
|
16
18
|
require 'packaging/gem'
|
19
|
+
require 'packaging/msi'
|
17
20
|
require 'packaging/repo'
|
18
21
|
require 'packaging/artifactory'
|
19
22
|
require 'packaging/retrieve'
|
20
|
-
require 'packaging/sign'
|
21
|
-
require 'packaging/archive'
|
22
|
-
require 'packaging/metrics'
|
23
23
|
|
24
24
|
# Load configuration defaults
|
25
25
|
Pkg::Config.load_defaults
|
@@ -14,37 +14,22 @@ describe 'artifactory.rb' do
|
|
14
14
|
'el-6-x86_64' => {
|
15
15
|
:artifact => "./el/6/PC1/x86_64/puppet-agent-5.3.1.34.gf65f9ef-1.el6.x86_64.rpm",
|
16
16
|
:repo_config => "../repo_configs/rpm/pl-puppet-agent-f65f9efbb727c3d2d72d6799c0fc345a726f27b5-el-6-x86_64.repo",
|
17
|
-
:additional_artifacts => ["./el/6/PC1/x86_64/puppet-agent-extras-5.3.1.34.gf65f9ef-1.el6.x86_64.rpm"],
|
18
17
|
},
|
19
18
|
'ubuntu-16.04-amd64' => {
|
20
19
|
:artifact => "./deb/xenial/PC1/puppet-agent_5.3.1.34.gf65f9ef-1xenial_amd64.deb",
|
21
20
|
:repo_config => "../repo_configs/deb/pl-puppet-agent-f65f9efbb727c3d2d72d6799c0fc345a726f27b5-xenial.list",
|
22
|
-
:additional_artifacts => ["./deb/xenial/PC1/puppet-agent-extras_5.3.1.34.gf65f9ef-1xenial_amd64.deb"],
|
23
|
-
},
|
24
|
-
'debian-10-amd64' => {
|
25
|
-
:artifact => "./deb/buster/PC1/puppetdb_5.3.1.34.gf65f9ef-1buster_all.deb",
|
26
|
-
:repo_config => "../repo_configs/deb/pl-puppetdb-f65f9efbb727c3d2d72d6799c0fc345a726f27b5-buster.list",
|
27
|
-
:additional_artifacts => ["./deb/buster/PC1/puppetdb-termini_5.3.1.34.gf65f9ef-1buster_all.deb"],
|
28
21
|
},
|
29
22
|
'windows-2012-x86' => {
|
30
23
|
:artifact => "./windows/puppet-agent-5.3.1.34-x86.msi",
|
31
24
|
:repo_config => '',
|
32
|
-
:additional_artifacts => ["./windows/puppet-agent-extras-5.3.1.34-x86.msi"],
|
33
|
-
},
|
34
|
-
'windowsfips-2012-x64' => {
|
35
|
-
:artifact => "./windowsfips/puppet-agent-5.3.1.34-x64.msi",
|
36
|
-
:repo_config => '',
|
37
|
-
:additional_artifacts => ["./windowsfips/puppet-agent-extras-5.3.1.34-x64.msi"],
|
38
25
|
},
|
39
|
-
'
|
40
|
-
:artifact => "./
|
26
|
+
'eos-4-i386' => {
|
27
|
+
:artifact => "./eos/4/PC1/i386/puppet-agent-5.3.1.34.gf65f9ef-1.eos4.i386.swix",
|
41
28
|
:repo_config => '',
|
42
|
-
:additional_artifacts => ["./apple/10.15/PC1/x86_64/puppet-agent-extras-5.3.1.34.gf65f9ef-1.osx10.15.dmg"],
|
43
29
|
},
|
44
|
-
'osx-
|
45
|
-
:artifact => "./apple/
|
30
|
+
'osx-10.12-x86_64' => {
|
31
|
+
:artifact => "./apple/10.12/PC1/x86_64/puppet-agent-5.3.1.34.gf65f9ef-1.osx10.12.dmg",
|
46
32
|
:repo_config => '',
|
47
|
-
:additional_artifacts => ["./apple/11/PC1/x86_64/puppet-agent-extras-5.3.1.34.gf65f9ef-1.osx11.dmg"],
|
48
33
|
},
|
49
34
|
'solaris-10-sparc' => {
|
50
35
|
:artifact => "./solaris/10/PC1/puppet-agent-5.3.1.34.gf65f9ef-1.sparc.pkg.gz",
|
@@ -59,7 +44,6 @@ describe 'artifactory.rb' do
|
|
59
44
|
:repo_subdirectories => "#{default_repo_name}/#{project}/#{project_version}/el-6-x86_64",
|
60
45
|
:package_format => 'rpm',
|
61
46
|
:package_name => 'path/to/a/el/6/package/puppet-agent-5.3.1.34.gf65f9ef-1.el6.x86_64.rpm',
|
62
|
-
:all_package_names => ['puppet-agent-5.3.1.34.gf65f9ef-1.el6.x86_64.rpm', 'puppet-agent-extras-5.3.1.34.gf65f9ef-1.el6.x86_64.rpm']
|
63
47
|
},
|
64
48
|
'ubuntu-16.04-amd64' => {
|
65
49
|
:toplevel_repo => 'debian__local',
|
@@ -67,45 +51,26 @@ describe 'artifactory.rb' do
|
|
67
51
|
:codename => 'xenial',
|
68
52
|
:arch => 'amd64',
|
69
53
|
:package_name => 'path/to/a/xenial/package/puppet-agent_5.3.1.34.gf65f9ef-1xenial_amd64.deb',
|
70
|
-
:all_package_names => ['puppet-agent_5.3.1.34.gf65f9ef-1xenial_amd64.deb', 'puppet-agent-extras_5.3.1.34.gf65f9ef-1xenial_amd64.deb']
|
71
|
-
},
|
72
|
-
'debian-10-amd64' => {
|
73
|
-
:toplevel_repo => 'debian__local',
|
74
|
-
:repo_subdirectories => "#{default_repo_name}/#{project}/#{project_version}/debian-10",
|
75
|
-
:codename => 'buster',
|
76
|
-
:arch => 'all',
|
77
|
-
:package_name => 'path/to/a/buster/package/puppetdb_5.3.1.34.gf65f9ef-1buster_all.deb',
|
78
|
-
:all_package_names => ['puppetdb_5.3.1.34.gf65f9ef-1buster_all.deb', 'puppetdb-termini_5.3.1.34.gf65f9ef-1buster_all.deb']
|
79
54
|
},
|
80
55
|
'windows-2012-x86' => {
|
81
56
|
:toplevel_repo => 'generic',
|
82
57
|
:repo_subdirectories => "#{default_repo_name}/#{project}/#{project_version}/windows-x86",
|
83
58
|
:package_name => 'path/to/a/windows/package/puppet-agent-5.3.1.34-x86.msi',
|
84
|
-
:all_package_names => ['puppet-agent-5.3.1.34-x86.msi','puppet-agent-extras-5.3.1.34-x86.msi']
|
85
59
|
},
|
86
|
-
'
|
60
|
+
'eos-4-i386' => {
|
87
61
|
:toplevel_repo => 'generic',
|
88
|
-
:repo_subdirectories => "#{default_repo_name}/#{project}/#{project_version}/
|
89
|
-
:package_name => 'path/to/
|
90
|
-
:all_package_names => ['puppet-agent-5.3.1.34-x64.msi','puppet-agent-extras-5.3.1.34-x64.msi']
|
62
|
+
:repo_subdirectories => "#{default_repo_name}/#{project}/#{project_version}/eos-4-i386",
|
63
|
+
:package_name => 'path/to/an/eos/4/package/puppet-agent-5.3.1.34.gf65f9ef-1.eos4.i386.swix',
|
91
64
|
},
|
92
|
-
'osx-10.
|
65
|
+
'osx-10.12-x86_64' => {
|
93
66
|
:toplevel_repo => 'generic',
|
94
|
-
:repo_subdirectories => "#{default_repo_name}/#{project}/#{project_version}/osx-10.
|
95
|
-
:package_name => 'path/to/an/osx/10.
|
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']
|
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']
|
67
|
+
:repo_subdirectories => "#{default_repo_name}/#{project}/#{project_version}/osx-10.12-x86_64",
|
68
|
+
:package_name => 'path/to/an/osx/10.12/package/puppet-agent-5.3.1.34.gf65f9ef-1.osx10.12.dmg',
|
103
69
|
},
|
104
70
|
'solaris-10-sparc' => {
|
105
71
|
:toplevel_repo => 'generic',
|
106
72
|
:repo_subdirectories => "#{default_repo_name}/#{project}/#{project_version}/solaris-10-sparc",
|
107
73
|
:package_name => 'path/to/a/solaris/10/package/puppet-agent-5.3.1.34.gf65f9ef-1.sparc.pkg.gz',
|
108
|
-
:all_package_names => ['puppet-agent-5.3.1.34.gf65f9ef-1.sparc.pkg.gz']
|
109
74
|
},
|
110
75
|
}
|
111
76
|
|
@@ -125,6 +90,7 @@ describe 'artifactory.rb' do
|
|
125
90
|
expect(artifact.location_for(platform_tag)).to match_array([
|
126
91
|
platform_tag_data[:toplevel_repo],
|
127
92
|
platform_tag_data[:repo_subdirectories],
|
93
|
+
File.join('pool', platform_tag_data[:repo_subdirectories])
|
128
94
|
])
|
129
95
|
end
|
130
96
|
else
|
@@ -132,6 +98,7 @@ describe 'artifactory.rb' do
|
|
132
98
|
expect(artifact.location_for(platform_tag)).to match_array([
|
133
99
|
platform_tag_data[:toplevel_repo],
|
134
100
|
platform_tag_data[:repo_subdirectories],
|
101
|
+
platform_tag_data[:repo_subdirectories]
|
135
102
|
])
|
136
103
|
end
|
137
104
|
end
|
@@ -140,6 +107,7 @@ describe 'artifactory.rb' do
|
|
140
107
|
expect(artifact.location_for('generic')).to match_array([
|
141
108
|
'generic',
|
142
109
|
File.join(default_repo_name, project, project_version),
|
110
|
+
File.join(default_repo_name, project, project_version)
|
143
111
|
])
|
144
112
|
end
|
145
113
|
end
|
@@ -156,23 +124,6 @@ describe 'artifactory.rb' do
|
|
156
124
|
end
|
157
125
|
end
|
158
126
|
|
159
|
-
describe '#all_package_names' do
|
160
|
-
it 'parses the retrieved yaml file and returns the correct package name' do
|
161
|
-
all_package_names = artifact.all_package_names(platform_data, platform_tag)
|
162
|
-
all_package_names_data = [platform_tag_data[:additional_artifacts], platform_tag_data[:all_package_names]].flatten.compact
|
163
|
-
all_package_names.map! { |p| File.basename(p) }
|
164
|
-
all_package_names_data.map! { |p| File.basename(p) }
|
165
|
-
expect(all_package_names.size).to eq(all_package_names_data.size)
|
166
|
-
expect(all_package_names.sort).to eq(all_package_names_data.sort)
|
167
|
-
end
|
168
|
-
|
169
|
-
it 'fails if it cannot find a valid platform name' do
|
170
|
-
new_platform_data = platform_data
|
171
|
-
new_platform_data.delete_if { |k| k.match(platform_tag) }
|
172
|
-
expect{artifact.package_name(new_platform_data, platform_tag)}.to raise_error
|
173
|
-
end
|
174
|
-
end
|
175
|
-
|
176
127
|
describe '#deb_list_contents' do
|
177
128
|
it "returns the correct contents for the debian list file for #{platform_tag}" do
|
178
129
|
if platform_tag_data[:codename]
|
@@ -196,13 +147,12 @@ describe 'artifactory.rb' do
|
|
196
147
|
describe '#deploy_properties' do
|
197
148
|
it "returns the correct contents for the deploy properties for #{platform_tag}" do
|
198
149
|
if platform_tag_data[:codename]
|
199
|
-
expect(artifact.deploy_properties(platform_tag
|
150
|
+
expect(artifact.deploy_properties(platform_tag)).to include({
|
200
151
|
'deb.distribution' => platform_tag_data[:codename],
|
201
|
-
'deb.component' => platform_tag_data[:repo_subdirectories]
|
202
|
-
'deb.architecture' => platform_tag_data[:arch]
|
152
|
+
'deb.component' => platform_tag_data[:repo_subdirectories]
|
203
153
|
})
|
204
154
|
else
|
205
|
-
expect(artifact.deploy_properties(platform_tag
|
155
|
+
expect(artifact.deploy_properties(platform_tag)).not_to include({
|
206
156
|
'deb.component' => platform_tag_data[:repo_subdirectories]
|
207
157
|
})
|
208
158
|
end
|
@@ -4,9 +4,7 @@ require 'yaml'
|
|
4
4
|
|
5
5
|
describe "Pkg::Config" do
|
6
6
|
|
7
|
-
Build_Params = [:
|
8
|
-
:apt_archive_repo_command,
|
9
|
-
:apt_host,
|
7
|
+
Build_Params = [:apt_host,
|
10
8
|
:apt_releases,
|
11
9
|
:apt_repo_path,
|
12
10
|
:apt_repo_url,
|
@@ -36,11 +34,9 @@ describe "Pkg::Config" do
|
|
36
34
|
:default_mock,
|
37
35
|
:description,
|
38
36
|
:dmg_path,
|
39
|
-
:downloads_archive_path,
|
40
37
|
:email,
|
41
38
|
:files,
|
42
39
|
:final_mocks,
|
43
|
-
:freight_archive_path,
|
44
40
|
:freight_conf,
|
45
41
|
:gem_default_executables,
|
46
42
|
:gem_dependencies,
|
@@ -84,7 +80,6 @@ describe "Pkg::Config" do
|
|
84
80
|
:nonfinal_apt_repo_path,
|
85
81
|
:nonfinal_apt_repo_staging_path,
|
86
82
|
:nonfinal_dmg_path,
|
87
|
-
:nonfinal_gem_path,
|
88
83
|
:nonfinal_ips_path,
|
89
84
|
:nonfinal_msi_path,
|
90
85
|
:nonfinal_p5p_path,
|
@@ -132,7 +127,6 @@ describe "Pkg::Config" do
|
|
132
127
|
:version,
|
133
128
|
:version_file,
|
134
129
|
:version_strategy,
|
135
|
-
:yum_archive_path,
|
136
130
|
:yum_host,
|
137
131
|
:yum_repo_path,
|
138
132
|
:yum_repo_name,
|
@@ -174,10 +168,10 @@ describe "Pkg::Config" do
|
|
174
168
|
end
|
175
169
|
end
|
176
170
|
|
177
|
-
mixed_params = { :sign_tar =>
|
171
|
+
mixed_params = { :sign_tar => TRUE, :baz => 'qux' }
|
178
172
|
context "given a hash with both valid and invalid params" do
|
179
173
|
it "should set the valid param" do
|
180
|
-
Pkg::Config.should_receive(:instance_variable_set).with("@sign_tar",
|
174
|
+
Pkg::Config.should_receive(:instance_variable_set).with("@sign_tar", TRUE)
|
181
175
|
Pkg::Config.config_from_hash(mixed_params)
|
182
176
|
end
|
183
177
|
|
@@ -196,41 +190,43 @@ describe "Pkg::Config" do
|
|
196
190
|
describe "#params" do
|
197
191
|
it "should return a hash containing keys for all build parameters" do
|
198
192
|
params = Pkg::Config.config
|
199
|
-
Build_Params.each { |param| params.has_key?(param).should ==
|
193
|
+
Build_Params.each { |param| params.has_key?(param).should == TRUE }
|
200
194
|
end
|
201
195
|
end
|
202
196
|
|
203
197
|
describe "#platform_data" do
|
204
198
|
platform_tags = [
|
205
|
-
'
|
206
|
-
'osx-
|
199
|
+
'eos-4-i386',
|
200
|
+
'osx-10.12-x86_64',
|
201
|
+
'cisco-wrlinux-7-x86_64',
|
207
202
|
'ubuntu-16.04-i386',
|
208
|
-
'
|
203
|
+
'cumulus-2.2-amd64',
|
204
|
+
'el-6-s390x',
|
209
205
|
'el-7-ppc64le',
|
210
206
|
'sles-12-x86_64',
|
211
207
|
]
|
212
208
|
|
213
209
|
artifacts = \
|
214
|
-
"./artifacts/
|
215
|
-
"./artifacts/apple/
|
210
|
+
"./artifacts/eos/4/PC1/i386/puppet-agent-5.3.2-1.eos4.i386.swix\n" \
|
211
|
+
"./artifacts/apple/10.12/PC1/x86_64/puppet-agent-5.3.2.658.gc79ef9a-1.osx10.12.dmg\n" \
|
212
|
+
"./artifacts/cisco-wrlinux/7/PC1/x86_64/puppet-agent-5.3.2-1.cisco_wrlinux7.x86_64.rpm\n" \
|
216
213
|
"./artifacts/deb/xenial/PC1/puppet-agent_5.3.2-1xenial_i386.deb\n" \
|
217
|
-
"./artifacts/
|
214
|
+
"./artifacts/deb/cumulus/PC1/puppet-agent_5.3.2-1cumulus_amd64.deb\n" \
|
215
|
+
"./artifacts/el/6/PC1/s390x/puppet-agent-5.3.2.658.gc79ef9a-1.el6.s390x.rpm\n" \
|
218
216
|
"./artifacts/el/7/PC1/ppc64le/puppet-agent-5.3.2-1.el7.ppc64le.rpm\n" \
|
219
217
|
"./artifacts/sles/12/PC1/x86_64/puppet-agent-5.3.2-1.sles12.x86_64.rpm"
|
220
218
|
|
221
219
|
aix_artifacts = \
|
222
|
-
"./artifacts/aix/
|
220
|
+
"./artifacts/aix/6.1/PC1/ppc/puppet-agent-5.3.2-1.aix6.1.ppc.rpm"
|
223
221
|
|
224
222
|
fedora_artifacts = \
|
225
|
-
"./artifacts/fedora/
|
223
|
+
"./artifacts/fedora/f25/PC1/x86_64/puppet-agent-5.3.2-1.fedoraf25.x86_64.rpm"
|
226
224
|
|
227
225
|
windows_artifacts = \
|
228
226
|
"./artifacts/windows/puppet-agent-x64.msi\n" \
|
229
227
|
"./artifacts/windows/puppet-agent-5.3.2-x86.wixpdb\n" \
|
230
228
|
"./artifacts/windows/puppet-agent-5.3.2-x86.msi\n" \
|
231
|
-
"./artifacts/windows/puppet-agent-5.3.2-x64.msi
|
232
|
-
"./artifacts/windowsfips/puppet-agent-x64.msi\n" \
|
233
|
-
"./artifacts/windowsfips/puppet-agent-5.3.2-x64.msi"
|
229
|
+
"./artifacts/windows/puppet-agent-5.3.2-x64.msi"
|
234
230
|
|
235
231
|
solaris_artifacts = \
|
236
232
|
"./artifacts/solaris/11/PC1/puppet-agent@5.3.2,5.11-1.sparc.p5p\n" \
|
@@ -242,11 +238,6 @@ describe "Pkg::Config" do
|
|
242
238
|
"./artifacts/deb/stretch/PC1/puppet-agent_5.3.2.658.gc79ef9a-1stretch_amd64.deb\n" \
|
243
239
|
"./artifacts/deb/stretch/PC1/puppet-agent-dbgsym_5.3.2.658.gc79ef9a-1stretch_amd64.deb"
|
244
240
|
|
245
|
-
artifacts_not_matching_project = \
|
246
|
-
"./artifacts/deb/xenial/pe-postgresql-contrib_2019.1.9.6.12-1xenial_amd64.deb\n" \
|
247
|
-
"./artifacts/deb/xenial/pe-postgresql-devel_2019.1.9.6.12-1xenial_amd64.deb\n" \
|
248
|
-
"./artifacts/deb/xenial/pe-postgresql-server_2019.1.9.6.12-1xenial_amd64.deb\n" \
|
249
|
-
"./artifacts/deb/xenial/pe-postgresql_2019.1.9.6.12-1xenial_amd64.deb"
|
250
241
|
project = 'puppet-agent'
|
251
242
|
ref = '5.3.2'
|
252
243
|
|
@@ -257,7 +248,7 @@ describe "Pkg::Config" do
|
|
257
248
|
end
|
258
249
|
|
259
250
|
it "should return a hash mapping platform tags to paths" do
|
260
|
-
allow(Pkg::Util::Net).to receive(:
|
251
|
+
allow(Pkg::Util::Net).to receive(:remote_ssh_cmd).and_return(artifacts, nil)
|
261
252
|
expect(Pkg::Config.platform_data.keys).to eql(platform_tags)
|
262
253
|
end
|
263
254
|
|
@@ -277,53 +268,42 @@ describe "Pkg::Config" do
|
|
277
268
|
end
|
278
269
|
|
279
270
|
it "should not use 'f' in fedora platform tags" do
|
280
|
-
allow(Pkg::Util::Net).to receive(:
|
271
|
+
allow(Pkg::Util::Net).to receive(:remote_ssh_cmd).and_return(fedora_artifacts, nil)
|
281
272
|
data = Pkg::Config.platform_data
|
282
|
-
expect(data).to include('fedora-
|
283
|
-
expect(data).not_to include('fedora-
|
273
|
+
expect(data).to include('fedora-25-x86_64')
|
274
|
+
expect(data).not_to include('fedora-f25-x86_64')
|
284
275
|
end
|
285
276
|
|
286
277
|
it "should collect packages whose extname differ from package_format" do
|
287
|
-
allow(Pkg::Util::Net).to receive(:
|
278
|
+
allow(Pkg::Util::Net).to receive(:remote_ssh_cmd).and_return(solaris_artifacts, nil)
|
288
279
|
data = Pkg::Config.platform_data
|
289
280
|
expect(data).to include('solaris-10-i386' => {:artifact => './solaris/10/PC1/puppet-agent-5.3.2-1.i386.pkg.gz', :repo_config => nil})
|
290
281
|
expect(data).to include('solaris-11-sparc' => {:artifact => './solaris/11/PC1/puppet-agent@5.3.2,5.11-1.sparc.p5p', :repo_config => nil})
|
291
282
|
end
|
292
283
|
|
293
284
|
it "should collect versioned msis" do
|
294
|
-
allow(Pkg::Util::Net).to receive(:
|
285
|
+
allow(Pkg::Util::Net).to receive(:remote_ssh_cmd).and_return(windows_artifacts, nil)
|
295
286
|
data = Pkg::Config.platform_data
|
296
287
|
expect(data['windows-2012-x86']).to include(:artifact => './windows/puppet-agent-5.3.2-x86.msi')
|
297
288
|
expect(data['windows-2012-x64']).to include(:artifact => './windows/puppet-agent-5.3.2-x64.msi')
|
298
|
-
expect(data['windowsfips-2012-x64']).to include(:artifact => './windowsfips/puppet-agent-5.3.2-x64.msi')
|
299
289
|
end
|
300
290
|
|
301
291
|
it "should not collect debug packages" do
|
302
|
-
allow(Pkg::Util::Net).to receive(:
|
292
|
+
allow(Pkg::Util::Net).to receive(:remote_ssh_cmd).and_return(stretch_artifacts, nil)
|
303
293
|
data = Pkg::Config.platform_data
|
304
294
|
expect(data['debian-9-amd64']).to include(:artifact => './deb/stretch/PC1/puppet-agent_5.3.2.658.gc79ef9a-1stretch_amd64.deb')
|
305
295
|
end
|
306
296
|
|
307
|
-
it "should collect packages that don't match the project name" do
|
308
|
-
allow(Pkg::Util::Net).to receive(:remote_execute).and_return(artifacts_not_matching_project, nil)
|
309
|
-
data = Pkg::Config.platform_data
|
310
|
-
expect(data['ubuntu-16.04-amd64']).to include(:artifact => './deb/xenial/pe-postgresql-contrib_2019.1.9.6.12-1xenial_amd64.deb')
|
311
|
-
expect(data['ubuntu-16.04-amd64'][:additional_artifacts].size).to eq(3)
|
312
|
-
expect(data['ubuntu-16.04-amd64'][:additional_artifacts]).to include('./deb/xenial/pe-postgresql-devel_2019.1.9.6.12-1xenial_amd64.deb')
|
313
|
-
expect(data['ubuntu-16.04-amd64'][:additional_artifacts]).to include('./deb/xenial/pe-postgresql-server_2019.1.9.6.12-1xenial_amd64.deb')
|
314
|
-
expect(data['ubuntu-16.04-amd64'][:additional_artifacts]).to include('./deb/xenial/pe-postgresql_2019.1.9.6.12-1xenial_amd64.deb')
|
315
|
-
end
|
316
|
-
|
317
297
|
it "should use 'ppc' instead of 'power' in aix paths" do
|
318
|
-
allow(Pkg::Util::Net).to receive(:
|
298
|
+
allow(Pkg::Util::Net).to receive(:remote_ssh_cmd).and_return(aix_artifacts, nil)
|
319
299
|
data = Pkg::Config.platform_data
|
320
|
-
expect(data['aix-
|
300
|
+
expect(data['aix-6.1-power']).to include(:artifact => './aix/6.1/PC1/ppc/puppet-agent-5.3.2-1.aix6.1.ppc.rpm')
|
321
301
|
end
|
322
302
|
|
323
303
|
it "should not record an aix repo config" do
|
324
|
-
allow(Pkg::Util::Net).to receive(:
|
304
|
+
allow(Pkg::Util::Net).to receive(:remote_ssh_cmd).and_return(aix_artifacts, nil)
|
325
305
|
data = Pkg::Config.platform_data
|
326
|
-
expect(data['aix-
|
306
|
+
expect(data['aix-6.1-power'][:repo_config]).to be_nil
|
327
307
|
end
|
328
308
|
end
|
329
309
|
|
@@ -356,7 +336,7 @@ describe "Pkg::Config" do
|
|
356
336
|
# apt_host: is set to "foo" in the fixture
|
357
337
|
orig = Pkg::Config.apt_host
|
358
338
|
Pkg::Config.apt_host = "bar"
|
359
|
-
Pkg::Config.config_from_yaml(File.join(FIXTURES, 'config', '
|
339
|
+
Pkg::Config.config_from_yaml(File.join(FIXTURES, 'config', 'params.yaml'))
|
360
340
|
expect(Pkg::Config.apt_host).to eq("foo")
|
361
341
|
Pkg::Config.apt_host = orig
|
362
342
|
end
|