packaging 0.99.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/LICENSE +17 -0
- data/README-Solaris.md +117 -0
- data/README.md +1031 -0
- data/lib/packaging.rb +32 -0
- data/lib/packaging/artifactory.rb +278 -0
- data/lib/packaging/config.rb +392 -0
- data/lib/packaging/config/params.rb +366 -0
- data/lib/packaging/deb.rb +28 -0
- data/lib/packaging/deb/repo.rb +263 -0
- data/lib/packaging/gem.rb +112 -0
- data/lib/packaging/ips.rb +57 -0
- data/lib/packaging/msi.rb +89 -0
- data/lib/packaging/nuget.rb +39 -0
- data/lib/packaging/osx.rb +36 -0
- data/lib/packaging/paths.rb +238 -0
- data/lib/packaging/platforms.rb +480 -0
- data/lib/packaging/repo.rb +55 -0
- data/lib/packaging/retrieve.rb +46 -0
- data/lib/packaging/rpm.rb +5 -0
- data/lib/packaging/rpm/repo.rb +257 -0
- data/lib/packaging/tar.rb +154 -0
- data/lib/packaging/util.rb +146 -0
- data/lib/packaging/util/date.rb +15 -0
- data/lib/packaging/util/execution.rb +85 -0
- data/lib/packaging/util/file.rb +125 -0
- data/lib/packaging/util/git.rb +174 -0
- data/lib/packaging/util/git_tags.rb +73 -0
- data/lib/packaging/util/gpg.rb +62 -0
- data/lib/packaging/util/jenkins.rb +95 -0
- data/lib/packaging/util/misc.rb +69 -0
- data/lib/packaging/util/net.rb +368 -0
- data/lib/packaging/util/os.rb +17 -0
- data/lib/packaging/util/platform.rb +40 -0
- data/lib/packaging/util/rake_utils.rb +111 -0
- data/lib/packaging/util/serialization.rb +19 -0
- data/lib/packaging/util/ship.rb +171 -0
- data/lib/packaging/util/tool.rb +41 -0
- data/lib/packaging/util/version.rb +326 -0
- data/spec/fixtures/config/ext/build_defaults.yaml +2 -0
- data/spec/fixtures/config/ext/project_data.yaml +2 -0
- data/spec/fixtures/config/params.yaml +2 -0
- data/spec/fixtures/configs/components/test_file.json +1 -0
- data/spec/fixtures/configs/components/test_file_2.json +0 -0
- data/spec/fixtures/configs/components/test_file_not_tagged.json +1 -0
- data/spec/fixtures/configs/components/test_file_wrong_ext.txt +0 -0
- data/spec/fixtures/configs/components/test_file_wrong_ext.wrong +0 -0
- data/spec/fixtures/util/pre_tasks.yaml +4 -0
- data/spec/lib/packaging/artifactory_spec.rb +171 -0
- data/spec/lib/packaging/config_spec.rb +556 -0
- data/spec/lib/packaging/deb/repo_spec.rb +148 -0
- data/spec/lib/packaging/deb_spec.rb +52 -0
- data/spec/lib/packaging/paths_spec.rb +153 -0
- data/spec/lib/packaging/platforms_spec.rb +153 -0
- data/spec/lib/packaging/repo_spec.rb +97 -0
- data/spec/lib/packaging/retrieve_spec.rb +61 -0
- data/spec/lib/packaging/rpm/repo_spec.rb +133 -0
- data/spec/lib/packaging/tar_spec.rb +122 -0
- data/spec/lib/packaging/util/execution_spec.rb +56 -0
- data/spec/lib/packaging/util/file_spec.rb +139 -0
- data/spec/lib/packaging/util/git_spec.rb +160 -0
- data/spec/lib/packaging/util/git_tag_spec.rb +36 -0
- data/spec/lib/packaging/util/gpg_spec.rb +64 -0
- data/spec/lib/packaging/util/jenkins_spec.rb +112 -0
- data/spec/lib/packaging/util/misc_spec.rb +31 -0
- data/spec/lib/packaging/util/net_spec.rb +239 -0
- data/spec/lib/packaging/util/os_spec.rb +31 -0
- data/spec/lib/packaging/util/rake_utils_spec.rb +70 -0
- data/spec/lib/packaging/util/ship_spec.rb +117 -0
- data/spec/lib/packaging/util/version_spec.rb +123 -0
- data/spec/lib/packaging_spec.rb +19 -0
- data/spec/spec_helper.rb +36 -0
- data/static_artifacts/PackageInfo.plist +3 -0
- data/tasks/00_utils.rake +216 -0
- data/tasks/30_metrics.rake +33 -0
- data/tasks/apple.rake +266 -0
- data/tasks/build.rake +12 -0
- data/tasks/clean.rake +5 -0
- data/tasks/config.rake +30 -0
- data/tasks/deb.rake +129 -0
- data/tasks/deb_repos.rake +28 -0
- data/tasks/deprecated.rake +130 -0
- data/tasks/doc.rake +20 -0
- data/tasks/education.rake +57 -0
- data/tasks/fetch.rake +57 -0
- data/tasks/gem.rake +146 -0
- data/tasks/jenkins.rake +494 -0
- data/tasks/jenkins_dynamic.rake +202 -0
- data/tasks/load_extras.rake +21 -0
- data/tasks/mock.rake +348 -0
- data/tasks/nightly_repos.rake +335 -0
- data/tasks/pe_deb.rake +12 -0
- data/tasks/pe_rpm.rake +13 -0
- data/tasks/pe_ship.rake +221 -0
- data/tasks/pe_sign.rake +13 -0
- data/tasks/pe_tar.rake +5 -0
- data/tasks/retrieve.rake +45 -0
- data/tasks/rpm.rake +66 -0
- data/tasks/rpm_repos.rake +29 -0
- data/tasks/ship.rake +752 -0
- data/tasks/sign.rake +226 -0
- data/tasks/tag.rake +8 -0
- data/tasks/tar.rake +34 -0
- data/tasks/update.rake +16 -0
- data/tasks/vanagon.rake +35 -0
- data/tasks/vendor_gems.rake +117 -0
- data/tasks/version.rake +33 -0
- data/tasks/z_data_dump.rake +65 -0
- data/templates/README +1 -0
- data/templates/downstream.xml.erb +47 -0
- data/templates/msi.xml.erb +197 -0
- data/templates/packaging.xml.erb +344 -0
- data/templates/repo.xml.erb +114 -0
- metadata +234 -0
@@ -0,0 +1,65 @@
|
|
1
|
+
##
|
2
|
+
# These tasks are just wrappers for the build objects capabilities, exposed
|
3
|
+
# for our debugging purposes. This file is prepended with `z_` to ensure it is
|
4
|
+
# loaded last, so that any variable manipulations that occur in the rake tasks
|
5
|
+
# happen prior to printing (although ideally all variables have been set after
|
6
|
+
# loading `20_setupextrasvars.rake`).
|
7
|
+
#
|
8
|
+
namespace :pl do
|
9
|
+
##
|
10
|
+
# Utility rake task that will dump all current build parameters and variables
|
11
|
+
# to a yaml file to a temporary location and print the path. Given the
|
12
|
+
# environment variable 'OUTPUT_DIR', output file at 'OUTPUT_DIR'. The
|
13
|
+
# environment variable TASK sets the task instance variable of the build to the
|
14
|
+
# supplied args, allowing us to use this file for later builds.
|
15
|
+
#
|
16
|
+
desc "Write all package build parameters to a yaml file, pass OUTPUT_DIR to specify outut location"
|
17
|
+
task :write_build_params do
|
18
|
+
if ENV['TASK']
|
19
|
+
task_args = ENV['TASK'].split(' ')
|
20
|
+
Pkg::Config.task = { :task => task_args[0], :args => task_args[1..-1] }
|
21
|
+
end
|
22
|
+
Pkg::Config.config_to_yaml(ENV['OUTPUT_DIR'])
|
23
|
+
end
|
24
|
+
|
25
|
+
##
|
26
|
+
# Print all build parameters to $stdout.
|
27
|
+
#
|
28
|
+
desc "Print all package build parameters"
|
29
|
+
task :print_build_params do
|
30
|
+
Pkg::Config.print_config
|
31
|
+
end
|
32
|
+
|
33
|
+
##
|
34
|
+
# Print a parameter passed as an argument to $stdout.
|
35
|
+
desc "Print a build parameter"
|
36
|
+
task :print_build_param, :param do |t, args|
|
37
|
+
# We want a string that is the from "@<param name>"
|
38
|
+
if param = args.param
|
39
|
+
getter = param.dup
|
40
|
+
if param[0] == ':'
|
41
|
+
getter = param[1..-1]
|
42
|
+
param[0] = "@"
|
43
|
+
elsif param[0] == "@"
|
44
|
+
getter = param[1..-1]
|
45
|
+
else
|
46
|
+
param.insert(0, "@")
|
47
|
+
end
|
48
|
+
|
49
|
+
# We want to fail if the param passed is bogus, print 'nil' if its not
|
50
|
+
# set, and print the value if its set.
|
51
|
+
if Pkg::Config.respond_to?(getter)
|
52
|
+
if val = Pkg::Config.instance_variable_get(param)
|
53
|
+
puts val
|
54
|
+
else
|
55
|
+
puts 'nil'
|
56
|
+
end
|
57
|
+
else
|
58
|
+
fail "Could not locate a build parameter called #{param}. For a list of available parameters, do `rake pl:print_build_params`"
|
59
|
+
end
|
60
|
+
else
|
61
|
+
fail "To print a build parameter, pass the param name as a rake argument. Ex: rake pl:print_build_param[:version]"
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
data/templates/README
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
Add erb templates to this directory that packaging repo uses
|
@@ -0,0 +1,47 @@
|
|
1
|
+
<?xml version='1.0' encoding='UTF-8'?>
|
2
|
+
<project>
|
3
|
+
<actions/>
|
4
|
+
<description><p>
|
5
|
+
When DOWNSTREAM_JOB is passed to the packaging repo, this job is created to wrap the call to that job.
|
6
|
+
This allows us to use jenkins' upstream/downstream chaining facilities while retaining the ability to trigger jobs on other jenkins hosts
|
7
|
+
</p></description>
|
8
|
+
<keepDependencies>false</keepDependencies>
|
9
|
+
<properties>
|
10
|
+
<jenkins.plugins.hipchat.HipChatNotifier_-HipChatJobProperty plugin="hipchat-plugin@0.1.0">
|
11
|
+
<room></room>
|
12
|
+
<startNotification>false</startNotification>
|
13
|
+
</jenkins.plugins.hipchat.HipChatNotifier_-HipChatJobProperty>
|
14
|
+
</properties>
|
15
|
+
<scm class="hudson.scm.NullSCM"/>
|
16
|
+
<assignedNode>downstream</assignedNode>
|
17
|
+
<canRoam>false</canRoam>
|
18
|
+
<disabled>false</disabled>
|
19
|
+
<blockBuildWhenDownstreamBuilding>false</blockBuildWhenDownstreamBuilding>
|
20
|
+
<blockBuildWhenUpstreamBuilding>false</blockBuildWhenUpstreamBuilding>
|
21
|
+
<triggers class="vector"/>
|
22
|
+
<concurrentBuild>false</concurrentBuild>
|
23
|
+
<builders>
|
24
|
+
<hudson.tasks.Shell>
|
25
|
+
<command>#!/bin/bash
|
26
|
+
## We have to check if this has been triggered by a successful package and repo build
|
27
|
+
curl -s "http://<%= "#{Pkg::Config.jenkins_build_host}" %>/job/<%= "#{Pkg::Config.project}-repo-#{Pkg::Config.build_date}-#{Pkg::Config.ref}" %>/lastBuild/api/json" | grep result\":\"SUCCESS\" > /dev/null
|
28
|
+
|
29
|
+
UPSTREAM_BUILD_STATUS=$?
|
30
|
+
|
31
|
+
set -e
|
32
|
+
|
33
|
+
if [ $UPSTREAM_BUILD_STATUS -eq 0 ] ; then
|
34
|
+
UPSTREAM_BUILD_STATUS="success"
|
35
|
+
else
|
36
|
+
UPSTREAM_BUILD_STATUS="failure"
|
37
|
+
fi
|
38
|
+
|
39
|
+
# This URI was passed in as an argument to the original rake package call
|
40
|
+
curl -v --fail -i "<%= Pkg::Util::Net.escape_html(Pkg::Util::Net.add_param_to_uri(add_param_to_uri(ENV['DOWNSTREAM_JOB'], "PACKAGE_BUILD_STATUS=$UPSTREAM_BUILD_STATUS"), "PACKAGE_BUILD_URL=#{ENV["PACKAGE_BUILD_URL"]}")) %>"</command>
|
41
|
+
</hudson.tasks.Shell>
|
42
|
+
</builders>
|
43
|
+
<publishers/>
|
44
|
+
<buildWrappers>
|
45
|
+
<hudson.plugins.timestamper.TimestamperBuildWrapper plugin="timestamper@1.8.4"/>
|
46
|
+
</buildWrappers>
|
47
|
+
</project>
|
@@ -0,0 +1,197 @@
|
|
1
|
+
<?xml version='1.0' encoding='UTF-8'?>
|
2
|
+
<matrix-project>
|
3
|
+
<actions/>
|
4
|
+
<description><p>
|
5
|
+
Dynamically created job to generate the MSI for this version of Puppet
|
6
|
+

