packaging 0.102.0 → 0.103.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/packaging/config.rb +8 -12
- data/lib/packaging/repo.rb +11 -14
- data/lib/packaging/util/net.rb +2 -2
- data/lib/packaging/util/ship.rb +78 -136
- data/lib/packaging/util.rb +0 -5
- data/tasks/jenkins.rake +1 -1
- data/tasks/ship.rake +142 -169
- metadata +11 -44
- data/lib/packaging/util/apt_staging_server.rb +0 -8
- data/lib/packaging/util/build_metadata.rb +0 -17
- data/lib/packaging/util/distribution_server.rb +0 -42
- data/lib/packaging/util/ezbake.rb +0 -26
- data/lib/packaging/util/windows.rb +0 -38
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5f86a8438548dce924f97c559885a4b5d9c94bc88449717e8781d1639683efb4
|
4
|
+
data.tar.gz: 59ef7b771215acc69595e42f705ceca186f2467141ebda0a996ea8d52fc4945c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b2609ced8514dce238e41345e024a1740f1dd4e62441a6f6be9ed91645fbc8db90151f8e367c9d86bc0e5907621589981f94a6cbeaea60e4ad97496b8f2c19ab
|
7
|
+
data.tar.gz: 1afba4a382a78490faee8e2f4b9974ea9ef80a9eec1a23c4733aaef86b8fe360902f440aea43daa307cf7eb84c3705db7d885ab7af2df948ebc5de1933956845
|
data/lib/packaging/config.rb
CHANGED
@@ -80,7 +80,7 @@ module Pkg
|
|
80
80
|
|
81
81
|
dir = "/opt/jenkins-builds/#{self.project}/#{self.ref}"
|
82
82
|
cmd = "if [ -s \"#{dir}/artifacts\" ]; then cd #{dir};"\
|
83
|
-
"find ./artifacts -mindepth 2 -type f; fi"
|
83
|
+
"find ./artifacts/ -mindepth 2 -type f; fi"
|
84
84
|
artifacts, _ = Pkg::Util::Net.remote_execute(
|
85
85
|
self.builds_server,
|
86
86
|
cmd,
|
@@ -95,7 +95,6 @@ module Pkg
|
|
95
95
|
# the correct place. For 5.x and 6.x release streams the f prefix
|
96
96
|
# has been removed and so tag will equal original_tag
|
97
97
|
original_tag = Pkg::Paths.tag_from_artifact_path(artifact)
|
98
|
-
fail "Error: unrecognized artifact \"#{artifact}\"" if original_tag.nil?
|
99
98
|
|
100
99
|
# Remove the f-prefix from the fedora platform tag keys so that
|
101
100
|
# beaker can rely on consistent keys once we rip out the f for good
|
@@ -204,18 +203,15 @@ module Pkg
|
|
204
203
|
# string. Accept an argument for the write target file. If not specified,
|
205
204
|
# the name of the params file is the current git commit sha or tag.
|
206
205
|
#
|
207
|
-
def config_to_yaml(
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
Pkg::Util::File.file_writable?(File.dirname(config_yaml_path), :required => true)
|
214
|
-
File.open(config_yaml_path, 'w') do |f|
|
206
|
+
def config_to_yaml(target = nil)
|
207
|
+
file = "#{self.ref}.yaml"
|
208
|
+
target = target.nil? ? File.join(Pkg::Util::File.mktemp, "#{self.ref}.yaml") : File.join(target, file)
|
209
|
+
Pkg::Util::File.file_writable?(File.dirname(target), :required => true)
|
210
|
+
File.open(target, 'w') do |f|
|
215
211
|
f.puts self.config_to_hash.to_yaml
|
216
212
|
end
|
217
|
-
puts
|
218
|
-
|
213
|
+
puts target
|
214
|
+
target
|
219
215
|
end
|
220
216
|
|
221
217
|
##
|
data/lib/packaging/repo.rb
CHANGED
@@ -36,8 +36,7 @@ module Pkg::Repo
|
|
36
36
|
Dir.chdir(File.join('pkg', local_target)) do
|
37
37
|
puts "Info: Archiving #{repo_location} as #{archive_name}"
|
38
38
|
target_tarball = File.join('repos', "#{archive_name}.tar.gz")
|
39
|
-
tar_command =
|
40
|
-
--file #{target_tarball} #{repo_location}].join(' ')
|
39
|
+
tar_command = "#{tar} --owner=0 --group=0 --create --gzip --file #{target_tarball} #{repo_location}"
|
41
40
|
stdout, _, _ = Pkg::Util::Execution.capture3(tar_command)
|
42
41
|
return stdout
|
43
42
|
end
|
@@ -63,12 +62,12 @@ module Pkg::Repo
|
|
63
62
|
next
|
64
63
|
end
|
65
64
|
|
66
|
-
tar_action =
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
--file #{all_repos_tarball_name} #{repo_tarball_path}].join(' ')
|
65
|
+
tar_action = "--create"
|
66
|
+
if File.exist?(all_repos_tarball_name)
|
67
|
+
tar_action = "--update"
|
68
|
+
end
|
71
69
|
|
70
|
+
tar_command = "#{tar} --owner=0 --group=0 #{tar_action} --file #{all_repos_tarball_name} #{repo_tarball_path}"
|
72
71
|
stdout, _, _ = Pkg::Util::Execution.capture3(tar_command)
|
73
72
|
puts stdout
|
74
73
|
end
|
@@ -118,8 +117,7 @@ module Pkg::Repo
|
|
118
117
|
)
|
119
118
|
return stdout.split
|
120
119
|
rescue => e
|
121
|
-
fail "Error: Could not retrieve directories that contain #{pkg_ext} "
|
122
|
-
"packages in #{Pkg::Config.distribution_server}:#{artifact_directory}: #{e}"
|
120
|
+
fail "Error: Could not retrieve directories that contain #{pkg_ext} packages in #{Pkg::Config.distribution_server}:#{artifact_directory}"
|
123
121
|
end
|
124
122
|
|
125
123
|
def populate_repo_directory(artifact_parent_directory)
|
@@ -128,8 +126,7 @@ module Pkg::Repo
|
|
128
126
|
cmd << 'rsync --archive --verbose --one-file-system --ignore-existing artifacts/ repos/ '
|
129
127
|
Pkg::Util::Net.remote_execute(Pkg::Config.distribution_server, cmd)
|
130
128
|
rescue => e
|
131
|
-
fail "Error: Could not populate repos directory in "
|
132
|
-
"#{Pkg::Config.distribution_server}:#{artifact_parent_directory}: #{e}"
|
129
|
+
fail "Error: Could not populate repos directory in #{Pkg::Config.distribution_server}:#{artifact_parent_directory}"
|
133
130
|
end
|
134
131
|
|
135
132
|
def argument_required?(argument_name, repo_command)
|
@@ -137,12 +134,12 @@ module Pkg::Repo
|
|
137
134
|
end
|
138
135
|
|
139
136
|
def update_repo(remote_host, command, options = {})
|
140
|
-
fail_message = "Error: Missing required argument '%s',
|
137
|
+
fail_message = "Error: Missing required argument '%s', update your build_defaults?"
|
141
138
|
[:repo_name, :repo_path, :repo_host, :repo_url].each do |option|
|
142
139
|
fail fail_message % option.to_s if argument_required?(option.to_s, command) && !options[option]
|
143
140
|
end
|
144
141
|
|
145
|
-
|
142
|
+
whitelist = {
|
146
143
|
__REPO_NAME__: options[:repo_name],
|
147
144
|
__REPO_PATH__: options[:repo_path],
|
148
145
|
__REPO_HOST__: options[:repo_host],
|
@@ -152,7 +149,7 @@ module Pkg::Repo
|
|
152
149
|
}
|
153
150
|
Pkg::Util::Net.remote_execute(
|
154
151
|
remote_host,
|
155
|
-
Pkg::Util::Misc.search_and_replace(command,
|
152
|
+
Pkg::Util::Misc.search_and_replace(command, whitelist))
|
156
153
|
end
|
157
154
|
end
|
158
155
|
end
|
data/lib/packaging/util/net.rb
CHANGED
@@ -159,7 +159,7 @@ module Pkg::Util::Net
|
|
159
159
|
raise(ArgumentError, "Cannot sync path '#{origin}' because both origin_host and target_host are nil. Perhaps you need to set TEAM=release ?") unless
|
160
160
|
options[:origin_host] || options[:target_host]
|
161
161
|
|
162
|
-
cmd = %W
|
162
|
+
cmd = %W(
|
163
163
|
#{options[:bin]}
|
164
164
|
--recursive
|
165
165
|
--hard-links
|
@@ -169,7 +169,7 @@ module Pkg::Util::Net
|
|
169
169
|
--no-perms
|
170
170
|
--no-owner
|
171
171
|
--no-group
|
172
|
-
|
172
|
+
) + [*options[:extra_flags]]
|
173
173
|
|
174
174
|
cmd << '--dry-run' if options[:dryrun]
|
175
175
|
cmd << Pkg::Util.pseudo_uri(path: origin, host: options[:origin_host])
|
data/lib/packaging/util/ship.rb
CHANGED
@@ -1,20 +1,14 @@
|
|
1
1
|
# Module for shipping all packages to places
|
2
|
-
|
3
|
-
require 'English'
|
4
2
|
require 'tmpdir'
|
5
|
-
|
6
3
|
module Pkg::Util::Ship
|
7
4
|
module_function
|
8
5
|
|
9
|
-
def collect_packages(pkg_exts, excludes = [])
|
6
|
+
def collect_packages(pkg_exts, excludes = []) # rubocop:disable Metrics/MethodLength
|
10
7
|
pkgs = pkg_exts.map { |ext| Dir.glob(ext) }.flatten
|
11
8
|
return [] if pkgs.empty?
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
pkgs.delete_if { |p| p.match(exclude) }
|
16
|
-
end
|
17
|
-
end
|
9
|
+
excludes.each do |exclude|
|
10
|
+
pkgs.delete_if { |p| p.match(exclude) }
|
11
|
+
end if excludes
|
18
12
|
if pkgs.empty?
|
19
13
|
$stdout.puts "No packages with (#{pkg_exts.join(', ')}) extensions found staged in 'pkg'"
|
20
14
|
$stdout.puts "Maybe your excludes argument (#{excludes}) is too restrictive?"
|
@@ -65,13 +59,13 @@ module Pkg::Util::Ship
|
|
65
59
|
# false (most paths will be platform dependent), but set to true for gems
|
66
60
|
# and tarballs since those just land directly under /opt/downloads/<project>
|
67
61
|
#
|
62
|
+
# rubocop:disable Metrics/MethodLength, Metrics/AbcSize
|
68
63
|
def ship_pkgs(pkg_exts, staging_server, remote_path, opts = {})
|
69
64
|
options = {
|
70
65
|
excludes: [],
|
71
66
|
chattr: true,
|
72
67
|
platform_independent: false,
|
73
|
-
nonfinal: false
|
74
|
-
}.merge(opts)
|
68
|
+
nonfinal: false }.merge(opts)
|
75
69
|
|
76
70
|
# First find the packages to be shipped. We must find them before moving
|
77
71
|
# to our temporary staging directory
|
@@ -79,39 +73,35 @@ module Pkg::Util::Ship
|
|
79
73
|
return false if local_packages.empty?
|
80
74
|
|
81
75
|
tmpdir = Dir.mktmpdir
|
82
|
-
staged_pkgs = reorganize_packages(
|
83
|
-
local_packages, tmpdir, options[:platform_independent], options[:nonfinal]
|
84
|
-
)
|
76
|
+
staged_pkgs = reorganize_packages(local_packages, tmpdir, options[:platform_independent], options[:nonfinal])
|
85
77
|
|
86
78
|
puts staged_pkgs.sort
|
87
79
|
puts "Do you want to ship the above files to (#{staging_server})?"
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
staging_server, '
|
108
|
-
|
109
|
-
|
110
|
-
Pkg::Util::Net.remote_set_permissions(staging_server, '0664', [remote_pkg])
|
111
|
-
Pkg::Util::Net.remote_set_immutable(staging_server, [remote_pkg]) if options[:chattr]
|
80
|
+
if Pkg::Util.ask_yes_or_no
|
81
|
+
extra_flags = ['--ignore-existing', '--delay-updates']
|
82
|
+
extra_flags << '--dry-run' if ENV['DRYRUN']
|
83
|
+
|
84
|
+
staged_pkgs.each do |pkg|
|
85
|
+
Pkg::Util::Execution.retry_on_fail(times: 3) do
|
86
|
+
sub_string = 'pkg'
|
87
|
+
remote_pkg = pkg.sub(sub_string, remote_path)
|
88
|
+
remote_basepath = File.dirname(remote_pkg)
|
89
|
+
Pkg::Util::Net.remote_execute(staging_server, "mkdir -p #{remote_basepath}")
|
90
|
+
Pkg::Util::Net.rsync_to(
|
91
|
+
File.join(tmpdir, pkg),
|
92
|
+
staging_server,
|
93
|
+
remote_basepath,
|
94
|
+
extra_flags: extra_flags
|
95
|
+
)
|
96
|
+
|
97
|
+
Pkg::Util::Net.remote_set_ownership(staging_server, 'root', 'release', [remote_basepath, remote_pkg])
|
98
|
+
Pkg::Util::Net.remote_set_permissions(staging_server, '775', [remote_basepath])
|
99
|
+
Pkg::Util::Net.remote_set_permissions(staging_server, '0664', [remote_pkg])
|
100
|
+
Pkg::Util::Net.remote_set_immutable(staging_server, [remote_pkg]) if options[:chattr]
|
101
|
+
end
|
112
102
|
end
|
103
|
+
return true
|
113
104
|
end
|
114
|
-
return true
|
115
105
|
end
|
116
106
|
|
117
107
|
def ship_rpms(local_staging_directory, remote_path, opts = {})
|
@@ -133,8 +123,6 @@ module Pkg::Util::Ship
|
|
133
123
|
ship_pkgs(things_to_ship, Pkg::Config.apt_signing_server, remote_path, opts)
|
134
124
|
end
|
135
125
|
|
136
|
-
|
137
|
-
|
138
126
|
def ship_svr4(local_staging_directory, remote_path, opts = {})
|
139
127
|
ship_pkgs(["#{local_staging_directory}/**/*.pkg.gz"], Pkg::Config.svr4_host, remote_path, opts)
|
140
128
|
end
|
@@ -144,63 +132,33 @@ module Pkg::Util::Ship
|
|
144
132
|
end
|
145
133
|
|
146
134
|
def ship_dmg(local_staging_directory, remote_path, opts = {})
|
147
|
-
packages_have_shipped = ship_pkgs(
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
'dmg'
|
160
|
-
)
|
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
|
161
147
|
end
|
162
148
|
end
|
163
149
|
|
164
150
|
def ship_swix(local_staging_directory, remote_path, opts = {})
|
165
|
-
ship_pkgs(
|
166
|
-
["#{local_staging_directory}/**/*.swix"],
|
167
|
-
Pkg::Config.swix_staging_server,
|
168
|
-
remote_path,
|
169
|
-
opts
|
170
|
-
)
|
151
|
+
ship_pkgs(["#{local_staging_directory}/**/*.swix"], Pkg::Config.swix_staging_server, remote_path, opts)
|
171
152
|
end
|
172
153
|
|
173
154
|
def ship_msi(local_staging_directory, remote_path, opts = {})
|
174
|
-
packages_have_shipped = ship_pkgs(
|
175
|
-
["#{local_staging_directory}/**/*.msi"],
|
176
|
-
Pkg::Config.msi_staging_server,
|
177
|
-
remote_path,
|
178
|
-
opts
|
179
|
-
)
|
180
|
-
return unless packages_have_shipped
|
181
|
-
|
182
|
-
# Create the symlinks for the latest supported repo
|
183
|
-
Pkg::Util::Net.remote_create_latest_symlink(
|
184
|
-
Pkg::Config.project,
|
185
|
-
Pkg::Paths.artifacts_path(
|
186
|
-
Pkg::Platforms.generic_platform_tag('windows'),
|
187
|
-
remote_path,
|
188
|
-
opts[:nonfinal]
|
189
|
-
),
|
190
|
-
'msi',
|
191
|
-
arch: 'x64'
|
192
|
-
)
|
155
|
+
packages_have_shipped = ship_pkgs(["#{local_staging_directory}/**/*.msi"], Pkg::Config.msi_staging_server, remote_path, opts)
|
193
156
|
|
194
|
-
|
195
|
-
|
196
|
-
Pkg::Paths.artifacts_path(
|
197
|
-
|
198
|
-
|
199
|
-
opts[:nonfinal]
|
200
|
-
),
|
201
|
-
'msi',
|
202
|
-
arch: 'x86'
|
203
|
-
)
|
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
|
204
162
|
end
|
205
163
|
|
206
164
|
def ship_gem(local_staging_directory, remote_path, opts = {})
|
@@ -208,32 +166,44 @@ module Pkg::Util::Ship
|
|
208
166
|
end
|
209
167
|
|
210
168
|
def ship_tar(local_staging_directory, remote_path, opts = {})
|
211
|
-
ship_pkgs(
|
212
|
-
["#{local_staging_directory}/*.tar.gz*"],
|
213
|
-
Pkg::Config.tar_staging_server,
|
214
|
-
remote_path,
|
215
|
-
opts
|
216
|
-
)
|
169
|
+
ship_pkgs(["#{local_staging_directory}/*.tar.gz*"], Pkg::Config.tar_staging_server, remote_path, opts)
|
217
170
|
end
|
218
171
|
|
219
172
|
def rolling_repo_link_command(platform_tag, repo_path, nonfinal = false)
|
220
|
-
base_path, link_path = Pkg::Paths.artifacts_base_path_and_link_path(
|
221
|
-
platform_tag,
|
222
|
-
repo_path,
|
223
|
-
nonfinal
|
224
|
-
)
|
173
|
+
base_path, link_path = Pkg::Paths.artifacts_base_path_and_link_path(platform_tag, repo_path, nonfinal)
|
225
174
|
|
226
175
|
if link_path.nil?
|
227
176
|
puts "No link target set, not creating rolling repo link for #{base_path}"
|
228
177
|
return nil
|
229
178
|
end
|
179
|
+
|
180
|
+
cmd = <<-CMD
|
181
|
+
if [ ! -d #{base_path} ] ; then
|
182
|
+
echo "Link target '#{base_path}' does not exist; skipping"
|
183
|
+
exit 0
|
184
|
+
fi
|
185
|
+
# If it's a link but pointing to the wrong place, remove the link
|
186
|
+
# This is likely to happen around the transition times, like puppet5 -> puppet6
|
187
|
+
if [ -L #{link_path} ] && [ ! #{base_path} -ef #{link_path} ] ; then
|
188
|
+
rm #{link_path}
|
189
|
+
# This is the link you're looking for, nothing to see here
|
190
|
+
elif [ -L #{link_path} ] ; then
|
191
|
+
exit 0
|
192
|
+
# Don't want to delete it if it isn't a link, that could be destructive
|
193
|
+
# So, fail!
|
194
|
+
elif [ -e #{link_path} ] ; then
|
195
|
+
echo "#{link_path} exists but isn't a link, I don't know what to do with this" >&2
|
196
|
+
exit 1
|
197
|
+
fi
|
198
|
+
ln -s #{base_path} #{link_path}
|
199
|
+
CMD
|
230
200
|
end
|
231
201
|
|
232
202
|
def create_rolling_repo_link(platform_tag, staging_server, repo_path, nonfinal = false)
|
233
203
|
command = rolling_repo_link_command(platform_tag, repo_path, nonfinal)
|
234
204
|
|
235
205
|
Pkg::Util::Net.remote_execute(staging_server, command) unless command.nil?
|
236
|
-
rescue
|
206
|
+
rescue => e
|
237
207
|
fail "Failed to create rolling repo link for '#{platform_tag}'.\n#{e}\n#{e.backtrace}"
|
238
208
|
end
|
239
209
|
|
@@ -244,33 +214,10 @@ module Pkg::Util::Ship
|
|
244
214
|
swix_path = Pkg::Paths.remote_repo_base(nonfinal: nonfinal, package_format: 'swix')
|
245
215
|
msi_path = Pkg::Paths.remote_repo_base(nonfinal: nonfinal, package_format: 'msi')
|
246
216
|
|
247
|
-
create_rolling_repo_link(
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
nonfinal
|
252
|
-
)
|
253
|
-
|
254
|
-
create_rolling_repo_link(
|
255
|
-
Pkg::Platforms.generic_platform_tag('osx'),
|
256
|
-
Pkg::Config.dmg_staging_server,
|
257
|
-
dmg_path,
|
258
|
-
nonfinal
|
259
|
-
)
|
260
|
-
|
261
|
-
create_rolling_repo_link(
|
262
|
-
Pkg::Platforms.generic_platform_tag('eos'),
|
263
|
-
Pkg::Config.swix_staging_server,
|
264
|
-
swix_path,
|
265
|
-
nonfinal
|
266
|
-
)
|
267
|
-
|
268
|
-
create_rolling_repo_link(
|
269
|
-
Pkg::Platforms.generic_platform_tag('windows'),
|
270
|
-
Pkg::Config.msi_staging_server,
|
271
|
-
msi_path,
|
272
|
-
nonfinal
|
273
|
-
)
|
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)
|
274
221
|
|
275
222
|
# We need to iterate through all the supported platforms here because of
|
276
223
|
# how deb repos are set up. Each codename will have its own link from the
|
@@ -284,12 +231,7 @@ module Pkg::Util::Ship
|
|
284
231
|
apt_path = Pkg::Config.nonfinal_apt_repo_staging_path
|
285
232
|
end
|
286
233
|
Pkg::Platforms.codenames.each do |codename|
|
287
|
-
create_rolling_repo_link(
|
288
|
-
Pkg::Platforms.codename_to_tags(codename)[0],
|
289
|
-
Pkg::Config.apt_signing_server,
|
290
|
-
apt_path,
|
291
|
-
nonfinal
|
292
|
-
)
|
234
|
+
create_rolling_repo_link(Pkg::Platforms.codename_to_tags(codename)[0], Pkg::Config.apt_signing_server, apt_path, nonfinal)
|
293
235
|
end
|
294
236
|
end
|
295
237
|
|
data/lib/packaging/util.rb
CHANGED
@@ -4,12 +4,8 @@ module Pkg::Util
|
|
4
4
|
require 'benchmark'
|
5
5
|
require 'base64'
|
6
6
|
require 'io/console'
|
7
|
-
require 'packaging/util/apt_staging_server'
|
8
|
-
require 'packaging/util/build_metadata'
|
9
7
|
require 'packaging/util/date'
|
10
|
-
require 'packaging/util/distribution_server'
|
11
8
|
require 'packaging/util/execution'
|
12
|
-
require 'packaging/util/ezbake'
|
13
9
|
require 'packaging/util/file'
|
14
10
|
require 'packaging/util/git'
|
15
11
|
require 'packaging/util/gpg'
|
@@ -23,7 +19,6 @@ module Pkg::Util
|
|
23
19
|
require 'packaging/util/tool'
|
24
20
|
require 'packaging/util/rake_utils'
|
25
21
|
require 'packaging/util/version'
|
26
|
-
require 'packaging/util/windows'
|
27
22
|
require 'packaging/util/git_tags'
|
28
23
|
|
29
24
|
def self.boolean_value(var)
|
data/tasks/jenkins.rake
CHANGED
data/tasks/ship.rake
CHANGED
@@ -1,77 +1,44 @@
|
|
1
1
|
namespace :pl do
|
2
2
|
namespace :remote do
|
3
|
-
#
|
4
|
-
#
|
5
|
-
#
|
6
|
-
#
|
7
|
-
# behavior.
|
3
|
+
# These hacky bits execute a pre-existing rake task on the Pkg::Config.apt_host
|
4
|
+
# The rake task takes packages in a specific directory and freights them
|
5
|
+
# to various target yum and apt repositories based on their specific type
|
6
|
+
# e.g., final vs devel vs PE vs FOSS packages
|
8
7
|
|
9
8
|
desc "Update '#{Pkg::Config.repo_name}' yum repository on '#{Pkg::Config.yum_staging_server}'"
|
10
9
|
task update_yum_repo: 'pl:fetch' do
|
11
10
|
command = Pkg::Config.yum_repo_command || 'rake -f /opt/repository/Rakefile mk_repo'
|
12
11
|
$stdout.puts "Really run remote repo update on '#{Pkg::Config.yum_staging_server}'? [y,n]"
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
Pkg::Config.yum_staging_server,
|
17
|
-
command,
|
18
|
-
{
|
19
|
-
repo_name: Pkg::Paths.yum_repo_name,
|
20
|
-
repo_path: Pkg::Config.yum_repo_path,
|
21
|
-
repo_host: Pkg::Config.yum_staging_server
|
22
|
-
}
|
23
|
-
)
|
12
|
+
if Pkg::Util.ask_yes_or_no
|
13
|
+
Pkg::Repo.update_repo(Pkg::Config.yum_staging_server, command, { :repo_name => Pkg::Paths.yum_repo_name, :repo_path => Pkg::Config.yum_repo_path, :repo_host => Pkg::Config.yum_staging_server })
|
14
|
+
end
|
24
15
|
end
|
25
16
|
|
26
17
|
desc "Update all final yum repositories on '#{Pkg::Config.yum_staging_server}'"
|
27
18
|
task update_all_final_yum_repos: 'pl:fetch' do
|
28
19
|
command = Pkg::Config.yum_repo_command || 'rake -f /opt/repository/Rakefile mk_repo'
|
29
20
|
$stdout.puts "Really run remote repo update on '#{Pkg::Config.yum_staging_server}'? [y,n]"
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
Pkg::Config.yum_staging_server,
|
34
|
-
command,
|
35
|
-
{
|
36
|
-
repo_name: '',
|
37
|
-
repo_path: Pkg::Config.yum_repo_path,
|
38
|
-
repo_host: Pkg::Config.yum_staging_server
|
39
|
-
}
|
40
|
-
)
|
21
|
+
if Pkg::Util.ask_yes_or_no
|
22
|
+
Pkg::Repo.update_repo(Pkg::Config.yum_staging_server, command, { :repo_name => '', :repo_path => Pkg::Config.yum_repo_path, :repo_host => Pkg::Config.yum_staging_server })
|
23
|
+
end
|
41
24
|
end
|
42
25
|
|
43
26
|
desc "Update '#{Pkg::Config.nonfinal_repo_name}' nightly yum repository on '#{Pkg::Config.yum_staging_server}'"
|
44
27
|
task update_nightlies_yum_repo: 'pl:fetch' do
|
45
28
|
command = Pkg::Config.yum_repo_command || 'rake -f /opt/repository-nightlies/Rakefile mk_repo'
|
46
29
|
$stdout.puts "Really run remote repo update on '#{Pkg::Config.yum_staging_server}'? [y,n]"
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
Pkg::Config.yum_staging_server,
|
51
|
-
command,
|
52
|
-
{
|
53
|
-
repo_name: Pkg::Config.nonfinal_repo_name,
|
54
|
-
repo_path: Pkg::Config.nonfinal_yum_repo_path,
|
55
|
-
repo_host: Pkg::Config.yum_staging_server
|
56
|
-
}
|
57
|
-
)
|
30
|
+
if Pkg::Util.ask_yes_or_no
|
31
|
+
Pkg::Repo.update_repo(Pkg::Config.yum_staging_server, command, { :repo_name => Pkg::Config.nonfinal_repo_name, :repo_path => Pkg::Config.nonfinal_yum_repo_path, :repo_host => Pkg::Config.yum_staging_server })
|
32
|
+
end
|
58
33
|
end
|
59
34
|
|
60
35
|
desc "Update all nightly yum repositories on '#{Pkg::Config.yum_staging_server}'"
|
61
36
|
task update_all_nightlies_yum_repos: 'pl:fetch' do
|
62
37
|
command = Pkg::Config.yum_repo_command || 'rake -f /opt/repository-nightlies/Rakefile mk_repo'
|
63
38
|
$stdout.puts "Really run remote repo update on '#{Pkg::Config.yum_staging_server}'? [y,n]"
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
Pkg::Config.yum_staging_server,
|
68
|
-
command,
|
69
|
-
{
|
70
|
-
repo_name: '',
|
71
|
-
repo_path: Pkg::Config.nonfinal_yum_repo_path,
|
72
|
-
repo_host: Pkg::Config.yum_staging_server
|
73
|
-
}
|
74
|
-
)
|
39
|
+
if Pkg::Util.ask_yes_or_no
|
40
|
+
Pkg::Repo.update_repo(Pkg::Config.yum_staging_server, command, { :repo_name => '', :repo_path => Pkg::Config.nonfinal_yum_repo_path, :repo_host => Pkg::Config.yum_staging_server })
|
41
|
+
end
|
75
42
|
end
|
76
43
|
|
77
44
|
task freight: :update_apt_repo
|
@@ -79,35 +46,17 @@ namespace :pl do
|
|
79
46
|
desc "Update remote apt repository on '#{Pkg::Config.apt_signing_server}'"
|
80
47
|
task update_apt_repo: 'pl:fetch' do
|
81
48
|
$stdout.puts "Really run remote repo update on '#{Pkg::Config.apt_signing_server}'? [y,n]"
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
Pkg::Config.apt_signing_server,
|
86
|
-
Pkg::Config.apt_repo_command,
|
87
|
-
{
|
88
|
-
repo_name: Pkg::Paths.apt_repo_name,
|
89
|
-
repo_path: Pkg::Config.apt_repo_path,
|
90
|
-
repo_host: Pkg::Config.apt_host,
|
91
|
-
repo_url: Pkg::Config.apt_repo_url
|
92
|
-
}
|
93
|
-
)
|
49
|
+
if Pkg::Util.ask_yes_or_no
|
50
|
+
Pkg::Repo.update_repo(Pkg::Config.apt_signing_server, Pkg::Config.apt_repo_command, { :repo_name => Pkg::Paths.apt_repo_name, :repo_path => Pkg::Config.apt_repo_path, :repo_host => Pkg::Config.apt_host, :repo_url => Pkg::Config.apt_repo_url })
|
51
|
+
end
|
94
52
|
end
|
95
53
|
|
96
54
|
desc "Update nightlies apt repository on '#{Pkg::Config.apt_signing_server}'"
|
97
55
|
task update_nightlies_apt_repo: 'pl:fetch' do
|
98
56
|
$stdout.puts "Really run remote repo update on '#{Pkg::Config.apt_signing_server}'? [y,n]"
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
Pkg::Config.apt_signing_server,
|
103
|
-
Pkg::Config.nonfinal_apt_repo_command,
|
104
|
-
{
|
105
|
-
repo_name: Pkg::Config.nonfinal_repo_name,
|
106
|
-
repo_path: Pkg::Config.nonfinal_apt_repo_path,
|
107
|
-
repo_host: Pkg::Config.apt_host,
|
108
|
-
repo_url: Pkg::Config.apt_repo_url
|
109
|
-
}
|
110
|
-
)
|
57
|
+
if Pkg::Util.ask_yes_or_no
|
58
|
+
Pkg::Repo.update_repo(Pkg::Config.apt_signing_server, Pkg::Config.nonfinal_apt_repo_command, { :repo_name => Pkg::Config.nonfinal_repo_name, :repo_path => Pkg::Config.nonfinal_apt_repo_path, :repo_host => Pkg::Config.apt_host, :repo_url => Pkg::Config.apt_repo_url })
|
59
|
+
end
|
111
60
|
end
|
112
61
|
|
113
62
|
desc "Update apt and yum repos"
|
@@ -125,31 +74,32 @@ namespace :pl do
|
|
125
74
|
desc "Update remote ips repository on #{Pkg::Config.ips_host}"
|
126
75
|
task :update_ips_repo => 'pl:fetch' do
|
127
76
|
if Dir['pkg/ips/pkgs/**/*'].empty? && Dir['pkg/solaris/11/**/*'].empty?
|
128
|
-
$stdout.puts "
|
129
|
-
|
130
|
-
end
|
77
|
+
$stdout.puts "There aren't any p5p packages in pkg/ips/pkgs or pkg/solaris/11. Maybe something went wrong?"
|
78
|
+
else
|
131
79
|
|
132
|
-
|
133
|
-
|
80
|
+
if !Dir['pkg/ips/pkgs/**/*'].empty?
|
81
|
+
source_dir = 'pkg/ips/pkgs/'
|
82
|
+
else
|
83
|
+
source_dir = 'pkg/solaris/11/'
|
84
|
+
end
|
134
85
|
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
86
|
+
tmpdir, _ = Pkg::Util::Net.remote_execute(
|
87
|
+
Pkg::Config.ips_host,
|
88
|
+
'mktemp -d -p /var/tmp',
|
89
|
+
{ capture_output: true }
|
90
|
+
)
|
91
|
+
tmpdir.chomp!
|
141
92
|
|
142
|
-
|
93
|
+
Pkg::Util::Net.rsync_to(source_dir, Pkg::Config.ips_host, tmpdir)
|
143
94
|
|
144
|
-
|
145
|
-
|
95
|
+
remote_cmd = %(for pkg in #{tmpdir}/*.p5p; do
|
96
|
+
sudo pkgrecv -s $pkg -d #{Pkg::Config.ips_path} '*';
|
146
97
|
done)
|
147
98
|
|
148
|
-
|
149
|
-
|
150
|
-
"sudo
|
151
|
-
|
152
|
-
"sudo /usr/sbin/svcadm restart svc:/application/pkg/server:#{Pkg::Config.ips_repo || 'default'}")
|
99
|
+
Pkg::Util::Net.remote_execute(Pkg::Config.ips_host, remote_cmd)
|
100
|
+
Pkg::Util::Net.remote_execute(Pkg::Config.ips_host, "sudo pkgrepo refresh -s #{Pkg::Config.ips_path}")
|
101
|
+
Pkg::Util::Net.remote_execute(Pkg::Config.ips_host, "sudo /usr/sbin/svcadm restart svc:/application/pkg/server:#{Pkg::Config.ips_repo || 'default'}")
|
102
|
+
end
|
153
103
|
end
|
154
104
|
|
155
105
|
desc "Move dmg repos from #{Pkg::Config.dmg_staging_server} to #{Pkg::Config.dmg_host}"
|
@@ -285,7 +235,6 @@ namespace :pl do
|
|
285
235
|
|
286
236
|
desc "Sync signed apt repos from #{Pkg::Config.apt_signing_server} to Google Cloud Platform"
|
287
237
|
task :sync_apt_repo_to_gcp => 'pl:fetch' do
|
288
|
-
ssh = Pkg::Util::Tool.check_tool('ssh')
|
289
238
|
target_site = 'apt.repos.puppetlabs.com'
|
290
239
|
sync_command_puppet_6 = "#{GCP_REPO_SYNC} apt.repos.puppet.com puppet6"
|
291
240
|
sync_command_puppet_7 = "#{GCP_REPO_SYNC} apt.repos.puppet.com puppet7"
|
@@ -294,11 +243,8 @@ namespace :pl do
|
|
294
243
|
puts
|
295
244
|
|
296
245
|
Pkg::Util::Execution.retry_on_fail(times: 3) do
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
Pkg::Util::Execution.retry_on_fail(times: 3) do
|
301
|
-
%x(#{ssh} #{Pkg::Config.apt_signing_server} '/bin/bash -l -c "#{sync_command_puppet_7}"')
|
246
|
+
Pkg::Util::Net.remote_execute(Pkg::Config.apt_signing_server, sync_command_puppet_6)
|
247
|
+
Pkg::Util::Net.remote_execute(Pkg::Config.apt_signing_server, sync_command_puppet_7)
|
302
248
|
end
|
303
249
|
end
|
304
250
|
# Keep 'deploy' for backward compatibility
|
@@ -346,13 +292,6 @@ namespace :pl do
|
|
346
292
|
end
|
347
293
|
end
|
348
294
|
|
349
|
-
##
|
350
|
-
## Here's where we start 'shipping' (old terminology) or 'staging' (current terminology)
|
351
|
-
## by copying local 'pkg' directories to the staging server.
|
352
|
-
##
|
353
|
-
## Note, that for debs, we conflate 'staging server' with 'signing server' because we
|
354
|
-
## must stage in th place where we sign.
|
355
|
-
##
|
356
295
|
desc "Ship mocked rpms to #{Pkg::Config.yum_staging_server}"
|
357
296
|
task ship_rpms: 'pl:fetch' do
|
358
297
|
Pkg::Util::Ship.ship_rpms('pkg', Pkg::Config.yum_repo_path)
|
@@ -363,7 +302,6 @@ namespace :pl do
|
|
363
302
|
Pkg::Util::Ship.ship_rpms('pkg', Pkg::Config.nonfinal_yum_repo_path, nonfinal: true)
|
364
303
|
end
|
365
304
|
|
366
|
-
## This is the old-style deb shipping
|
367
305
|
desc "Ship cow-built debs to #{Pkg::Config.apt_signing_server}"
|
368
306
|
task ship_debs: 'pl:fetch' do
|
369
307
|
Pkg::Util::Ship.ship_debs('pkg', Pkg::Config.apt_repo_staging_path, chattr: false)
|
@@ -371,20 +309,7 @@ namespace :pl do
|
|
371
309
|
|
372
310
|
desc "Ship nightly debs to #{Pkg::Config.apt_signing_server}"
|
373
311
|
task ship_nightly_debs: 'pl:fetch' do
|
374
|
-
Pkg::Util::Ship.ship_debs(
|
375
|
-
'pkg', Pkg::Config.nonfinal_apt_repo_staging_path, chattr: false, nonfinal: true)
|
376
|
-
end
|
377
|
-
|
378
|
-
## This is the new-style apt stager
|
379
|
-
desc "Stage debs to #{Pkg::Config.apt_signing_server}"
|
380
|
-
task stage_stable_debs: 'pl:fetch' do
|
381
|
-
Pkg::Util::AptStagingServer.send_packages('pkg', 'stable')
|
382
|
-
end
|
383
|
-
task stage_debs: :stage_stable_debs
|
384
|
-
|
385
|
-
desc "Stage nightly debs to #{Pkg::Config.apt_signing_server}"
|
386
|
-
task stage_nightly_debs: 'pl:fetch' do
|
387
|
-
Pkg::Util::AptStagingServer.send_packages('pkg', 'nightly')
|
312
|
+
Pkg::Util::Ship.ship_debs('pkg', Pkg::Config.nonfinal_apt_repo_staging_path, chattr: false, nonfinal: true)
|
388
313
|
end
|
389
314
|
|
390
315
|
desc 'Ship built gem to rubygems.org, internal Gem mirror, and public file server'
|
@@ -400,13 +325,12 @@ namespace :pl do
|
|
400
325
|
puts 'This will ship to an internal gem mirror, a public file server, and rubygems.org'
|
401
326
|
puts "Do you want to start shipping the rubygem '#{gem_file}'?"
|
402
327
|
next unless Pkg::Util.ask_yes_or_no
|
403
|
-
|
404
328
|
Rake::Task['pl:ship_gem_to_rubygems'].execute(file: gem_file)
|
405
329
|
end
|
406
330
|
|
407
331
|
Rake::Task['pl:ship_gem_to_downloads'].invoke
|
408
332
|
else
|
409
|
-
|
333
|
+
$stderr.puts 'Not shipping development gem using odd_even strategy for the sake of your users.'
|
410
334
|
end
|
411
335
|
end
|
412
336
|
end
|
@@ -418,7 +342,6 @@ namespace :pl do
|
|
418
342
|
if Pkg::Config.build_gem
|
419
343
|
fail 'Value `Pkg::Config.gem_host` not defined, skipping nightly ship' unless Pkg::Config.gem_host
|
420
344
|
fail 'Value `Pkg::Config.nonfinal_gem_path` not defined, skipping nightly ship' unless Pkg::Config.nonfinal_gem_path
|
421
|
-
|
422
345
|
FileList['pkg/*.gem'].each do |gem_file|
|
423
346
|
Pkg::Gem.ship_to_internal_mirror(gem_file)
|
424
347
|
end
|
@@ -528,25 +451,22 @@ namespace :pl do
|
|
528
451
|
|
529
452
|
desc 'UBER ship: ship all the things in pkg'
|
530
453
|
task uber_ship: 'pl:fetch' do
|
531
|
-
|
454
|
+
if Pkg::Util.confirm_ship(FileList['pkg/**/*'])
|
455
|
+
Rake::Task['pl:ship_rpms'].invoke
|
456
|
+
Rake::Task['pl:ship_debs'].invoke
|
457
|
+
Rake::Task['pl:ship_dmg'].invoke
|
458
|
+
Rake::Task['pl:ship_swix'].invoke
|
459
|
+
Rake::Task['pl:ship_nuget'].invoke
|
460
|
+
Rake::Task['pl:ship_tar'].invoke
|
461
|
+
Rake::Task['pl:ship_svr4'].invoke
|
462
|
+
Rake::Task['pl:ship_p5p'].invoke
|
463
|
+
Rake::Task['pl:ship_msi'].invoke
|
464
|
+
add_shipped_metrics(pe_version: ENV['PE_VER'], is_rc: !Pkg::Util::Version.final?) if Pkg::Config.benchmark
|
465
|
+
post_shipped_metrics if Pkg::Config.benchmark
|
466
|
+
else
|
532
467
|
puts 'Ship canceled'
|
533
468
|
exit
|
534
469
|
end
|
535
|
-
|
536
|
-
Rake::Task['pl:ship_rpms'].invoke
|
537
|
-
Rake::Task['pl:ship_debs'].invoke
|
538
|
-
Rake::Task['pl:ship_dmg'].invoke
|
539
|
-
Rake::Task['pl:ship_swix'].invoke
|
540
|
-
Rake::Task['pl:ship_nuget'].invoke
|
541
|
-
Rake::Task['pl:ship_tar'].invoke
|
542
|
-
Rake::Task['pl:ship_svr4'].invoke
|
543
|
-
Rake::Task['pl:ship_p5p'].invoke
|
544
|
-
Rake::Task['pl:ship_msi'].invoke
|
545
|
-
|
546
|
-
if Pkg::Config.benchmark
|
547
|
-
add_shipped_metrics(pe_version: ENV['PE_VER'], is_rc: !Pkg::Util::Version.final?)
|
548
|
-
post_shipped_metrics
|
549
|
-
end
|
550
470
|
end
|
551
471
|
|
552
472
|
desc 'Create the rolling repo links'
|
@@ -610,7 +530,7 @@ namespace :pl do
|
|
610
530
|
{ extra_options: '-oBatchMode=yes' }
|
611
531
|
)
|
612
532
|
end
|
613
|
-
rescue
|
533
|
+
rescue
|
614
534
|
errs << "Unlocking the OSX keychain failed! Check the password in your .bashrc on #{Pkg::Config.osx_signing_server}"
|
615
535
|
end
|
616
536
|
|
@@ -649,56 +569,66 @@ namespace :pl do
|
|
649
569
|
task :ship_to_artifactory, :local_dir do |_t, args|
|
650
570
|
Pkg::Util::RakeUtils.invoke_task('pl:fetch')
|
651
571
|
unless Pkg::Config.project
|
652
|
-
fail "
|
653
|
-
"in the 'PROJECT_OVERRIDE' environment variable."
|
572
|
+
fail "You must set the 'project' in build_defaults.yaml or with the 'PROJECT_OVERRIDE' environment variable."
|
654
573
|
end
|
655
|
-
|
656
574
|
artifactory = Pkg::ManageArtifactory.new(Pkg::Config.project, Pkg::Config.ref)
|
657
575
|
|
658
576
|
local_dir = args.local_dir || 'pkg'
|
659
|
-
Dir.glob("#{local_dir}/**/*").reject { |e| File.directory? e }
|
660
|
-
|
661
|
-
if
|
662
|
-
|
663
|
-
|
577
|
+
artifacts = Dir.glob("#{local_dir}/**/*").reject { |e| File.directory? e }
|
578
|
+
artifacts.sort! do |a, b|
|
579
|
+
if File.extname(a) =~ /(md5|sha\d+)/ && File.extname(b) !~ /(md5|sha\d+)/
|
580
|
+
1
|
581
|
+
elsif File.extname(b) =~ /(md5|sha\d+)/ && File.extname(a) !~ /(md5|sha\d+)/
|
582
|
+
-1
|
583
|
+
else
|
584
|
+
a <=> b
|
664
585
|
end
|
665
|
-
|
666
|
-
|
667
|
-
if
|
668
|
-
|
669
|
-
|
586
|
+
end
|
587
|
+
artifacts.each do |artifact|
|
588
|
+
if File.extname(artifact) == ".yaml" || File.extname(artifact) == ".json"
|
589
|
+
artifactory.deploy_package(artifact)
|
590
|
+
elsif artifactory.package_exists_on_artifactory?(artifact)
|
591
|
+
warn "Attempt to upload '#{artifact}' failed. Package already exists!"
|
592
|
+
else
|
593
|
+
artifactory.deploy_package(artifact)
|
670
594
|
end
|
671
|
-
|
672
|
-
artifactory.deploy_package(artifact)
|
673
595
|
end
|
674
596
|
end
|
675
597
|
|
676
|
-
desc 'Ship
|
598
|
+
desc 'Ship pkg directory contents to distribution server'
|
677
599
|
task :ship, :target, :local_dir do |_t, args|
|
678
600
|
Pkg::Util::RakeUtils.invoke_task('pl:fetch')
|
679
601
|
unless Pkg::Config.project
|
680
|
-
fail "
|
681
|
-
"in the 'PROJECT_OVERRIDE' environment variable."
|
602
|
+
fail "You must set the 'project' in build_defaults.yaml or with the 'PROJECT_OVERRIDE' environment variable."
|
682
603
|
end
|
683
|
-
|
684
604
|
target = args.target || 'artifacts'
|
685
605
|
local_dir = args.local_dir || 'pkg'
|
686
|
-
project_basedir =
|
687
|
-
|
688
|
-
)
|
689
|
-
artifact_dir = File.join(project_basedir, target)
|
606
|
+
project_basedir = "#{Pkg::Config.jenkins_repo_path}/#{Pkg::Config.project}/#{Pkg::Config.ref}"
|
607
|
+
artifact_dir = "#{project_basedir}/#{target}"
|
690
608
|
|
691
609
|
# For EZBake builds, we also want to include the ezbake.manifest file to
|
692
610
|
# get a snapshot of this build and all dependencies. We eventually will
|
693
611
|
# create a yaml version of this file, but until that point we want to
|
694
612
|
# make the original ezbake.manifest available
|
695
|
-
|
613
|
+
#
|
614
|
+
ezbake_manifest = File.join('ext', 'ezbake.manifest')
|
615
|
+
if File.exist?(ezbake_manifest)
|
616
|
+
cp(ezbake_manifest, File.join(local_dir, "#{Pkg::Config.ref}.ezbake.manifest"))
|
617
|
+
end
|
618
|
+
ezbake_yaml = File.join("ext", "ezbake.manifest.yaml")
|
619
|
+
if File.exists?(ezbake_yaml)
|
620
|
+
cp(ezbake_yaml, File.join(local_dir, "#{Pkg::Config.ref}.ezbake.manifest.yaml"))
|
621
|
+
end
|
696
622
|
|
697
623
|
# Inside build_metadata*.json files there is additional metadata containing
|
698
624
|
# information such as git ref and dependencies that are needed at build
|
699
625
|
# time. If these files exist, copy them downstream.
|
700
626
|
# Typically these files are named 'ext/build_metadata.<project>.<platform>.json'
|
701
|
-
|
627
|
+
build_metadata_json_files = Dir.glob('ext/build_metadata*.json')
|
628
|
+
build_metadata_json_files.each do |source_file|
|
629
|
+
target_file = File.join(local_dir, "#{Pkg::Config.ref}.#{File.basename(source_file)}")
|
630
|
+
cp(source_file, target_file)
|
631
|
+
end
|
702
632
|
|
703
633
|
# Sadly, the packaging repo cannot yet act on its own, without living
|
704
634
|
# inside of a packaging-repo compatible project. This means in order to
|
@@ -734,11 +664,54 @@ namespace :pl do
|
|
734
664
|
# and if the source package exists before linking. Searching for the
|
735
665
|
# packages has been restricted specifically to just the pkg/windows dir
|
736
666
|
# on purpose, as this is where we currently have all windows packages
|
737
|
-
# building to.
|
738
|
-
|
667
|
+
# building to. Once we move the Metadata about the output location in
|
668
|
+
# to one source of truth we can refactor this to use that to search
|
669
|
+
# -Sean P. M. 08/12/16
|
670
|
+
|
671
|
+
{
|
672
|
+
'windows' => ['x86', 'x64'],
|
673
|
+
'windowsfips' => ['x64']
|
674
|
+
}.each_pair do |platform, archs|
|
675
|
+
packages = Dir["#{local_dir}/#{platform}/*"]
|
676
|
+
|
677
|
+
archs.each do |arch|
|
678
|
+
package_version = Pkg::Util::Git.describe.tr('-', '.')
|
679
|
+
package_filename = File.join(local_dir, platform, "#{Pkg::Config.project}-#{package_version}-#{arch}.msi")
|
680
|
+
link_filename = File.join(local_dir, platform, "#{Pkg::Config.project}-#{arch}.msi")
|
681
|
+
|
682
|
+
next unless !packages.include?(link_filename) && packages.include?(package_filename)
|
683
|
+
# Dear future code spelunkers:
|
684
|
+
# Using symlinks instead of hard links causes failures when we try
|
685
|
+
# to set these files to be immutable. Also be wary of whether the
|
686
|
+
# linking utility you're using expects the source path to be relative
|
687
|
+
# to the link target or pwd.
|
688
|
+
#
|
689
|
+
FileUtils.ln(package_filename, link_filename)
|
690
|
+
end
|
691
|
+
end
|
692
|
+
|
693
|
+
Pkg::Util::Execution.retry_on_fail(times: 3) do
|
694
|
+
Pkg::Util::Net.remote_execute(Pkg::Config.distribution_server, "mkdir --mode=775 -p #{project_basedir}")
|
695
|
+
Pkg::Util::Net.remote_execute(Pkg::Config.distribution_server, "mkdir -p #{artifact_dir}")
|
696
|
+
Pkg::Util::Net.rsync_to("#{local_dir}/", Pkg::Config.distribution_server, "#{artifact_dir}/", extra_flags: ['--ignore-existing', '--exclude repo_configs'])
|
697
|
+
end
|
698
|
+
|
699
|
+
# In order to get a snapshot of what this build looked like at the time
|
700
|
+
# of shipping, we also generate and ship the params file
|
701
|
+
#
|
702
|
+
Pkg::Config.config_to_yaml(local_dir)
|
703
|
+
Pkg::Util::Execution.retry_on_fail(:times => 3) do
|
704
|
+
Pkg::Util::Net.rsync_to("#{local_dir}/#{Pkg::Config.ref}.yaml", Pkg::Config.distribution_server, "#{artifact_dir}/", extra_flags: ["--exclude repo_configs"])
|
705
|
+
end
|
706
|
+
|
707
|
+
# If we just shipped a tagged version, we want to make it immutable
|
708
|
+
files = Dir.glob("#{local_dir}/**/*").select { |f| File.file?(f) and !f.include? "#{Pkg::Config.ref}.yaml" }.map do |file|
|
709
|
+
"#{artifact_dir}/#{file.sub(/^#{local_dir}\//, '')}"
|
710
|
+
end
|
739
711
|
|
740
|
-
|
741
|
-
Pkg::Util::
|
712
|
+
Pkg::Util::Net.remote_set_ownership(Pkg::Config.distribution_server, 'root', 'release', files)
|
713
|
+
Pkg::Util::Net.remote_set_permissions(Pkg::Config.distribution_server, '0664', files)
|
714
|
+
Pkg::Util::Net.remote_set_immutable(Pkg::Config.distribution_server, files)
|
742
715
|
end
|
743
716
|
|
744
717
|
desc 'Ship generated repository configs to the distribution server'
|
metadata
CHANGED
@@ -1,29 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: packaging
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.103.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Puppet Labs
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-10-
|
11
|
+
date: 2021-10-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
-
- !ruby/object:Gem::Dependency
|
14
|
-
name: pry-byebug
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - ">="
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: '0'
|
20
|
-
type: :development
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - ">="
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: '0'
|
27
13
|
- !ruby/object:Gem::Dependency
|
28
14
|
name: rspec
|
29
15
|
requirement: !ruby/object:Gem::Requirement
|
@@ -67,19 +53,19 @@ dependencies:
|
|
67
53
|
- !ruby/object:Gem::Version
|
68
54
|
version: '0'
|
69
55
|
- !ruby/object:Gem::Dependency
|
70
|
-
name:
|
56
|
+
name: rake
|
71
57
|
requirement: !ruby/object:Gem::Requirement
|
72
58
|
requirements:
|
73
59
|
- - ">="
|
74
60
|
- !ruby/object:Gem::Version
|
75
|
-
version: '
|
61
|
+
version: '12.3'
|
76
62
|
type: :runtime
|
77
63
|
prerelease: false
|
78
64
|
version_requirements: !ruby/object:Gem::Requirement
|
79
65
|
requirements:
|
80
66
|
- - ">="
|
81
67
|
- !ruby/object:Gem::Version
|
82
|
-
version: '
|
68
|
+
version: '12.3'
|
83
69
|
- !ruby/object:Gem::Dependency
|
84
70
|
name: artifactory
|
85
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -94,20 +80,6 @@ dependencies:
|
|
94
80
|
- - "~>"
|
95
81
|
- !ruby/object:Gem::Version
|
96
82
|
version: '2'
|
97
|
-
- !ruby/object:Gem::Dependency
|
98
|
-
name: csv
|
99
|
-
requirement: !ruby/object:Gem::Requirement
|
100
|
-
requirements:
|
101
|
-
- - '='
|
102
|
-
- !ruby/object:Gem::Version
|
103
|
-
version: 3.1.5
|
104
|
-
type: :runtime
|
105
|
-
prerelease: false
|
106
|
-
version_requirements: !ruby/object:Gem::Requirement
|
107
|
-
requirements:
|
108
|
-
- - '='
|
109
|
-
- !ruby/object:Gem::Version
|
110
|
-
version: 3.1.5
|
111
83
|
- !ruby/object:Gem::Dependency
|
112
84
|
name: release-metrics
|
113
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -123,19 +95,19 @@ dependencies:
|
|
123
95
|
- !ruby/object:Gem::Version
|
124
96
|
version: '0'
|
125
97
|
- !ruby/object:Gem::Dependency
|
126
|
-
name:
|
98
|
+
name: csv
|
127
99
|
requirement: !ruby/object:Gem::Requirement
|
128
100
|
requirements:
|
129
|
-
- -
|
101
|
+
- - '='
|
130
102
|
- !ruby/object:Gem::Version
|
131
|
-
version:
|
103
|
+
version: 3.1.5
|
132
104
|
type: :runtime
|
133
105
|
prerelease: false
|
134
106
|
version_requirements: !ruby/object:Gem::Requirement
|
135
107
|
requirements:
|
136
|
-
- -
|
108
|
+
- - '='
|
137
109
|
- !ruby/object:Gem::Version
|
138
|
-
version:
|
110
|
+
version: 3.1.5
|
139
111
|
description: Packaging automation written in Rake and Ruby. Easily build native packages
|
140
112
|
for most platforms with a few data files and git.
|
141
113
|
email: info@puppetlabs.com
|
@@ -172,12 +144,8 @@ files:
|
|
172
144
|
- lib/packaging/sign/rpm.rb
|
173
145
|
- lib/packaging/tar.rb
|
174
146
|
- lib/packaging/util.rb
|
175
|
-
- lib/packaging/util/apt_staging_server.rb
|
176
|
-
- lib/packaging/util/build_metadata.rb
|
177
147
|
- lib/packaging/util/date.rb
|
178
|
-
- lib/packaging/util/distribution_server.rb
|
179
148
|
- lib/packaging/util/execution.rb
|
180
|
-
- lib/packaging/util/ezbake.rb
|
181
149
|
- lib/packaging/util/file.rb
|
182
150
|
- lib/packaging/util/git.rb
|
183
151
|
- lib/packaging/util/git_tags.rb
|
@@ -192,7 +160,6 @@ files:
|
|
192
160
|
- lib/packaging/util/ship.rb
|
193
161
|
- lib/packaging/util/tool.rb
|
194
162
|
- lib/packaging/util/version.rb
|
195
|
-
- lib/packaging/util/windows.rb
|
196
163
|
- spec/fixtures/config/ext/build_defaults.yaml
|
197
164
|
- spec/fixtures/config/ext/project_data.yaml
|
198
165
|
- spec/fixtures/configs/components/test_file.json
|
@@ -281,7 +248,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
281
248
|
requirements:
|
282
249
|
- - ">="
|
283
250
|
- !ruby/object:Gem::Version
|
284
|
-
version: 2.
|
251
|
+
version: 2.0.0
|
285
252
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
286
253
|
requirements:
|
287
254
|
- - ">="
|
@@ -1,8 +0,0 @@
|
|
1
|
-
# Utility methods for handling Apt staging server.
|
2
|
-
|
3
|
-
module Pkg::Util::AptStagingServer
|
4
|
-
def self.send_packages(pkg_directory, apt_component = 'stable')
|
5
|
-
%x(apt-stage-artifacts --component=#{apt_component} #{pkg_directory})
|
6
|
-
fail 'APT artifact staging failed.' unless $CHILD_STATUS.success?
|
7
|
-
end
|
8
|
-
end
|
@@ -1,17 +0,0 @@
|
|
1
|
-
# Utility methods for handling miscellaneous build metadata
|
2
|
-
|
3
|
-
require 'fileutils'
|
4
|
-
|
5
|
-
module Pkg::Util::BuildMetadata
|
6
|
-
class << self
|
7
|
-
def add_misc_json_files(target_directory)
|
8
|
-
misc_json_files = Dir.glob('ext/build_metadata*.json')
|
9
|
-
misc_json_files.each do |source_file|
|
10
|
-
target_file = File.join(
|
11
|
-
target_directory, "#{Pkg::Config.ref}.#{File.basename(source_file)}"
|
12
|
-
)
|
13
|
-
FileUtils.cp(source_file, target_file)
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
@@ -1,42 +0,0 @@
|
|
1
|
-
# Utility methods for the older distribution server
|
2
|
-
|
3
|
-
require 'fileutils'
|
4
|
-
|
5
|
-
module Pkg::Util::DistributionServer
|
6
|
-
class << self
|
7
|
-
def send_packages(local_source_directory, remote_target_directory)
|
8
|
-
Pkg::Util::Execution.retry_on_fail(times: 3) do
|
9
|
-
Pkg::Util::Net.remote_execute(
|
10
|
-
Pkg::Config.distribution_server,
|
11
|
-
"mkdir --mode=775 --parents #{remote_target_directory}"
|
12
|
-
)
|
13
|
-
Pkg::Util::Net.rsync_to(
|
14
|
-
"#{local_source_directory}/",
|
15
|
-
Pkg::Config.distribution_server, "#{remote_target_directory}/",
|
16
|
-
extra_flags: ['--ignore-existing', '--exclude repo_configs']
|
17
|
-
)
|
18
|
-
end
|
19
|
-
|
20
|
-
# In order to get a snapshot of what this build looked like at the time
|
21
|
-
# of shipping, we also generate and ship the params file
|
22
|
-
#
|
23
|
-
Pkg::Config.config_to_yaml(local_source_directory)
|
24
|
-
Pkg::Util::Execution.retry_on_fail(times: 3) do
|
25
|
-
Pkg::Util::Net.rsync_to(
|
26
|
-
"#{local_source_directory}/#{Pkg::Config.ref}.yaml",
|
27
|
-
Pkg::Config.distribution_server, "#{remote_target_directory}/",
|
28
|
-
extra_flags: ["--exclude repo_configs"]
|
29
|
-
)
|
30
|
-
end
|
31
|
-
|
32
|
-
# If we just shipped a tagged version, we want to make it immutable
|
33
|
-
files = Dir.glob("#{local_source_directory}/**/*")
|
34
|
-
.select { |f| File.file?(f) and !f.include? "#{Pkg::Config.ref}.yaml" }
|
35
|
-
.map { |f| "#{remote_target_directory}/#{f.sub(/^#{local_source_directory}\//, '')}" }
|
36
|
-
|
37
|
-
Pkg::Util::Net.remote_set_ownership(Pkg::Config.distribution_server, 'root', 'release', files)
|
38
|
-
Pkg::Util::Net.remote_set_permissions(Pkg::Config.distribution_server, '0664', files)
|
39
|
-
Pkg::Util::Net.remote_set_immutable(Pkg::Config.distribution_server, files)
|
40
|
-
end
|
41
|
-
end
|
42
|
-
end
|
@@ -1,26 +0,0 @@
|
|
1
|
-
# Utility methods for handling ezbake
|
2
|
-
|
3
|
-
require 'fileutils'
|
4
|
-
|
5
|
-
module Pkg::Util::EZbake
|
6
|
-
class << self
|
7
|
-
def add_manifest(target_directory)
|
8
|
-
ezbake_manifest = File.join('ext', 'ezbake.manifest')
|
9
|
-
ezbake_yaml = File.join('ext', 'ezbake.manifest.yaml')
|
10
|
-
|
11
|
-
if File.exist?(ezbake_manifest)
|
12
|
-
FileUtils.cp(
|
13
|
-
ezbake_manifest,
|
14
|
-
File.join(target_directory, "#{Pkg::Config.ref}.ezbake.manifest")
|
15
|
-
)
|
16
|
-
end
|
17
|
-
|
18
|
-
if File.exists?(ezbake_yaml)
|
19
|
-
FileUtils.cp(
|
20
|
-
ezbake_yaml,
|
21
|
-
File.join(target_directory, "#{Pkg::Config.ref}.ezbake.manifest.yaml")
|
22
|
-
)
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
@@ -1,38 +0,0 @@
|
|
1
|
-
# Utility methods for handling windows
|
2
|
-
|
3
|
-
require 'fileutils'
|
4
|
-
|
5
|
-
module Pkg::Util::Windows
|
6
|
-
class << self
|
7
|
-
def add_msi_links(local_source_directory)
|
8
|
-
{
|
9
|
-
'windows' => ['x86', 'x64'],
|
10
|
-
'windowsfips' => ['x64']
|
11
|
-
}.each_pair do |platform, archs|
|
12
|
-
packages = Dir["#{local_source_directory}/#{platform}/*"]
|
13
|
-
|
14
|
-
archs.each do |arch|
|
15
|
-
package_version = Pkg::Util::Git.describe.tr('-', '.')
|
16
|
-
package_filename = File.join(
|
17
|
-
local_source_directory, platform,
|
18
|
-
"#{Pkg::Config.project}-#{package_version}-#{arch}.msi"
|
19
|
-
)
|
20
|
-
link_filename = File.join(
|
21
|
-
local_source_directory,
|
22
|
-
platform,
|
23
|
-
"#{Pkg::Config.project}-#{arch}.msi"
|
24
|
-
)
|
25
|
-
|
26
|
-
next unless !packages.include?(link_filename) && packages.include?(package_filename)
|
27
|
-
|
28
|
-
# Dear future code spelunkers:
|
29
|
-
# Using symlinks instead of hard links causes failures when we try
|
30
|
-
# to set these files to be immutable. Also be wary of whether the
|
31
|
-
# linking utility you're using expects the source path to be relative
|
32
|
-
# to the link target or pwd.
|
33
|
-
FileUtils.ln(package_filename, link_filename)
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|