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,183 @@
|
|
1
|
+
module Build
|
2
|
+
##
|
3
|
+
# This class is meant to encapsulate all of the data we know about a build invoked with
|
4
|
+
# `rake package:<build>` or `rake pl:<build>`. It can read in this data via a yaml file,
|
5
|
+
# have it set via accessors, and serialize it back to yaml for easy transport.
|
6
|
+
#
|
7
|
+
class BuildInstance
|
8
|
+
@@build_params = [:apt_host,
|
9
|
+
:apt_repo_path,
|
10
|
+
:apt_repo_url,
|
11
|
+
:author,
|
12
|
+
:benchmark,
|
13
|
+
:build_defaults,
|
14
|
+
:build_dmg,
|
15
|
+
:build_doc,
|
16
|
+
:build_gem,
|
17
|
+
:build_ips,
|
18
|
+
:build_pe,
|
19
|
+
:builder_data_file,
|
20
|
+
:builds_server,
|
21
|
+
:certificate_pem,
|
22
|
+
:cows,
|
23
|
+
:db_table,
|
24
|
+
:deb_build_host,
|
25
|
+
:debversion,
|
26
|
+
:debug,
|
27
|
+
:default_cow,
|
28
|
+
:default_mock,
|
29
|
+
:description,
|
30
|
+
:distribution_server,
|
31
|
+
:dmg_path,
|
32
|
+
:email,
|
33
|
+
:files,
|
34
|
+
:final_mocks,
|
35
|
+
:freight_conf,
|
36
|
+
:gem_default_executables,
|
37
|
+
:gem_dependencies,
|
38
|
+
:gem_description,
|
39
|
+
:gem_devel_dependencies,
|
40
|
+
:gem_excludes,
|
41
|
+
:gem_executables,
|
42
|
+
:gem_files,
|
43
|
+
:gem_forge_project,
|
44
|
+
:gem_name,
|
45
|
+
:gem_rdoc_options,
|
46
|
+
:gem_require_path,
|
47
|
+
:gem_runtime_dependencies,
|
48
|
+
:gem_summary,
|
49
|
+
:gem_test_files,
|
50
|
+
:gemversion,
|
51
|
+
:gpg_key,
|
52
|
+
:gpg_name,
|
53
|
+
:homepage,
|
54
|
+
:ips_build_host,
|
55
|
+
:ips_host,
|
56
|
+
:ips_inter_cert,
|
57
|
+
:ips_package_host,
|
58
|
+
:ips_path,
|
59
|
+
:ips_repo,
|
60
|
+
:ips_store,
|
61
|
+
:ipsversion,
|
62
|
+
:jenkins_build_host,
|
63
|
+
:jenkins_packaging_job,
|
64
|
+
:jenkins_repo_path,
|
65
|
+
:metrics,
|
66
|
+
:name,
|
67
|
+
:project,
|
68
|
+
:origversion,
|
69
|
+
:osx_build_host,
|
70
|
+
:packager,
|
71
|
+
:packaging_repo,
|
72
|
+
:packaging_url,
|
73
|
+
:pbuild_conf,
|
74
|
+
:pe_name,
|
75
|
+
:pe_version,
|
76
|
+
:pg_major_version,
|
77
|
+
:privatekey_pem,
|
78
|
+
:random_mockroot,
|
79
|
+
:rc_mocks,
|
80
|
+
:release,
|
81
|
+
:rpm_build_host,
|
82
|
+
:rpmrelease,
|
83
|
+
:rpmversion,
|
84
|
+
:ref,
|
85
|
+
:sign_tar,
|
86
|
+
:sles_build_host,
|
87
|
+
:sles_repo_path,
|
88
|
+
:sles_repo_host,
|
89
|
+
:sles_arch_repos,
|
90
|
+
:summary,
|
91
|
+
:tar_excludes,
|
92
|
+
:tarball_path,
|
93
|
+
:task,
|
94
|
+
:team,
|
95
|
+
:version,
|
96
|
+
:version_file,
|
97
|
+
:yum_host,
|
98
|
+
:yum_repo_path]
|
99
|
+
|
100
|
+
@@build_params.each do |v|
|
101
|
+
attr_accessor v
|
102
|
+
end
|
103
|
+
|
104
|
+
def initialize
|
105
|
+
@task = { :task => $*[0], :args => $*[1..-1] }
|
106
|
+
@ref = git_sha_or_tag
|
107
|
+
end
|
108
|
+
|
109
|
+
##
|
110
|
+
# Take a hash of parameters, and iterate over them,
|
111
|
+
# setting each build param to the corresponding hash key,value.
|
112
|
+
#
|
113
|
+
def set_params_from_hash(data = {})
|
114
|
+
data.each do |param, value|
|
115
|
+
if @@build_params.include?(param.to_sym)
|
116
|
+
self.instance_variable_set("@#{param}", value)
|
117
|
+
else
|
118
|
+
warn "Warning - No build data parameter found for '#{param}'. Perhaps you have an erroneous entry in your yaml file?"
|
119
|
+
end
|
120
|
+
end
|
121
|
+
end
|
122
|
+
|
123
|
+
##
|
124
|
+
# Load build parameters from a yaml file. Uses #data_from_yaml in
|
125
|
+
# 00_utils.rake
|
126
|
+
#
|
127
|
+
def set_params_from_file(file)
|
128
|
+
build_data = data_from_yaml(file)
|
129
|
+
set_params_from_hash(build_data)
|
130
|
+
end
|
131
|
+
|
132
|
+
##
|
133
|
+
# Return a hash of all build parameters and their values, nil if unassigned.
|
134
|
+
#
|
135
|
+
def params
|
136
|
+
data = {}
|
137
|
+
@@build_params.each do |param|
|
138
|
+
data.store(param, self.instance_variable_get("@#{param}"))
|
139
|
+
end
|
140
|
+
data
|
141
|
+
end
|
142
|
+
|
143
|
+
##
|
144
|
+
# Write all build parameters to a yaml file in a temporary location. Print
|
145
|
+
# the path to the file and return it as a string. Accept an argument for
|
146
|
+
# the write target directory. The name of the params file is the current
|
147
|
+
# git commit sha or tag.
|
148
|
+
#
|
149
|
+
def params_to_yaml(output_dir=nil)
|
150
|
+
dir = output_dir.nil? ? get_temp : output_dir
|
151
|
+
unless File.writable?(dir)
|
152
|
+
warn "#{dir} does not exist or is not writable, skipping build params write. Exiting.."
|
153
|
+
exit 1
|
154
|
+
end
|
155
|
+
params_file = File.join(dir, "#{self.ref}.yaml")
|
156
|
+
File.open(params_file, 'w') do |f|
|
157
|
+
f.puts params.to_yaml
|
158
|
+
end
|
159
|
+
puts params_file
|
160
|
+
params_file
|
161
|
+
end
|
162
|
+
|
163
|
+
##
|
164
|
+
# Print the names and values of all the params known to the build object
|
165
|
+
#
|
166
|
+
def print_params
|
167
|
+
params.each { |k,v| puts "#{k}: #{v}" }
|
168
|
+
end
|
169
|
+
end
|
170
|
+
end
|
171
|
+
|
172
|
+
# Perform a build exclusively from a build params file. Requires that the build
|
173
|
+
# params file include a setting for task, which is an array of the arguments
|
174
|
+
# given to rake originally, including, first, the task name. The params file is
|
175
|
+
# always loaded when passed, so these variables are accessible immediately.
|
176
|
+
namespace :pl do
|
177
|
+
desc "Build from a build params file"
|
178
|
+
task :build_from_params do
|
179
|
+
check_var('PARAMS_FILE', ENV['PARAMS_FILE'])
|
180
|
+
git_co(@build.ref)
|
181
|
+
Rake::Task[@build.task[:task]].invoke(@build.task[:args])
|
182
|
+
end
|
183
|
+
end
|
@@ -5,7 +5,7 @@ def pdebuild args
|
|
5
5
|
set_cow_envs(cow)
|
6
6
|
update_cow(cow, devel_repo)
|
7
7
|
begin
|
8
|
-
sh "pdebuild --configfile #{@pbuild_conf} \
|
8
|
+
sh "pdebuild --configfile #{@build.pbuild_conf} \
|
9
9
|
--buildresult #{results_dir} \
|
10
10
|
--pbuilder cowbuilder -- \
|
11
11
|
--basepath /var/cache/pbuilder/#{cow}/"
|
@@ -16,14 +16,11 @@ def pdebuild args
|
|
16
16
|
end
|
17
17
|
|
18
18
|
def update_cow(cow, is_rc = nil)
|
19
|
-
ENV['FOSS_DEVEL'] = is_rc
|
19
|
+
ENV['FOSS_DEVEL'] = is_rc.to_s
|
20
20
|
ENV['PATH'] = "/usr/sbin:#{ENV['PATH']}"
|
21
21
|
set_cow_envs(cow)
|
22
|
-
|
23
|
-
sh "sudo -E /usr/sbin/cowbuilder --update --override-config --configfile #{@pbuild_conf} --basepath /var/cache/pbuilder/#{cow} --distribution #{ENV['DIST']} --architecture #{ENV['ARCH']}"
|
24
|
-
rescue
|
25
|
-
STDERR.puts "Couldn't update the cow #{cow}. Perhaps you don't have sudo?"
|
26
|
-
exit 1
|
22
|
+
retry_on_fail(:times => 3) do
|
23
|
+
sh "sudo -E /usr/sbin/cowbuilder --update --override-config --configfile #{@build.pbuild_conf} --basepath /var/cache/pbuilder/#{cow} --distribution #{ENV['DIST']} --architecture #{ENV['ARCH']}"
|
27
24
|
end
|
28
25
|
end
|
29
26
|
|
@@ -32,40 +29,44 @@ def debuild args
|
|
32
29
|
begin
|
33
30
|
sh "debuild --no-lintian -uc -us"
|
34
31
|
rescue
|
35
|
-
STDERR.puts "Something went wrong. Hopefully the backscroll or #{results_dir}/#{@
|
32
|
+
STDERR.puts "Something went wrong. Hopefully the backscroll or #{results_dir}/#{@build.project}_#{@build.debversion}.build file has a clue."
|
36
33
|
exit 1
|
37
34
|
end
|
38
35
|
end
|
39
36
|
|
40
37
|
task :prep_deb_tars, :work_dir do |t,args|
|
41
38
|
work_dir = args.work_dir
|
42
|
-
cp_p "pkg/#{@
|
39
|
+
cp_p "pkg/#{@build.project}-#{@build.version}.tar.gz", work_dir
|
43
40
|
cd work_dir do
|
44
|
-
sh "tar zxf #{@
|
45
|
-
mv "#{@
|
46
|
-
mv "#{@
|
41
|
+
sh "tar zxf #{@build.project}-#{@build.version}.tar.gz"
|
42
|
+
mv "#{@build.project}-#{@build.version}", "#{@build.project}-#{@build.debversion}"
|
43
|
+
mv "#{@build.project}-#{@build.version}.tar.gz", "#{@build.project}_#{@build.origversion}.orig.tar.gz"
|
47
44
|
end
|
48
45
|
end
|
49
46
|
|
50
47
|
task :build_deb, :deb_command, :cow, :devel do |t,args|
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
48
|
+
bench = Benchmark.realtime do
|
49
|
+
deb_build = args.deb_command
|
50
|
+
cow = args.cow
|
51
|
+
devel = args.devel
|
52
|
+
work_dir = get_temp
|
53
|
+
subdir = 'pe/' if @build.build_pe
|
54
|
+
dest_dir = "#{@build_root}/pkg/#{subdir}deb/#{cow.split('-')[1] unless cow.nil?}"
|
55
|
+
check_tool(deb_build)
|
56
|
+
mkdir_p dest_dir
|
57
|
+
deb_args = { :work_dir => work_dir, :cow => cow, :devel => devel}
|
58
|
+
Rake::Task[:prep_deb_tars].reenable
|
59
|
+
Rake::Task[:prep_deb_tars].invoke(work_dir)
|
60
|
+
cd "#{work_dir}/#{@build.project}-#{@build.debversion}" do
|
61
|
+
mv 'ext/debian', '.'
|
62
|
+
send(deb_build, deb_args)
|
63
|
+
cp FileList["#{work_dir}/*.deb", "#{work_dir}/*.dsc", "#{work_dir}/*.changes", "#{work_dir}/*.debian.tar.gz", "#{work_dir}/*.orig.tar.gz"], dest_dir
|
64
|
+
rm_rf "#{work_dir}/#{@build.project}-#{@build.debversion}"
|
65
|
+
rm_rf work_dir
|
66
|
+
end
|
68
67
|
end
|
68
|
+
# See 30_metrics.rake to see what this is doing
|
69
|
+
add_metrics({ :dist => ENV['DIST'], :bench => bench }) if @build.benchmark
|
69
70
|
end
|
70
71
|
|
71
72
|
namespace :package do
|
@@ -76,33 +77,37 @@ namespace :package do
|
|
76
77
|
end
|
77
78
|
|
78
79
|
namespace :pl do
|
79
|
-
desc "Create a deb from this repo using the default cow #{@default_cow}."
|
80
|
+
desc "Create a deb from this repo using the default cow #{@build.default_cow}."
|
80
81
|
task :deb => "package:tar" do
|
81
|
-
check_var('PE_VER',
|
82
|
-
Rake::Task[:build_deb].invoke('pdebuild', @default_cow)
|
82
|
+
check_var('PE_VER', @build.pe_version) if @build.build_pe
|
83
|
+
Rake::Task[:build_deb].invoke('pdebuild', @build.default_cow, is_rc?)
|
84
|
+
post_metrics if @build.benchmark
|
83
85
|
end
|
84
86
|
|
85
|
-
desc "Create an RC deb from this repo using the default cow #{@default_cow}."
|
86
87
|
task :deb_rc => "package:tar" do
|
87
|
-
|
88
|
+
deprecate("pl:deb_rc", "pl:deb")
|
89
|
+
Rake::Task[:build_deb].invoke('pdebuild', @build.default_cow, 'true')
|
90
|
+
post_metrics if @build.benchmark
|
88
91
|
end
|
89
92
|
|
90
93
|
desc "Create debs from this git repository using all cows specified in build_defaults yaml"
|
91
94
|
task :deb_all do
|
92
|
-
check_var('PE_VER',
|
93
|
-
@cows.split(' ').each do |cow|
|
95
|
+
check_var('PE_VER', @build.pe_version) if @build.build_pe
|
96
|
+
@build.cows.split(' ').each do |cow|
|
94
97
|
Rake::Task["package:tar"].invoke
|
95
98
|
Rake::Task[:build_deb].reenable
|
96
|
-
Rake::Task[:build_deb].invoke('pdebuild', cow)
|
99
|
+
Rake::Task[:build_deb].invoke('pdebuild', cow, is_rc?)
|
97
100
|
end
|
101
|
+
post_metrics if @build.benchmark
|
98
102
|
end
|
99
103
|
|
100
|
-
desc "Create RC debs from this git repository using all cows specified in build_defaults yaml"
|
101
104
|
task :deb_all_rc do
|
102
|
-
|
105
|
+
deprecate("pl:deb_all_rc", "pl:deb_all")
|
106
|
+
@build.cows.split(' ').each do |cow|
|
103
107
|
Rake::Task["package:tar"].invoke
|
104
108
|
Rake::Task[:build_deb].reenable
|
105
|
-
Rake::Task[:build_deb].invoke('pdebuild', cow, '
|
109
|
+
Rake::Task[:build_deb].invoke('pdebuild', cow, 'true')
|
106
110
|
end
|
107
111
|
end
|
112
|
+
post_metrics if @build.benchmark
|
108
113
|
end
|
@@ -0,0 +1,103 @@
|
|
1
|
+
##
|
2
|
+
# Create a debian repository under the standard pkg/ directory layout that the
|
3
|
+
# packaging repo creates. The standard layout is pkg/deb/$distribution/files.
|
4
|
+
# The repository is created in the 'repos' directory under the jenkins build
|
5
|
+
# directories on the distribution server, e.g.
|
6
|
+
# /opt/jenkins-builds/$project/$sha/repos. Because we're creating deb
|
7
|
+
# repositories on the fly, we have to generate the configuration files as well.
|
8
|
+
# We assume every directory under the `deb` directory is named for a
|
9
|
+
# distribution, and we use this in creating our configurations.
|
10
|
+
#
|
11
|
+
namespace :pl do
|
12
|
+
namespace :jenkins do
|
13
|
+
desc "Create apt repositories of build DEB packages for this SHA on the distributions erver"
|
14
|
+
task :deb_repos => "pl:fetch" do
|
15
|
+
|
16
|
+
# First, we test that artifacts exist and set up the repos directory
|
17
|
+
artifact_directory = File.join(@build.jenkins_repo_path, @build.project, @build.ref)
|
18
|
+
|
19
|
+
cmd = 'echo " Checking for deb build artifacts. Will exit if not found.." ; '
|
20
|
+
cmd << "[ -d #{artifact_directory}/artifacts/deb ] || exit 0 ; "
|
21
|
+
# Descend into the deb directory and obtain the list of distributions
|
22
|
+
# we'll be building repos for
|
23
|
+
cmd << "pushd #{artifact_directory}/artifacts/deb && dists=$(ls) && popd; "
|
24
|
+
# We do one more check here to make sure we actually have distributions
|
25
|
+
# to build for. If deb is empty we want to just exit.
|
26
|
+
#
|
27
|
+
cmd << '[ -n "$dists" ] || exit 0 ; '
|
28
|
+
cmd << "pushd #{artifact_directory} ; "
|
29
|
+
|
30
|
+
cmd << 'echo "Checking for running repo creation. Will wait if detected." ; '
|
31
|
+
cmd << "while [ -f .lock ] ; do sleep 1 ; echo -n '.' ; done ; "
|
32
|
+
cmd << 'echo "Setting lock" ; '
|
33
|
+
cmd << "touch .lock ; "
|
34
|
+
cmd << "rsync -avxl artifacts/ repos/ ; pushd repos ; "
|
35
|
+
|
36
|
+
# Make the conf directory and write out our configuration file
|
37
|
+
cmd << "rm -rf apt && mkdir -p apt ; pushd apt ; "
|
38
|
+
cmd << 'for dist in $dists ; do mkdir -p $dist/conf ; pushd $dist ;
|
39
|
+
echo "
|
40
|
+
Origin: Puppet Labs
|
41
|
+
Label: Puppet Labs
|
42
|
+
Codename: $dist
|
43
|
+
Architectures: i386 amd64
|
44
|
+
Components: main
|
45
|
+
Description: Apt repository for acceptance testing" >> conf/distributions ; '
|
46
|
+
|
47
|
+
# Create the repositories using reprepro. Since these are for acceptance
|
48
|
+
# testing only, we'll just add the debs and ignore source files for now.
|
49
|
+
#
|
50
|
+
cmd << "reprepro=$(which reprepro) ; "
|
51
|
+
cmd << "$reprepro includedeb $dist ../../deb/$dist/*.deb ; popd ; done ; "
|
52
|
+
cmd << "popd ; popd "
|
53
|
+
|
54
|
+
remote_ssh_cmd(@build.distribution_server, cmd)
|
55
|
+
|
56
|
+
# Always remove the lock file, even if we've failed
|
57
|
+
remote_ssh_cmd(@build.distribution_server, "rm -f #{artifact_directory}/.lock")
|
58
|
+
|
59
|
+
# Now that we've created our package repositories, we can generate repo
|
60
|
+
# configurations for use with downstream jobs, acceptance clients, etc.
|
61
|
+
Rake::Task["pl:jenkins:deb_repo_configs"].execute
|
62
|
+
end
|
63
|
+
|
64
|
+
# Generate apt configuration files that point to the repositories created
|
65
|
+
# on the distribution server with packages created from the current source
|
66
|
+
# repo commit. There is one for each dist that is packaged for (e.g. lucid,
|
67
|
+
# squeeze, etc). Files are created in pkg/repo_configs/deb and are named
|
68
|
+
# pl-$project-$sha.list, and can be placed in /etc/apt/sources.list.d to
|
69
|
+
# enable clients to install these packages.
|
70
|
+
#
|
71
|
+
desc "Create apt repository configs for package repos for this sha/tag on the distribution server"
|
72
|
+
task :deb_repo_configs => "pl:fetch" do
|
73
|
+
|
74
|
+
# This is the standard path to all build artifacts on the distribution
|
75
|
+
# server for this commit
|
76
|
+
#
|
77
|
+
artifact_directory = File.join(@build.jenkins_repo_path, @build.project, @build.ref)
|
78
|
+
|
79
|
+
# We obtain the list of distributions in the debian repository with some hackery.
|
80
|
+
#
|
81
|
+
%x{ssh -t #{@build.distribution_server} 'ls #{artifact_directory}/repos/apt'}
|
82
|
+
if $?.success?
|
83
|
+
dists = %x{ssh -t #{@build.distribution_server} 'ls #{artifact_directory}/repos/apt'}.split
|
84
|
+
else
|
85
|
+
warn "No repos were found to generate configs from. Exiting.."
|
86
|
+
exit 0
|
87
|
+
end
|
88
|
+
|
89
|
+
# Create apt sources.list files that can be added to hosts for installing
|
90
|
+
# these packages. We use the list of distributions to create a config
|
91
|
+
# file for every distribution.
|
92
|
+
#
|
93
|
+
mkdir_p File.join("pkg", "repo_configs", "deb")
|
94
|
+
dists.each do |dist|
|
95
|
+
repoconfig = ["# Packages for #{@build.project} built from ref #{@build.ref}",
|
96
|
+
"deb http://#{@build.builds_server}/#{@build.project}/#{@build.ref}/repos/apt/#{dist} #{dist} main"]
|
97
|
+
config = File.join("pkg", "repo_configs", "deb", "pl-#{@build.project}-#{@build.ref}-#{dist}.list")
|
98
|
+
File.open(config, 'w') { |f| f.puts repoconfig }
|
99
|
+
end
|
100
|
+
puts "Wrote apt repo configs for #{@build.project} at #{@build.ref} to pkg/repo_configs/deb."
|
101
|
+
end
|
102
|
+
end
|
103
|
+
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# Most projects set rdoc options in the context of gem building. However, mcollective
|
2
|
-
# generates its own rdoc package. We can reuse the @gem_rdoc_options here
|
2
|
+
# generates its own rdoc package. We can reuse the @build.gem_rdoc_options here
|
3
3
|
|
4
|
-
if @build_doc
|
4
|
+
if @build.build_doc
|
5
5
|
begin
|
6
6
|
require 'rdoc/task'
|
7
7
|
rescue LoadError
|
@@ -11,10 +11,10 @@ if @build_doc
|
|
11
11
|
namespace :package do
|
12
12
|
RDoc::Task.new(:doc) do |rdoc|
|
13
13
|
rdoc.rdoc_dir = 'doc'
|
14
|
-
rdoc.title = "#{@
|
15
|
-
@gem_rdoc_options.each do |option|
|
14
|
+
rdoc.title = "#{@build.project} version #{@build.version}"
|
15
|
+
@build.gem_rdoc_options.each do |option|
|
16
16
|
rdoc.options << option
|
17
|
-
end unless @gem_rdoc_options.nil?
|
17
|
+
end unless @build.gem_rdoc_options.nil?
|
18
18
|
end
|
19
19
|
end
|
20
20
|
end
|