|
7
|
+
The artifacts are sent out to builds.delivery.puppetlabs.net
|
8
|
+
<p>
|
9
|
+
This job will trigger the downstream job supplied with DOWNSTREAM_JOB if passed to rake in the upstream invocation.
|
10
|
+
</p>
|
11
|
+
</description>
|
12
|
+
<logRotator class="hudson.tasks.LogRotator">
|
13
|
+
<daysToKeep>3</daysToKeep>
|
14
|
+
<numToKeep>1</numToKeep>
|
15
|
+
<artifactDaysToKeep>-1</artifactDaysToKeep>
|
16
|
+
<artifactNumToKeep>-1</artifactNumToKeep>
|
17
|
+
</logRotator>
|
18
|
+
<keepDependencies>false</keepDependencies>
|
19
|
+
<properties>
|
20
|
+
<jenkins.plugins.hipchat.HipChatNotifier_-HipChatJobProperty plugin="hipchat-plugin@0.1.0">
|
21
|
+
<room></room>
|
22
|
+
<startNotification>false</startNotification>
|
23
|
+
</jenkins.plugins.hipchat.HipChatNotifier_-HipChatJobProperty>
|
24
|
+
</properties>
|
25
|
+
<scm class="hudson.plugins.git.GitSCM" plugin="git@1.2.0">
|
26
|
+
<configVersion>2</configVersion>
|
27
|
+
<userRemoteConfigs>
|
28
|
+
<hudson.plugins.git.UserRemoteConfig>
|
29
|
+
<name>origin</name>
|
30
|
+
<refspec>+refs/heads/*:refs/remotes/origin/*</refspec>
|
31
|
+
<url><%= Pkg::Config.build_msi["puppet_for_the_win"]["repo"] %></url>
|
32
|
+
</hudson.plugins.git.UserRemoteConfig>
|
33
|
+
</userRemoteConfigs>
|
34
|
+
<branches>
|
35
|
+
<hudson.plugins.git.BranchSpec>
|
36
|
+
<name><%= Pkg::Config.build_msi["puppet_for_the_win"]["ref"] %></name>
|
37
|
+
</hudson.plugins.git.BranchSpec>
|
38
|
+
</branches>
|
39
|
+
<disableSubmodules>false</disableSubmodules>
|
40
|
+
<recursiveSubmodules>false</recursiveSubmodules>
|
41
|
+
<doGenerateSubmoduleConfigurations>false</doGenerateSubmoduleConfigurations>
|
42
|
+
<authorOrCommitter>false</authorOrCommitter>
|
43
|
+
<clean>false</clean>
|
44
|
+
<wipeOutWorkspace>false</wipeOutWorkspace>
|
45
|
+
<pruneBranches>false</pruneBranches>
|
46
|
+
<remotePoll>false</remotePoll>
|
47
|
+
<ignoreNotifyCommit>false</ignoreNotifyCommit>
|
48
|
+
<useShallowClone>false</useShallowClone>
|
49
|
+
<buildChooser class="hudson.plugins.git.util.DefaultBuildChooser"/>
|
50
|
+
<gitTool>Default</gitTool>
|
51
|
+
<submoduleCfg class="list"/>
|
52
|
+
<relativeTargetDir></relativeTargetDir>
|
53
|
+
<reference></reference>
|
54
|
+
<excludedRegions></excludedRegions>
|
55
|
+
<excludedUsers></excludedUsers>
|
56
|
+
<gitConfigName></gitConfigName>
|
57
|
+
<gitConfigEmail></gitConfigEmail>
|
58
|
+
<skipTag>true</skipTag>
|
59
|
+
<includedRegions></includedRegions>
|
60
|
+
<scmName></scmName>
|
61
|
+
</scm>
|
62
|
+
<assignedNode>win-build</assignedNode>
|
63
|
+
<canRoam>false</canRoam>
|
64
|
+
<disabled>false</disabled>
|
65
|
+
<blockBuildWhenDownstreamBuilding>false</blockBuildWhenDownstreamBuilding>
|
66
|
+
<blockBuildWhenUpstreamBuilding>false</blockBuildWhenUpstreamBuilding>
|
67
|
+
<triggers/>
|
68
|
+
<concurrentBuild>false</concurrentBuild>
|
69
|
+
<axes>
|
70
|
+
<hudson.matrix.TextAxis>
|
71
|
+
<name>ARCH</name>
|
72
|
+
<values>
|
73
|
+
<string>x64</string>
|
74
|
+
<string>x86</string>
|
75
|
+
</values>
|
76
|
+
</hudson.matrix.TextAxis>
|
77
|
+
<hudson.matrix.LabelAxis>
|
78
|
+
<name>label</name>
|
79
|
+
<values>
|
80
|
+
<string>win-build</string>
|
81
|
+
</values>
|
82
|
+
</hudson.matrix.LabelAxis>
|
83
|
+
</axes>
|
84
|
+
<builders>
|
85
|
+
<hudson.tasks.Shell>
|
86
|
+
<command>#!ruby.exe
|
87
|
+
|
88
|
+
require 'yaml'
|
89
|
+
|
90
|
+
puts "arch is #{ENV['ARCH']}"
|
91
|
+
|
92
|
+
if ENV['ARCH'] == "x64"
|
93
|
+
SYS_REF='<%= Pkg::Config.build_msi["sys"]["ref"]["x64"] %>'
|
94
|
+
<% if Pkg::Config.build_msi["cfacter"] -%>
|
95
|
+
CFACTER='<%= Pkg::Config.build_msi["cfacter"]["archive"]["x64"] %>'
|
96
|
+
<% end -%>
|
97
|
+
else
|
98
|
+
SYS_REF='<%= Pkg::Config.build_msi["sys"]["ref"]["x86"] %>'
|
99
|
+
<% if Pkg::Config.build_msi["cfacter"] -%>
|
100
|
+
CFACTER='<%= Pkg::Config.build_msi["cfacter"]["archive"]["x86"] %>'
|
101
|
+
<% end -%>
|
102
|
+
end
|
103
|
+
|
104
|
+
CONFIG = {
|
105
|
+
:repos => {
|
106
|
+
'puppet' => {
|
107
|
+
:ref => '<%= ref %>',
|
108
|
+
:repo => "#{ENV['WORKSPACE']}/puppet-<%= Pkg::Config.version %>-signing_bundle"
|
109
|
+
},
|
110
|
+
<% Pkg::Config.build_msi.each do |project, info| -%>
|
111
|
+
<% next if project == "puppet_for_the_win" || project == "cfacter" -%>
|
112
|
+
'<%= project %>' => {
|
113
|
+
:ref => "<%= ('#{SYS_REF}' if project == "sys") || info["ref"] %>",
|
114
|
+
:repo => '<%= info["repo"] %>'
|
115
|
+
},
|
116
|
+
<% end -%>
|
117
|
+
<% if Pkg::Config.build_msi["cfacter"] -%>
|
118
|
+
'cfacter' => {
|
119
|
+
:archive => "#{CFACTER}",
|
120
|
+
:path => '<%= Pkg::Config.build_msi["cfacter"]["path"] %>'
|
121
|
+
},
|
122
|
+
<% end -%>
|
123
|
+
}
|
124
|
+
}
|
125
|
+
|
126
|
+
File.open("#{ENV['WORKSPACE']}/ondemand.yaml", 'w') { |f| f.write(YAML.dump(CONFIG)) }</command>
|
127
|
+
</hudson.tasks.Shell>
|
128
|
+
<hudson.tasks.BatchFile>
|
129
|
+
<command>
|
130
|
+
REM Print the environment
|
131
|
+
set
|
132
|
+
|
133
|
+
set PKG_NAME=<%= Pkg::Config.msi_name || 'puppet' %>
|
134
|
+
set AGENT_VERSION_STRING=<%= Pkg::Config.version %>
|
135
|
+
set ARCH=%ARCH%
|
136
|
+
set SUFFIX=-%ARCH%
|
137
|
+
if "%ARCH%" == "x86" (
|
138
|
+
set SUFFIX=
|
139
|
+
)
|
140
|
+
|
141
|
+
echo %CD%
|
142
|
+
set ORIG_PATH=/opt/jenkins-builds/puppet/<%= Pkg::Config.ref %>/artifacts
|
143
|
+
set GIT_BUNDLE=puppet-<%= Pkg::Config.version %>-signing_bundle.tar.gz
|
144
|
+
set BUILD_HOST=jenkins@builds.delivery.puppetlabs.net
|
145
|
+
scp %BUILD_HOST%:%ORIG_PATH%/%GIT_BUNDLE% .
|
146
|
+
tar xf %GIT_BUNDLE%
|
147
|
+
|
148
|
+
cmd.exe /c rake clobber windows:build config=ondemand.yaml
|
149
|
+
|
150
|
+
pushd pkg
|
151
|
+
|
152
|
+
REM If we are shipping the old version of puppet, in the 3.x series, we need to maintain established naming conventions.
|
153
|
+
REM For 3, we ship two msi's, one with a `-x64` suffix, and one with no architecture suffix at all. In order to
|
154
|
+
REM maintain that convention, we need to change the name of the installer we are shipping, either from puppet-x64.msi to puppet-%version%-x64.msi,
|
155
|
+
REM or from puppet.msi to puppet-%version%.msi. However, for windows installers in the puppet 4 series, we don't want to change the name at all,
|
156
|
+
REM which will already be set at puppet-agent-%version%-%arch%.msi
|
157
|
+
REM We also have to do this in multiple checks, because %MSI_NAME% is not updated until after the check ends...
|
158
|
+
set MSI_NAME=%PKG_NAME%-%AGENT_VERSION_STRING%-%ARCH%.msi
|
159
|
+
if exist %PKG_NAME%%SUFFIX%.msi (
|
160
|
+
set MSI_NAME=%PKG_NAME%-%AGENT_VERSION_STRING%%SUFFIX%.msi
|
161
|
+
)
|
162
|
+
if exist %PKG_NAME%%SUFFIX%.msi (
|
163
|
+
move %PKG_NAME%%SUFFIX%.msi %MSI_NAME%
|
164
|
+
)
|
165
|
+
|
166
|
+
set DEST_PATH=%ORIG_PATH%/windows
|
167
|
+
ssh %BUILD_HOST% "mkdir -p %DEST_PATH%"
|
168
|
+
REM rsync -avg --ignore-existing %MSI_NAME% %BUILD_HOST%:%DEST_PATH%
|
169
|
+
scp -B %MSI_NAME% %BUILD_HOST%:%DEST_PATH%
|
170
|
+
|
171
|
+
echo Puppet's package name is: %PKG_NAME%
|
172
|
+
echo Puppet's version is: %AGENT_VERSION_STRING%
|
173
|
+
echo Puppet's arch is: %ARCH%
|
174
|
+
echo Find the msi at: http://builds.delivery.puppetlabs.net/puppet/<%= Pkg::Config.ref %>/artifacts/windows/%MSI_NAME%
|
175
|
+
|
176
|
+
popd</command>
|
177
|
+
</hudson.tasks.BatchFile>
|
178
|
+
</builders>
|
179
|
+
<publishers>
|
180
|
+
<hudson.plugins.parameterizedtrigger.BuildTrigger plugin="parameterized-trigger@2.16">
|
181
|
+
<configs>
|
182
|
+
<hudson.plugins.parameterizedtrigger.BuildTriggerConfig>
|
183
|
+
<configs>
|
184
|
+
<hudson.plugins.parameterizedtrigger.CurrentBuildParameters/>
|
185
|
+
</configs>
|
186
|
+
<projects><%= "#{Pkg::Config.project}-repo-#{Pkg::Config.build_date}-#{Pkg::Config.ref}" %></projects>
|
187
|
+
<condition>ALWAYS</condition>
|
188
|
+
<triggerWithNoParameters>false</triggerWithNoParameters>
|
189
|
+
</hudson.plugins.parameterizedtrigger.BuildTriggerConfig>
|
190
|
+
</configs>
|
191
|
+
</hudson.plugins.parameterizedtrigger.BuildTrigger>
|
192
|
+
</publishers>
|
193
|
+
<buildWrappers/>
|
194
|
+
<executionStrategy class="hudson.matrix.DefaultMatrixExecutionStrategyImpl">
|
195
|
+
<runSequentially>false</runSequentially>
|
196
|
+
</executionStrategy>
|
197
|
+
</matrix-project>
|
@@ -0,0 +1,344 @@
|
|
1
|
+
<?xml version='1.0' encoding='UTF-8'?>
|
2
|
+
<matrix-project>
|
3
|
+
<actions/>
|
4
|
+
<description><p>
|
5
|
+
Dynamically Created Packaging Job for a packaging repo-compatible project.
|
6
|
+
Intended to be triggered from within a project with the packaging repo
|
7
|
+
bootstrapped.
|
8
|
+
</p>
|
9
|
+
<p>
|
10
|
+
Three parameters are expected:
|
11
|
+
</p>
|
12
|
+
1) File: A build parameters file that describes information about the build state
|
13
|
+
<br>
|
14
|
+
2) File: A tar.gz of a git bundle, created by the packaging repo, of the
|
15
|
+
current state of the project to be packaged
|
16
|
+
</br>
|
17
|
+
<br>
|
18
|
+
3) String: The project, e.g. facter, puppet
|
19
|
+
</br>
|
20
|
+
<p>
|
21
|
+
This job will be triggered automatically after generation by the packaging
|
22
|
+
repo.
|
23
|
+
</p>
|
24
|
+
<br>
|
25
|
+
To trigger another downstream job after completion of this and the downstream repo creation job, pass DOWNSTREAM_JOB=$URI with the invocation, e.g.
|
26
|
+
</br>
|
27
|
+
<p>
|
28
|
+
pl:jenkins:uber_build DOWNSTREAM_JOB=http://jenkins-release.delivery.puppetlabs.net/job/puppetlabs-packaging-downstream-test/build
|
29
|
+
</p>
|
30
|
+
<p>
|
31
|
+
To get notified of the failure of this packaging job, pass NOTIFY= with the invocation, e.g.
|
32
|
+
</p>
|
33
|
+
<p>
|
34
|
+
pl:jenkins:uber_build NOTIFY=foo@puppetlabs.com
|
35
|
+
</p>
|
36
|
+
<p>
|
37
|
+
Successful completion of packaging will result in the automatic creation of
|
38
|
+
apt/yum repositories on the distribution server with the built packages. To
|
39
|
+
generate client apt/yum repository config files for accessing these packages,
|
40
|
+
check out the ref of the git sha that was packaged, and run `rake
|
41
|
+
pl:jenkins:(deb|rpm)_repo_configs`. Configuration files will be generated and
|
42
|
+
deposited locally in pkg/repo_configs.
|
43
|
+
</p>
|
44
|
+

|
45
|
+

|
46
|
+

|
47
|
+
</description>
|
48
|
+
<logRotator class="hudson.tasks.LogRotator">
|
49
|
+
<daysToKeep>3</daysToKeep>
|
50
|
+
<numToKeep>-1</numToKeep>
|
51
|
+
<artifactDaysToKeep>-1</artifactDaysToKeep>
|
52
|
+
<artifactNumToKeep>-1</artifactNumToKeep>
|
53
|
+
</logRotator>
|
54
|
+
<keepDependencies>false</keepDependencies>
|
55
|
+
<properties>
|
56
|
+
<jp.ikedam.jenkins.plugins.groovy__label__assignment.GroovyLabelAssignmentProperty plugin="groovy-label-assignment@1.0.0">
|
57
|
+
<groovyScript>def labelMap = [
|
58
|
+
<% if Pkg::Config.cows %>
|
59
|
+
<% Pkg::Config.cows.split(' ').each do |cow| %>
|
60
|
+
<% if cow =~ /cumulus/ %>
|
61
|
+
"pl_deb COW=<%= cow %>": "cumulus",
|
62
|
+
<% else %>
|
63
|
+
"pl_deb COW=<%= cow %>": "deb",
|
64
|
+
<% end %>
|
65
|
+
<% end %>
|
66
|
+
<% end %>
|
67
|
+
<% if Pkg::Config.final_mocks %>
|
68
|
+
<% Pkg::Config.final_mocks.split(' ').each do |mock| %>"pl_mock MOCK=<%= mock %>": "rpm",<% end %>
|
69
|
+
<% end %>
|
70
|
+
<% if Pkg::Config.build_tar then %>"package_tar": "rpm",<% end %>
|
71
|
+
<% if Pkg::Config.build_gem then %>"package_gem": "gem",<% end %>
|
72
|
+
<% if Pkg::Config.build_dmg then %>"package_apple": "dmg",<% end %>
|
73
|
+
];
|
74
|
+
return labelMap.get(binding.getVariables().get("command"));</groovyScript>
|
75
|
+
</jp.ikedam.jenkins.plugins.groovy__label__assignment.GroovyLabelAssignmentProperty>
|
76
|
+
<jenkins.plugins.hipchat.HipChatNotifier_-HipChatJobProperty plugin="hipchat-plugin@0.1.0">
|
77
|
+
<room></room>
|
78
|
+
<startNotification>false</startNotification>
|
79
|
+
</jenkins.plugins.hipchat.HipChatNotifier_-HipChatJobProperty>
|
80
|
+
<hudson.model.ParametersDefinitionProperty>
|
81
|
+
<parameterDefinitions>
|
82
|
+
<hudson.model.FileParameterDefinition>
|
83
|
+
<name>BUILD_PROPERTIES</name>
|
84
|
+
<description></description>
|
85
|
+
</hudson.model.FileParameterDefinition>
|
86
|
+
<hudson.model.FileParameterDefinition>
|
87
|
+
<name>PROJECT_BUNDLE</name>
|
88
|
+
<description></description>
|
89
|
+
</hudson.model.FileParameterDefinition>
|
90
|
+
<hudson.model.StringParameterDefinition>
|
91
|
+
<name>PROJECT</name>
|
92
|
+
<description></description>
|
93
|
+
<defaultValue></defaultValue>
|
94
|
+
</hudson.model.StringParameterDefinition>
|
95
|
+
<hudson.model.StringParameterDefinition>
|
96
|
+
<name>METRICS</name>
|
97
|
+
<description></description>
|
98
|
+
<defaultValue></defaultValue>
|
99
|
+
</hudson.model.StringParameterDefinition>
|
100
|
+
</parameterDefinitions>
|
101
|
+
</hudson.model.ParametersDefinitionProperty>
|
102
|
+
</properties>
|
103
|
+
<scm class="hudson.scm.NullSCM"/>
|
104
|
+
<canRoam>true</canRoam>
|
105
|
+
<disabled>false</disabled>
|
106
|
+
<blockBuildWhenDownstreamBuilding>false</blockBuildWhenDownstreamBuilding>
|
107
|
+
<blockBuildWhenUpstreamBuilding>false</blockBuildWhenUpstreamBuilding>
|
108
|
+
<triggers class="vector"/>
|
109
|
+
<concurrentBuild>false</concurrentBuild>
|
110
|
+
<axes>
|
111
|
+
<hudson.matrix.TextAxis>
|
112
|
+
<name>command</name>
|
113
|
+
<values>
|
114
|
+
<% if Pkg::Config.cows %>
|
115
|
+
<% Pkg::Config.cows.split(' ').each do |cow| %><string>pl_deb COW=<%= cow %></string><% end %>
|
116
|
+
<% end %>
|
117
|
+
<% if Pkg::Config.final_mocks %>
|
118
|
+
<% Pkg::Config.final_mocks.split(' ').each do |mock| %><string>pl_mock MOCK=<%= mock %></string><% end %>
|
119
|
+
<% end %>
|
120
|
+
<% if Pkg::Config.build_tar then %><string>package_tar</string><% end %>
|
121
|
+
<% if Pkg::Config.build_gem then %><string>package_gem</string><% end %>
|
122
|
+
<% if Pkg::Config.build_dmg then %><string>package_apple</string><% end %>
|
123
|
+
</values>
|
124
|
+
</hudson.matrix.TextAxis>
|
125
|
+
</axes>
|
126
|
+
<builders>
|
127
|
+
<hudson.tasks.Shell>
|
128
|
+
<command>#!/bin/bash
|
129
|
+
set -e
|
130
|
+
### Create a local clone of the git-bundle that was passed
|
131
|
+
# The bundle is wrapped in a tarball. We don't need to know the project that is
|
132
|
+
# in the git bundle.
|
133
|
+
|
134
|
+
# Swap out _ for : in the command - lein cannot handle : in paths, and jenkins
|
135
|
+
# automatically makes directories with the names of the matrix cell (in this
|
136
|
+
# case $command) if https://github.com/technomancy/leiningen/issues/891 is ever
|
137
|
+
# resolved, this dirty hack can be removed.
|
138
|
+
command=$(echo $command | sed 's/_/:/1')
|
139
|
+
|
140
|
+
[ -f "PROJECT_BUNDLE" ] || exit 1
|
141
|
+
mkdir project && tar -xzf PROJECT_BUNDLE -C project/
|
142
|
+
|
143
|
+
pushd project
|
144
|
+
git clone --recursive $(ls) git_repo
|
145
|
+
|
146
|
+
pushd git_repo
|
147
|
+
|
148
|
+
### Clone the packaging repo
|
149
|
+
rake package:bootstrap
|
150
|
+
|
151
|
+
### Perform the build
|
152
|
+
rake $command PARAMS_FILE="$WORKSPACE/BUILD_PROPERTIES" --trace
|
153
|
+
|
154
|
+
### Send the results
|
155
|
+
rake pl:jenkins:ship["artifacts"] PARAMS_FILE="$WORKSPACE/BUILD_PROPERTIES" --trace
|
156
|
+
|
157
|
+
popd
|
158
|
+
popd</command>
|
159
|
+
</hudson.tasks.Shell>
|
160
|
+
</builders>
|
161
|
+
<publishers>
|
162
|
+
<org.jvnet.hudson.plugins.groovypostbuild.GroovyPostbuildRecorder plugin="groovy-postbuild@1.8">
|
163
|
+
<groovyScript>
|
164
|
+
import java.util.regex.Matcher
|
165
|
+
import java.util.regex.Pattern
|
166
|
+
import java.net.HttpURLConnection
|
167
|
+
import java.util.Date;
|
168
|
+
|
169
|
+
def get_jenkins_build_time() {
|
170
|
+
start_time = manager.build.getStartTimeInMillis()
|
171
|
+
end_time = new Date().getTime()
|
172
|
+
return String.valueOf((end_time - start_time)/1000)
|
173
|
+
}
|
174
|
+
|
175
|
+
// Assemble metrics to post to build metrics server
|
176
|
+
|
177
|
+
app_server = "<%= Pkg::Config.metrics_url %>"
|
178
|
+
task_metrics = manager.build.getEnvironment(manager.listener)['METRICS']
|
179
|
+
charset = "UTF-8"
|
180
|
+
|
181
|
+
// Maintain backwards compatibility
|
182
|
+
if ( task_metrics == null) {
|
183
|
+
build_user = "N/A"
|
184
|
+
version = "N/A"
|
185
|
+
pe_version = "N/A"
|
186
|
+
build_team = "N/A"
|
187
|
+
} else {
|
188
|
+
build_user = task_metrics.split("~")[0]
|
189
|
+
version = task_metrics.split("~")[1]
|
190
|
+
pe_version = task_metrics.split("~")[2]
|
191
|
+
build_team = task_metrics.split("~")[3]
|
192
|
+
}
|
193
|
+
|
194
|
+
matcher = manager.getLogMatcher(/(?:Finished building in:) ([\d]+\.?[\d]*)/)
|
195
|
+
if (matcher != null) {
|
196
|
+
package_build_time = matcher[0][1]
|
197
|
+
} else {
|
198
|
+
package_build_time = "N/A"
|
199
|
+
}
|
200
|
+
|
201
|
+
cmd_string = manager.build.getEnvironment(manager.listener)['command']
|
202
|
+
if(cmd_string =~ /deb/) {
|
203
|
+
package_type = 'deb'
|
204
|
+
} else if(cmd_string =~ /rpm|mock/) {
|
205
|
+
package_type = 'rpm'
|
206
|
+
} else if(cmd_string =~ /gem/) {
|
207
|
+
package_type = 'gem'
|
208
|
+
} else if(cmd_string =~ /apple/) {
|
209
|
+
package_type = 'dmg'
|
210
|
+
} else if(cmd_string =~ /tar/) {
|
211
|
+
package_type = 'tar'
|
212
|
+
} else {
|
213
|
+
package_type = 'N/A'
|
214
|
+
}
|
215
|
+
|
216
|
+
switch (package_type) {
|
217
|
+
case 'deb':
|
218
|
+
dist = cmd_string.split('-')[1]
|
219
|
+
break
|
220
|
+
case 'rpm':
|
221
|
+
if(pe_version != 'N/A') {
|
222
|
+
dist = cmd_string.split('-')[2]
|
223
|
+
} else {
|
224
|
+
dist = cmd_string.split('-')[1] + cmd_string.split('-')[2]
|
225
|
+
}
|
226
|
+
break
|
227
|
+
case 'gem':
|
228
|
+
dist = 'gem'
|
229
|
+
break
|
230
|
+
case 'dmg':
|
231
|
+
dist = 'apple'
|
232
|
+
break
|
233
|
+
case 'tar':
|
234
|
+
dist = 'tar'
|
235
|
+
break
|
236
|
+
default:
|
237
|
+
dist = 'N/A'
|
238
|
+
}
|
239
|
+
|
240
|
+
jenkins_build_time = get_jenkins_build_time()
|
241
|
+
package_name = manager.build.getEnvironment(manager.listener)['PROJECT']
|
242
|
+
build_loc = manager.build.getEnvironment(manager.listener)['NODE_NAME']
|
243
|
+
build_log = "${manager.build.getEnvironment(manager.listener)['BUILD_URL']}" + "consoleText"
|
244
|
+
success = String.valueOf(manager.build.result)
|
245
|
+
|
246
|
+
String query = String.format("package_name=%s&dist=%s&package_type=%s&build_user=%s&build_team=%s&build_loc=%s&version=%s&pe_version=%s&success=%s&build_log=%s&jenkins_build_time=%s&package_build_time=%s",
|
247
|
+
URLEncoder.encode(package_name, charset),
|
248
|
+
URLEncoder.encode(dist, charset),
|
249
|
+
URLEncoder.encode(package_type, charset),
|
250
|
+
URLEncoder.encode(build_user, charset),
|
251
|
+
URLEncoder.encode(build_team, charset),
|
252
|
+
URLEncoder.encode(build_loc, charset),
|
253
|
+
URLEncoder.encode(version, charset),
|
254
|
+
URLEncoder.encode(pe_version, charset),
|
255
|
+
URLEncoder.encode(success, charset),
|
256
|
+
URLEncoder.encode(build_log, charset),
|
257
|
+
URLEncoder.encode(jenkins_build_time, charset),
|
258
|
+
URLEncoder.encode(package_build_time, charset))
|
259
|
+
|
260
|
+
// Make sure the server is listening before attempting to post data
|
261
|
+
|
262
|
+
URLConnection connection = null
|
263
|
+
serverAlive = false
|
264
|
+
try {
|
265
|
+
URL u = new URL(app_server);
|
266
|
+
connection = (HttpURLConnection) u.openConnection();
|
267
|
+
connection.setRequestMethod("GET");
|
268
|
+
int code = connection.getResponseCode();
|
269
|
+
serverAlive = true
|
270
|
+
connection.disconnect();
|
271
|
+
|
272
|
+
} catch (MalformedURLException e) {
|
273
|
+
serverAlive = false
|
274
|
+
e.printStackTrace()
|
275
|
+
|
276
|
+
} catch (IOException e) {
|
277
|
+
serverAlive = false
|
278
|
+
e.printStackTrace()
|
279
|
+
|
280
|
+
} finally {
|
281
|
+
if (serverAlive == true) {
|
282
|
+
connection = new URL(app_server).openConnection()
|
283
|
+
connection.setDoOutput(true) // Triggers POST.
|
284
|
+
connection.setRequestProperty("Accept-Charset", charset);
|
285
|
+
connection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded;charset=" + charset);
|
286
|
+
OutputStream output = null;
|
287
|
+
|
288
|
+
try {
|
289
|
+
output = connection.getOutputStream()
|
290
|
+
output.write(query.getBytes(charset))
|
291
|
+
InputStream response = connection.getInputStream()
|
292
|
+
} finally {
|
293
|
+
if (output != null) try { output.close(); } catch (IOException logOrIgnore) {}
|
294
|
+
}
|
295
|
+
}
|
296
|
+
} </groovyScript>
|
297
|
+
<behavior>0</behavior>
|
298
|
+
</org.jvnet.hudson.plugins.groovypostbuild.GroovyPostbuildRecorder>
|
299
|
+
<hudson.tasks.ArtifactArchiver>
|
300
|
+
<artifacts>**/PROJECT_BUNDLE, **/BUILD_PROPERTIES</artifacts>
|
301
|
+
<latestOnly>false</latestOnly>
|
302
|
+
<allowEmptyArchive>false</allowEmptyArchive>
|
303
|
+
</hudson.tasks.ArtifactArchiver><% if Pkg::Config.notify %>
|
304
|
+
<hudson.tasks.Mailer plugin="mailer@1.4">
|
305
|
+
<recipients><%= "#{Pkg::Config.notify}" %></recipients>
|
306
|
+
<dontNotifyEveryUnstableBuild>false</dontNotifyEveryUnstableBuild>
|
307
|
+
<sendToIndividuals>false</sendToIndividuals>
|
308
|
+
</hudson.tasks.Mailer><% end %>
|
309
|
+
<hudson.plugins.parameterizedtrigger.BuildTrigger plugin="parameterized-trigger@2.16">
|
310
|
+
<configs>
|
311
|
+
<hudson.plugins.parameterizedtrigger.BuildTriggerConfig>
|
312
|
+
<configs>
|
313
|
+
<hudson.plugins.parameterizedtrigger.CurrentBuildParameters/>
|
314
|
+
</configs>
|
315
|
+
<% if Pkg::Config.build_msi
|
316
|
+
downstream = "#{Pkg::Config.project}-msi-#{Pkg::Config.build_date}-#{Pkg::Config.short_ref}"
|
317
|
+
else
|
318
|
+
downstream = "#{Pkg::Config.project}-repo-#{Pkg::Config.build_date}-#{Pkg::Config.ref}"
|
319
|
+
end -%>
|
320
|
+
<projects><%= downstream %></projects>
|
321
|
+
<condition>ALWAYS</condition>
|
322
|
+
<triggerWithNoParameters>false</triggerWithNoParameters>
|
323
|
+
</hudson.plugins.parameterizedtrigger.BuildTriggerConfig>
|
324
|
+
</configs>
|
325
|
+
</hudson.plugins.parameterizedtrigger.BuildTrigger>
|
326
|
+
</publishers>
|
327
|
+
<buildWrappers>
|
328
|
+
<hudson.plugins.build__timeout.BuildTimeoutWrapper plugin="build-timeout@1.11">
|
329
|
+
<timeoutMinutes>90</timeoutMinutes>
|
330
|
+
<failBuild>false</failBuild>
|
331
|
+
<writingDescription>false</writingDescription>
|
332
|
+
<timeoutPercentage>0</timeoutPercentage>
|
333
|
+
<timeoutType>absolute</timeoutType>
|
334
|
+
<timeoutMinutesElasticDefault>3</timeoutMinutesElasticDefault>
|
335
|
+
</hudson.plugins.build__timeout.BuildTimeoutWrapper>
|
336
|
+
<hudson.plugins.ansicolor.AnsiColorBuildWrapper plugin="ansicolor@0.3.1">
|
337
|
+
<colorMapName>xterm</colorMapName>
|
338
|
+
</hudson.plugins.ansicolor.AnsiColorBuildWrapper>
|
339
|
+
<hudson.plugins.timestamper.TimestamperBuildWrapper plugin="timestamper@1.8.4"/>
|
340
|
+
</buildWrappers>
|
341
|
+
<executionStrategy class="hudson.matrix.DefaultMatrixExecutionStrategyImpl">
|
342
|
+
<runSequentially>false</runSequentially>
|
343
|
+
</executionStrategy>
|
344
|
+
</matrix-project>
|