puppet 2.7.20 → 2.7.21
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of puppet might be problematic. Click here for more details.
- data/CHANGELOG +226 -0
- data/conf/auth.conf +3 -3
- data/ext/packaging/README.md +191 -57
- data/ext/packaging/spec/spec_helper.rb +2 -2
- data/ext/packaging/spec/tasks/00_utils_spec.rb +63 -18
- data/ext/packaging/spec/tasks/build_object_spec.rb +171 -0
- data/ext/packaging/tasks/00_utils.rake +186 -33
- data/ext/packaging/tasks/10_setupvars.rake +94 -65
- data/ext/packaging/tasks/20_setupextravars.rake +45 -26
- data/ext/packaging/tasks/30_metrics.rake +41 -0
- data/ext/packaging/tasks/apple.rake +92 -36
- data/ext/packaging/tasks/build.rake +183 -0
- data/ext/packaging/tasks/deb.rake +45 -40
- data/ext/packaging/tasks/deb_repos.rake +103 -0
- data/ext/packaging/tasks/doc.rake +5 -5
- data/ext/packaging/tasks/fetch.rake +35 -10
- data/ext/packaging/tasks/gem.rake +38 -27
- data/ext/packaging/tasks/ips.rake +14 -14
- data/ext/packaging/tasks/jenkins.rake +337 -0
- data/ext/packaging/tasks/mock.rake +153 -72
- data/ext/packaging/tasks/pe_deb.rake +2 -2
- data/ext/packaging/tasks/pe_remote.rake +22 -19
- data/ext/packaging/tasks/pe_rpm.rake +5 -5
- data/ext/packaging/tasks/pe_ship.rake +31 -21
- data/ext/packaging/tasks/pe_sign.rake +20 -19
- data/ext/packaging/tasks/pe_sles.rake +40 -36
- data/ext/packaging/tasks/pe_tar.rake +5 -0
- data/ext/packaging/tasks/release.rake +32 -12
- data/ext/packaging/tasks/remote_build.rake +141 -83
- data/ext/packaging/tasks/retrieve.rake +23 -0
- data/ext/packaging/tasks/rpm.rake +11 -19
- data/ext/packaging/tasks/rpm_repos.rake +127 -0
- data/ext/packaging/tasks/ship.rake +68 -55
- data/ext/packaging/tasks/sign.rake +38 -10
- data/ext/packaging/tasks/tar.rake +25 -9
- data/ext/packaging/tasks/update.rake +2 -2
- data/ext/packaging/tasks/version.rake +34 -14
- data/ext/packaging/tasks/z_data_dump.rake +33 -0
- data/lib/puppet/indirector/catalog/compiler.rb +13 -2
- data/lib/puppet/indirector/certificate_status/file.rb +5 -0
- data/lib/puppet/indirector/errors.rb +5 -0
- data/lib/puppet/indirector/file_bucket_file/file.rb +4 -0
- data/lib/puppet/indirector/file_bucket_file/selector.rb +4 -0
- data/lib/puppet/indirector/indirection.rb +1 -0
- data/lib/puppet/indirector/resource/active_record.rb +3 -0
- data/lib/puppet/indirector/resource/ral.rb +4 -0
- data/lib/puppet/indirector/resource/store_configs.rb +3 -0
- data/lib/puppet/indirector/resource/validator.rb +8 -0
- data/lib/puppet/indirector/rest.rb +8 -0
- data/lib/puppet/indirector/run/local.rb +4 -0
- data/lib/puppet/indirector/terminus.rb +20 -0
- data/lib/puppet/network/formats.rb +3 -3
- data/lib/puppet/network/handler/master.rb +1 -1
- data/lib/puppet/network/handler/report.rb +1 -1
- data/lib/puppet/network/http/handler.rb +7 -1
- data/lib/puppet/network/http/rack/rest.rb +7 -2
- data/lib/puppet/network/http/webrick.rb +1 -0
- data/lib/puppet/network/rest_authconfig.rb +1 -1
- data/lib/puppet/parser/templatewrapper.rb +17 -17
- data/lib/puppet/util/monkey_patches.rb +58 -0
- data/lib/puppet/version.rb +1 -1
- data/spec/integration/indirector/catalog/compiler_spec.rb +1 -0
- data/spec/integration/indirector/catalog/queue_spec.rb +1 -1
- data/spec/integration/resource/catalog_spec.rb +1 -0
- data/spec/unit/indirector/catalog/compiler_spec.rb +29 -2
- data/spec/unit/indirector/indirection_spec.rb +18 -1
- data/spec/unit/indirector/terminus_spec.rb +191 -177
- data/spec/unit/network/formats_spec.rb +6 -6
- data/spec/unit/network/http/handler_spec.rb +25 -0
- data/spec/unit/network/http/rack/rest_spec.rb +17 -0
- data/spec/unit/network/http/webrick_spec.rb +4 -0
- data/spec/unit/network/http_pool_spec.rb +0 -1
- data/spec/unit/network/rest_authconfig_spec.rb +16 -1
- data/spec/unit/parser/functions/inline_template_spec.rb +13 -0
- data/spec/unit/parser/functions/template_spec.rb +15 -0
- data/spec/unit/parser/templatewrapper_spec.rb +19 -4
- data/spec/unit/ssl/certificate_request_spec.rb +2 -0
- data/spec/unit/ssl/host_spec.rb +1 -0
- data/spec/unit/util/monkey_patches_spec.rb +12 -0
- data/test/language/snippets.rb +1 -1
- metadata +13 -2
@@ -0,0 +1,23 @@
|
|
1
|
+
##
|
2
|
+
# This task is intended to retrieve packages from the distribution server that
|
3
|
+
# have been built by jenkins and placed in a specific location,
|
4
|
+
# /opt/jenkins-builds/$PROJECT/$SHA where $PROJECT is the build project as
|
5
|
+
# established in project_data.yaml and $SHA is the git sha/tag of the project that
|
6
|
+
# was built into packages. The current day is assumed, but an environment
|
7
|
+
# variable override exists to retrieve packages from another day. The sha/tag is
|
8
|
+
# assumed to be the current project's HEAD, e.g. to retrieve packages for a
|
9
|
+
# release of 3.1.0, checkout 3.1.0 locally before retrieving.
|
10
|
+
#
|
11
|
+
|
12
|
+
namespace :pl do
|
13
|
+
namespace :jenkins do
|
14
|
+
desc "Retrieve packages from the distribution server\. Check out commit to retrieve"
|
15
|
+
task :retrieve, :target do |t, args|
|
16
|
+
target = args.target || "artifacts"
|
17
|
+
invoke_task("pl:fetch")
|
18
|
+
mkdir_p 'pkg'
|
19
|
+
rsync_from("#{@build.jenkins_repo_path}/#{@build.project}/#{@build.ref}/#{target}/", @build.distribution_server, "pkg/")
|
20
|
+
puts "Packages staged in pkg"
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -1,8 +1,12 @@
|
|
1
1
|
def build_rpm(buildarg = "-bs")
|
2
2
|
check_tool('rpmbuild')
|
3
3
|
temp = get_temp
|
4
|
-
dist =
|
5
|
-
|
4
|
+
if dist = el_version
|
5
|
+
if dist.to_i < 6
|
6
|
+
dist_string = "--define \"%dist .el#{dist}"
|
7
|
+
end
|
8
|
+
end
|
9
|
+
rpm_define = "#{dist_string} --define \"%_topdir #{temp}\" "
|
6
10
|
rpm_old_version = '--define "_source_filedigest_algorithm 1" --define "_binary_filedigest_algorithm 1" \
|
7
11
|
--define "_binary_payload w9.gzdio" --define "_source_payload w9.gzdio" \
|
8
12
|
--define "_default_patch_fuzz 2"'
|
@@ -11,13 +15,13 @@ def build_rpm(buildarg = "-bs")
|
|
11
15
|
if buildarg == '-ba'
|
12
16
|
mkdir_p 'pkg/rpm'
|
13
17
|
end
|
14
|
-
if @sign_tar
|
18
|
+
if @build.sign_tar
|
15
19
|
Rake::Task["pl:sign_tar"].invoke
|
16
|
-
cp_p "pkg/#{@
|
20
|
+
cp_p "pkg/#{@build.project}-#{@build.version}.tar.gz.asc", "#{temp}/SOURCES"
|
17
21
|
end
|
18
|
-
cp_p "pkg/#{@
|
19
|
-
erb "ext/redhat/#{@
|
20
|
-
sh "rpmbuild #{args} #{buildarg} --nodeps #{temp}/SPECS/#{@
|
22
|
+
cp_p "pkg/#{@build.project}-#{@build.version}.tar.gz", "#{temp}/SOURCES"
|
23
|
+
erb "ext/redhat/#{@build.project}.spec.erb", "#{temp}/SPECS/#{@build.project}.spec"
|
24
|
+
sh "rpmbuild #{args} #{buildarg} --nodeps #{temp}/SPECS/#{@build.project}.spec"
|
21
25
|
mv FileList["#{temp}/SRPMS/*.rpm"], "pkg/srpm"
|
22
26
|
if buildarg == '-ba'
|
23
27
|
mv FileList["#{temp}/RPMS/*/*.rpm"], "pkg/rpm"
|
@@ -31,18 +35,6 @@ def build_rpm(buildarg = "-bs")
|
|
31
35
|
end
|
32
36
|
end
|
33
37
|
|
34
|
-
def find_dist_version()
|
35
|
-
if File.exists?('/etc/fedora-release')
|
36
|
-
nil
|
37
|
-
elsif File.exists?('/etc/redhat-release')
|
38
|
-
dist = %x{rpm -q --qf \"%{VERSION}\" $(rpm -q --whatprovides /etc/redhat-release )}
|
39
|
-
unless dist.to_i > 5
|
40
|
-
return "--define \"%dist .el#{dist}\""
|
41
|
-
end
|
42
|
-
nil
|
43
|
-
end
|
44
|
-
end
|
45
|
-
|
46
38
|
namespace :package do
|
47
39
|
desc "Create srpm from this git repository (unsigned)"
|
48
40
|
task :srpm => :tar do
|
@@ -0,0 +1,127 @@
|
|
1
|
+
##
|
2
|
+
#
|
3
|
+
# A set of functionality for creating yum rpm repositories throughout the
|
4
|
+
# standard pkg/ directory layout that the packaging repo creates. The standard
|
5
|
+
# layout is:
|
6
|
+
# pkg/{el,fedora}/{5,6,f16,f17,f18}/{products,devel,dependencies,extras}/{i386,x86_64,SRPMS}
|
7
|
+
#
|
8
|
+
# Because we'll likely be creating the repos on a server that is remote, e.g.
|
9
|
+
# the distribution server, the logic here assumes we'll be doing everything via
|
10
|
+
# ssh commands.
|
11
|
+
#
|
12
|
+
namespace :pl do
|
13
|
+
namespace :jenkins do
|
14
|
+
desc "Create yum repositories of built RPM packages for this SHA on the distribution server"
|
15
|
+
task :rpm_repos => "pl:fetch" do
|
16
|
+
# Formulate our command string, which will just find directories with rpms
|
17
|
+
# and create and update repositories.
|
18
|
+
#
|
19
|
+
artifact_directory = File.join(@build.jenkins_repo_path, @build.project, @build.ref)
|
20
|
+
|
21
|
+
##
|
22
|
+
# Test that the artifacts directory exists on the distribution server.
|
23
|
+
# This will give us some more helpful output.
|
24
|
+
#
|
25
|
+
cmd = 'echo "Checking for build artifacts. Will exit if not found." ; '
|
26
|
+
cmd << "[ -d #{artifact_directory}/artifacts ] || exit 0 ; "
|
27
|
+
|
28
|
+
##
|
29
|
+
# Enter the directory containing the build artifacts and create repos.
|
30
|
+
#
|
31
|
+
cmd << "pushd #{artifact_directory} ; "
|
32
|
+
cmd << 'echo "Checking for running repo creation. Will wait if detected." ; '
|
33
|
+
cmd << "while [ -f .lock ] ; do sleep 1 ; echo -n '.' ; done ; "
|
34
|
+
cmd << 'echo "Setting lock" ; '
|
35
|
+
cmd << "touch .lock ; "
|
36
|
+
cmd << "rsync -avxl artifacts/ repos/ ; pushd repos ; "
|
37
|
+
cmd << "createrepo=$(which createrepo) ; "
|
38
|
+
cmd << 'for repodir in $(find ./ -name "*.rpm" | xargs -I {} dirname {}) ; do '
|
39
|
+
cmd << "pushd $repodir && $createrepo -d --update . && popd ; "
|
40
|
+
cmd << "done ; popd "
|
41
|
+
|
42
|
+
remote_ssh_cmd(@build.distribution_server, cmd)
|
43
|
+
|
44
|
+
# Always remove the lock file, even if we've failed
|
45
|
+
remote_ssh_cmd(@build.distribution_server, "rm -f #{artifact_directory}/.lock")
|
46
|
+
|
47
|
+
# Now that we've created our repositories, we can create the configs for
|
48
|
+
# them
|
49
|
+
Rake::Task["pl:jenkins:rpm_repo_configs"].invoke
|
50
|
+
end
|
51
|
+
|
52
|
+
# Generate yum configuration files that point to the repositories created
|
53
|
+
# on the distribution server with packages created from the current source
|
54
|
+
# repo commit. There is one for each dist/version that is packaged (e.g.
|
55
|
+
# el5, el6, etc). Files are created in pkg/repo_configs/rpm and are named
|
56
|
+
# pl-$project-$sha.conf, and can be placed in /etc/yum.repos.d to enable
|
57
|
+
# clients to install these packages.
|
58
|
+
#
|
59
|
+
desc "Create yum repository configs for package repos for this sha/tag on the distribution server"
|
60
|
+
task :rpm_repo_configs => "pl:fetch" do
|
61
|
+
|
62
|
+
# This is the standard path to all build artifacts on the distribution
|
63
|
+
# server for this commit
|
64
|
+
#
|
65
|
+
artifact_directory = File.join(@build.jenkins_repo_path, @build.project, @build.ref)
|
66
|
+
# First check if the artifacts directory exists
|
67
|
+
#
|
68
|
+
cmd = "[ -d #{artifact_directory} ] || exit 0 ; "
|
69
|
+
# Descend into the artifacts directory and test if we have any repos
|
70
|
+
#
|
71
|
+
cmd << "pushd #{artifact_directory} ; "
|
72
|
+
cmd << 'echo "Checking if rpm repos exists, will exit if not.." ; '
|
73
|
+
cmd << '[ -n "$(find repos -name "*.rpm")" ] || exit 0 ; '
|
74
|
+
cmd << "pushd repos ; "
|
75
|
+
|
76
|
+
cmd << 'for repo in $(find -name "repodata") ; do dirname $repo >> rpm_configs ; done'
|
77
|
+
|
78
|
+
remote_ssh_cmd(@build.distribution_server, cmd)
|
79
|
+
|
80
|
+
# There's a chance there were simply no rpms to make repos for. If so, we
|
81
|
+
# don't want to proceed.
|
82
|
+
%x{ssh -t #{@build.distribution_server} 'ls #{artifact_directory}/repos/rpm_configs'}
|
83
|
+
unless $?.success?
|
84
|
+
warn "No repos were found to generate configs from. Exiting.."
|
85
|
+
exit 0
|
86
|
+
end
|
87
|
+
mkdir_p "pkg"
|
88
|
+
rsync_from("#{artifact_directory}/repos/rpm_configs", @build.distribution_server, "pkg")
|
89
|
+
|
90
|
+
# Clean up the remote configs file
|
91
|
+
remote_ssh_cmd(@build.distribution_server, "rm #{artifact_directory}/repos/rpm_configs")
|
92
|
+
|
93
|
+
if File.exist?(File.join("pkg", "rpm_configs"))
|
94
|
+
mkdir_p File.join("pkg","repo_configs","rpm")
|
95
|
+
|
96
|
+
# Parse the rpm configs file to generate repository configs. Each line in
|
97
|
+
# the rpm_configs file corresponds with a repo directory on the
|
98
|
+
# distribution server.
|
99
|
+
#
|
100
|
+
lines = IO.readlines(File.join("pkg","rpm_configs")).map{ |l| l.chomp }.uniq
|
101
|
+
lines.each do |repo|
|
102
|
+
dist,version,subdir,arch = repo.split('/')[1..4]
|
103
|
+
|
104
|
+
# Skip any paths that don't have everything we're looking for, e.g.
|
105
|
+
# the top-level srpms directory that contains the original srpm from
|
106
|
+
# packaging
|
107
|
+
next if dist.nil? or version.nil? or subdir.nil? or arch.nil?
|
108
|
+
|
109
|
+
# Create an array of lines that will become our yum config
|
110
|
+
#
|
111
|
+
config = ["[pl-#{@build.project}-#{@build.ref}]"]
|
112
|
+
config << ["name=PL Repo for #{@build.project} at commit #{@build.ref}"]
|
113
|
+
config << ["baseurl=http://#{@build.builds_server}/#{@build.project}/#{@build.ref}/repos/#{dist}/#{version}/#{subdir}/#{arch}"]
|
114
|
+
config << ["enabled=1"]
|
115
|
+
config << ["gpgcheck=0"]
|
116
|
+
|
117
|
+
# Write the new config to a file under our repo configs dir
|
118
|
+
#
|
119
|
+
config_file = File.join("pkg", "repo_configs", "rpm", "pl-#{@build.project}-#{@build.ref}-#{dist}-#{version}-#{arch}-#{subdir}.repo")
|
120
|
+
File.open(config_file, 'w') { |f| f.puts config }
|
121
|
+
end
|
122
|
+
rm File.join("pkg","rpm_configs")
|
123
|
+
puts "Wrote yum configuration files for #{@build.project} at #{@build.ref} to pkg/repo_configs/rpm"
|
124
|
+
end
|
125
|
+
end
|
126
|
+
end
|
127
|
+
end
|
@@ -1,93 +1,106 @@
|
|
1
1
|
namespace :pl do
|
2
|
-
desc "Ship mocked rpms to #{@yum_host}"
|
2
|
+
desc "Ship mocked rpms to #{@build.yum_host}"
|
3
3
|
task :ship_rpms do
|
4
|
-
rsync_to('pkg/el', @yum_host, @yum_repo_path)
|
5
|
-
rsync_to('pkg/fedora', @yum_host, @yum_repo_path)
|
4
|
+
rsync_to('pkg/el', @build.yum_host, @build.yum_repo_path)
|
5
|
+
rsync_to('pkg/fedora', @build.yum_host, @build.yum_repo_path)
|
6
6
|
end
|
7
7
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
8
|
+
namespace :remote do
|
9
|
+
# These hacky bits execute a pre-existing rake task on the @build.apt_host
|
10
|
+
# The rake task takes packages in a specific directory and freights them
|
11
|
+
# to various target yum and apt repositories based on their specific type
|
12
|
+
# e.g., final vs devel vs PE vs FOSS packages
|
13
|
+
|
14
|
+
desc "Update remote rpm repodata on #{@build.yum_host}"
|
15
|
+
task :update_yum_repo do
|
16
|
+
STDOUT.puts "Really run remote repo update on #{@build.yum_host}? [y,n]"
|
17
|
+
if ask_yes_or_no
|
18
|
+
remote_ssh_cmd(@build.yum_host, '/var/lib/gems/1.8/gems/rake-0.9.2.2/bin/rake -f /opt/repository/Rakefile mk_repo')
|
19
|
+
end
|
13
20
|
end
|
14
|
-
end
|
15
21
|
|
16
|
-
|
17
|
-
|
18
|
-
|
22
|
+
desc "remote freight packages to repos on #{@build.apt_host}"
|
23
|
+
task :freight do
|
24
|
+
STDOUT.puts "Really run remote freight command on #{@build.apt_host}? [y,n]"
|
25
|
+
if ask_yes_or_no
|
26
|
+
override = "OVERRIDE=1" if ENV['OVERRIDE']
|
27
|
+
remote_ssh_cmd(@build.apt_host, "/var/lib/gems/1.8/gems/rake-0.9.2.2/bin/rake -f /opt/repository/Rakefile freight #{override}")
|
28
|
+
end
|
29
|
+
end
|
19
30
|
end
|
20
31
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
task :remote_freight_devel do
|
25
|
-
STDOUT.puts "Really run remote freight RC command on #{@apt_host}? [y,n]"
|
26
|
-
if ask_yes_or_no
|
27
|
-
override = "OVERRIDE=1" if ENV['OVERRIDE']
|
28
|
-
# assume we're building in cows when we ship, since that's what the repo supports
|
29
|
-
# allow OVERRIDE as well for cases where we intend to ship final-style versions to devel repos and vice versa
|
30
|
-
remote_ssh_cmd(@apt_host, "/var/lib/gems/1.8/gems/rake-0.9.2.2/bin/rake -f /opt/repository/Rakefile devel COW=1 #{override}")
|
31
|
-
end
|
32
|
+
desc "Ship cow-built debs to #{@build.apt_host}"
|
33
|
+
task :ship_debs do
|
34
|
+
rsync_to('pkg/deb/', @build.apt_host, @build.apt_repo_path)
|
32
35
|
end
|
33
36
|
|
34
|
-
|
35
|
-
# with a different argument
|
36
|
-
desc "remote freight final packages to PRODUCTION repos on #{@apt_host}"
|
37
|
-
task :remote_freight_final do
|
38
|
-
STDOUT.puts "Really run remote freight final command on #{@apt_host}? [y,n]"
|
39
|
-
if ask_yes_or_no
|
40
|
-
override = "OVERRIDE=1" if ENV['OVERRIDE']
|
41
|
-
remote_ssh_cmd(@apt_host, "/var/lib/gems/1.8/gems/rake-0.9.2.2/bin/rake -f /opt/repository/Rakefile community COW=1 #{override}")
|
42
|
-
end
|
37
|
+
namespace :remote do
|
43
38
|
end
|
44
39
|
|
45
|
-
desc "Update remote ips repository on #{@ips_host}"
|
40
|
+
desc "Update remote ips repository on #{@build.ips_host}"
|
46
41
|
task :update_ips_repo do
|
47
|
-
rsync_to('pkg/ips/pkgs/', @ips_host, @ips_store)
|
48
|
-
remote_ssh_cmd(@ips_host, "pkgrecv -s #{@ips_store}/pkgs/#{@
|
49
|
-
remote_ssh_cmd(@ips_host, "pkgrepo refresh -s #{@ips_repo}")
|
50
|
-
remote_ssh_cmd(@ips_host, "/usr/sbin/svcadm restart svc:/application/pkg/server")
|
51
|
-
end if @build_ips
|
42
|
+
rsync_to('pkg/ips/pkgs/', @build.ips_host, @build.ips_store)
|
43
|
+
remote_ssh_cmd(@build.ips_host, "pkgrecv -s #{@build.ips_store}/pkgs/#{@build.project}@build.#{@build.ipsversion}.p5p -d #{@build.ips_repo} \\*")
|
44
|
+
remote_ssh_cmd(@build.ips_host, "pkgrepo refresh -s #{@build.ips_repo}")
|
45
|
+
remote_ssh_cmd(@build.ips_host, "/usr/sbin/svcadm restart svc:/application/pkg/server")
|
46
|
+
end if @build.build_ips
|
52
47
|
|
53
|
-
if File.exist?("#{ENV['HOME']}/.packaging
|
48
|
+
if File.exist?("#{ENV['HOME']}/.packaging")
|
54
49
|
desc "Upload ips p5p packages to downloads"
|
55
|
-
task :ship_ips =>
|
50
|
+
task :ship_ips => 'pl:fetch' do
|
56
51
|
if Dir['pkg/ips/pkgs/**/*'].empty?
|
57
52
|
STDOUT.puts "There aren't any p5p packages in pkg/ips/pkgs. Maybe something went wrong?"
|
58
53
|
else
|
59
|
-
rsync_to('pkg/ips/pkgs/', @ips_package_host, @ips_path)
|
54
|
+
rsync_to('pkg/ips/pkgs/', @build.ips_package_host, @build.ips_path)
|
60
55
|
end
|
61
|
-
end if @build_ips
|
56
|
+
end if @build.build_ips
|
62
57
|
end
|
63
58
|
|
64
59
|
desc "Ship built gem to rubygems"
|
65
60
|
task :ship_gem do
|
66
|
-
ship_gem("pkg/#{@
|
67
|
-
end if @build_gem
|
61
|
+
ship_gem("pkg/#{@build.project}-#{@build.gemversion}.gem")
|
62
|
+
end if @build.build_gem
|
68
63
|
|
69
|
-
if File.exist?("#{ENV['HOME']}/.packaging
|
70
|
-
desc "ship apple dmg to #{@yum_host}"
|
71
|
-
task :ship_dmg =>
|
72
|
-
rsync_to('pkg/apple/*.dmg', @yum_host, @dmg_path)
|
73
|
-
end if @build_dmg
|
64
|
+
if File.exist?("#{ENV['HOME']}/.packaging")
|
65
|
+
desc "ship apple dmg to #{@build.yum_host}"
|
66
|
+
task :ship_dmg => 'pl:fetch' do
|
67
|
+
rsync_to('pkg/apple/*.dmg', @build.yum_host, @build.dmg_path)
|
68
|
+
end if @build.build_dmg
|
74
69
|
|
75
|
-
desc "ship tarball and signature to #{@yum_host}"
|
76
|
-
task :ship_tar =>
|
77
|
-
rsync_to("pkg/#{@
|
70
|
+
desc "ship tarball and signature to #{@build.yum_host}"
|
71
|
+
task :ship_tar => 'pl:fetch' do
|
72
|
+
rsync_to("pkg/#{@build.project}-#{@build.version}.tar.gz*", @build.yum_host, @build.tarball_path)
|
78
73
|
end
|
79
74
|
|
80
75
|
desc "UBER ship: ship all the things in pkg"
|
81
|
-
task :uber_ship =>
|
76
|
+
task :uber_ship => 'pl:fetch' do
|
82
77
|
if confirm_ship(FileList["pkg/**/*"])
|
83
78
|
ENV['ANSWER_OVERRIDE'] = 'yes'
|
84
|
-
Rake::Task["pl:ship_gem"].invoke if @build_gem
|
79
|
+
Rake::Task["pl:ship_gem"].invoke if @build.build_gem
|
85
80
|
Rake::Task["pl:ship_rpms"].invoke
|
86
81
|
Rake::Task["pl:ship_debs"].invoke
|
87
|
-
Rake::Task["pl:ship_dmg"].execute if @build_dmg
|
82
|
+
Rake::Task["pl:ship_dmg"].execute if @build.build_dmg
|
88
83
|
Rake::Task["pl:ship_tar"].execute
|
84
|
+
Rake::Task["pl:jenkins:ship"].invoke("shipped")
|
89
85
|
end
|
90
86
|
end
|
91
87
|
end
|
88
|
+
|
89
|
+
# It is odd to namespace this ship task under :jenkins, but this task is
|
90
|
+
# intended to be a component of the jenkins-based build workflow even if it
|
91
|
+
# doesn't interact with jenkins directly. The :target argument is so that we
|
92
|
+
# can invoke this task with a subdirectory of the standard distribution
|
93
|
+
# server path. That way we can separate out built artifacts from
|
94
|
+
# signed/actually shipped artifacts e.g. $path/shipped/ or $path/artifacts.
|
95
|
+
namespace :jenkins do
|
96
|
+
desc "Ship pkg directory contents to distribution server"
|
97
|
+
task :ship, :target do |t, args|
|
98
|
+
invoke_task("pl:fetch")
|
99
|
+
target = args.target || "artifacts"
|
100
|
+
artifact_dir = "#{@build.jenkins_repo_path}/#{@build.project}/#{@build.ref}/#{target}"
|
101
|
+
remote_ssh_cmd(@build.distribution_server, "mkdir -p #{artifact_dir}")
|
102
|
+
rsync_to("pkg/", @build.distribution_server, "#{artifact_dir}/ --exclude repo_configs")
|
103
|
+
end
|
104
|
+
end
|
92
105
|
end
|
93
106
|
|
@@ -1,18 +1,23 @@
|
|
1
1
|
def sign_el5(rpm)
|
2
|
-
|
2
|
+
# Try this up to 5 times, to allow for incorrect passwords
|
3
|
+
retry_on_fail(:times => 5) do
|
4
|
+
sh "rpm --define '%_gpg_name #{@build.gpg_name}' --define '%__gpg_sign_cmd %{__gpg} gpg --force-v3-sigs --digest-algo=sha1 --batch --no-verbose --no-armor --passphrase-fd 3 --no-secmem-warning -u %{_gpg_name} -sbo %{__signature_filename} %{__plaintext_filename}' --addsign #{rpm} > /dev/null"
|
5
|
+
end
|
3
6
|
end
|
4
7
|
|
5
8
|
def sign_modern(rpm)
|
6
|
-
|
9
|
+
retry_on_fail(:times => 5) do
|
10
|
+
sh "rpm --define '%_gpg_name #{@build.gpg_name}' --addsign #{rpm} > /dev/null"
|
11
|
+
end
|
7
12
|
end
|
8
13
|
|
9
14
|
def rpm_has_sig(rpm)
|
10
|
-
%x{rpm -Kv #{rpm} | grep "#{@gpg_key.downcase}" &> /dev/null}
|
15
|
+
%x{rpm -Kv #{rpm} | grep "#{@build.gpg_key.downcase}" &> /dev/null}
|
11
16
|
$?.success?
|
12
17
|
end
|
13
18
|
|
14
19
|
def sign_deb_changes(file)
|
15
|
-
%x{debsign --re-sign -k#{@gpg_key} #{file}}
|
20
|
+
%x{debsign --re-sign -k#{@build.gpg_key} #{file}}
|
16
21
|
end
|
17
22
|
|
18
23
|
# requires atleast a self signed prvate key and certificate pair
|
@@ -21,18 +26,18 @@ end
|
|
21
26
|
# technically this can be any ips-compliant package identifier, e.g. application/facter
|
22
27
|
# repo_uri is the path to the repo currently containing the package
|
23
28
|
def sign_ips(fmri, repo_uri)
|
24
|
-
%x{pkgsign -s #{repo_uri} -k #{@privatekey_pem} -c #{@certificate_pem} -i #{@ips_inter_cert} #{fmri}}
|
29
|
+
%x{pkgsign -s #{repo_uri} -k #{@build.privatekey_pem} -c #{@build.certificate_pem} -i #{@build.ips_inter_cert} #{fmri}}
|
25
30
|
end
|
26
31
|
|
27
32
|
namespace :pl do
|
28
33
|
desc "Sign the tarball, defaults to PL key, pass GPG_KEY to override or edit build_defaults"
|
29
34
|
task :sign_tar do
|
30
|
-
|
35
|
+
if File.exist? "pkg/#{@build.project}-#{@build.version}.tar.gz"
|
36
|
+
load_keychain if has_tool('keychain')
|
37
|
+
gpg_sign_file "pkg/#{@build.project}-#{@build.version}.tar.gz"
|
38
|
+
else
|
31
39
|
STDERR.puts "No tarball exists. Try rake package:tar?"
|
32
|
-
exit 1
|
33
40
|
end
|
34
|
-
load_keychain if has_tool('keychain')
|
35
|
-
gpg_sign_file "pkg/#{@name}-#{@version}.tar.gz"
|
36
41
|
end
|
37
42
|
|
38
43
|
desc "Sign mocked rpms, Defaults to PL Key, pass KEY to override"
|
@@ -56,7 +61,7 @@ namespace :pl do
|
|
56
61
|
fmri = args.fmri
|
57
62
|
puts "Signing ips packages..."
|
58
63
|
sign_ips(fmri, repo_uri)
|
59
|
-
end if @build_ips
|
64
|
+
end if @build.build_ips
|
60
65
|
|
61
66
|
desc "Check if all rpms are signed"
|
62
67
|
task :check_rpm_sigs do
|
@@ -81,5 +86,28 @@ namespace :pl do
|
|
81
86
|
sign_deb_changes("pkg/deb/*/*.changes") unless Dir["pkg/deb/*/*.changes"].empty?
|
82
87
|
sign_deb_changes("pkg/deb/*.changes") unless Dir["pkg/deb/*.changes"].empty?
|
83
88
|
end
|
89
|
+
|
90
|
+
##
|
91
|
+
# This crazy piece of work establishes a remote repo on the distribution
|
92
|
+
# server, ships our packages out to it, signs them, and brings them back.
|
93
|
+
#
|
94
|
+
namespace :jenkins do
|
95
|
+
desc "Sign all locally staged packages on #{@build.distribution_server}"
|
96
|
+
task :sign_all => "pl:fetch" do
|
97
|
+
if Dir["pkg/*"].empty?
|
98
|
+
warn "There were files found in pkg/. Maybe you wanted to build/retrieve something first?"
|
99
|
+
exit 1
|
100
|
+
end
|
101
|
+
sign_tasks = ["pl:sign_tar", "pl:sign_rpms", "pl:sign_deb_changes"]
|
102
|
+
remote_repo = remote_bootstrap(@build.distribution_server, 'HEAD')
|
103
|
+
build_params = remote_buildparams(@build.distribution_server, @build)
|
104
|
+
rsync_to('pkg', @build.distribution_server, remote_repo)
|
105
|
+
remote_ssh_cmd(@build.distribution_server, "cd #{remote_repo} ; rake #{sign_tasks.join(' ')} PARAMS_FILE=#{build_params}")
|
106
|
+
rsync_from("#{remote_repo}/pkg/", @build.distribution_server, "pkg/")
|
107
|
+
remote_ssh_cmd(@build.distribution_server, "rm -rf #{remote_repo}")
|
108
|
+
remote_ssh_cmd(@build.distribution_server, "rm #{build_params}")
|
109
|
+
puts "Signed packages staged in 'pkg/ directory"
|
110
|
+
end
|
111
|
+
end
|
84
112
|
end
|
85
113
|
|