packaging 0.88.77
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE +17 -0
- data/README-Solaris.md +117 -0
- data/README.md +977 -0
- data/lib/packaging.rb +32 -0
- data/lib/packaging/archive.rb +126 -0
- data/lib/packaging/artifactory.rb +651 -0
- data/lib/packaging/artifactory/extensions.rb +94 -0
- data/lib/packaging/config.rb +492 -0
- data/lib/packaging/config/params.rb +387 -0
- data/lib/packaging/config/validations.rb +13 -0
- data/lib/packaging/deb.rb +28 -0
- data/lib/packaging/deb/repo.rb +264 -0
- data/lib/packaging/gem.rb +70 -0
- data/lib/packaging/metrics.rb +15 -0
- data/lib/packaging/nuget.rb +39 -0
- data/lib/packaging/paths.rb +376 -0
- data/lib/packaging/platforms.rb +507 -0
- data/lib/packaging/repo.rb +155 -0
- data/lib/packaging/retrieve.rb +75 -0
- data/lib/packaging/rpm.rb +5 -0
- data/lib/packaging/rpm/repo.rb +254 -0
- data/lib/packaging/sign.rb +8 -0
- data/lib/packaging/sign/deb.rb +9 -0
- data/lib/packaging/sign/dmg.rb +41 -0
- data/lib/packaging/sign/ips.rb +57 -0
- data/lib/packaging/sign/msi.rb +124 -0
- data/lib/packaging/sign/rpm.rb +115 -0
- data/lib/packaging/tar.rb +163 -0
- data/lib/packaging/util.rb +146 -0
- data/lib/packaging/util/date.rb +20 -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 +66 -0
- data/lib/packaging/util/jenkins.rb +95 -0
- data/lib/packaging/util/misc.rb +69 -0
- data/lib/packaging/util/net.rb +410 -0
- data/lib/packaging/util/os.rb +17 -0
- data/lib/packaging/util/platform.rb +40 -0
- data/lib/packaging/util/rake_utils.rb +112 -0
- data/lib/packaging/util/serialization.rb +19 -0
- data/lib/packaging/util/ship.rb +300 -0
- data/lib/packaging/util/tool.rb +41 -0
- data/lib/packaging/util/version.rb +334 -0
- data/spec/fixtures/config/ext/build_defaults.yaml +2 -0
- data/spec/fixtures/config/ext/project_data.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 +221 -0
- data/spec/lib/packaging/config_spec.rb +576 -0
- data/spec/lib/packaging/deb/repo_spec.rb +157 -0
- data/spec/lib/packaging/deb_spec.rb +52 -0
- data/spec/lib/packaging/gem_spec.rb +86 -0
- data/spec/lib/packaging/paths_spec.rb +418 -0
- data/spec/lib/packaging/platforms_spec.rb +178 -0
- data/spec/lib/packaging/repo_spec.rb +135 -0
- data/spec/lib/packaging/retrieve_spec.rb +100 -0
- data/spec/lib/packaging/rpm/repo_spec.rb +133 -0
- data/spec/lib/packaging/sign_spec.rb +133 -0
- data/spec/lib/packaging/tar_spec.rb +116 -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 +259 -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 +199 -0
- data/spec/lib/packaging/util/version_spec.rb +123 -0
- data/spec/lib/packaging_spec.rb +19 -0
- data/spec/spec_helper.rb +22 -0
- data/static_artifacts/PackageInfo.plist +3 -0
- data/tasks/00_utils.rake +214 -0
- data/tasks/30_metrics.rake +33 -0
- data/tasks/apple.rake +268 -0
- data/tasks/archive.rake +69 -0
- data/tasks/build.rake +12 -0
- data/tasks/clean.rake +5 -0
- data/tasks/config.rake +35 -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 +60 -0
- data/tasks/gem.rake +159 -0
- data/tasks/jenkins.rake +538 -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 +286 -0
- data/tasks/pe_deb.rake +12 -0
- data/tasks/pe_rpm.rake +13 -0
- data/tasks/pe_ship.rake +226 -0
- data/tasks/pe_sign.rake +13 -0
- data/tasks/pe_tar.rake +5 -0
- data/tasks/retrieve.rake +52 -0
- data/tasks/rpm.rake +66 -0
- data/tasks/rpm_repos.rake +29 -0
- data/tasks/ship.rake +692 -0
- data/tasks/sign.rake +154 -0
- data/tasks/tag.rake +8 -0
- data/tasks/tar.rake +28 -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 +346 -0
- data/templates/repo.xml.erb +117 -0
- metadata +287 -0
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,346 @@
|
|
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 gem installed.
|
7
|
+
</p>
|
8
|
+
<p>
|
9
|
+
Three parameters are expected:
|
10
|
+
</p>
|
11
|
+
1) File: A build parameters file that describes information about the build state
|
12
|
+
<br>
|
13
|
+
2) File: A tar.gz of a git bundle, created by the packaging repo, of the
|
14
|
+
current state of the project to be packaged
|
15
|
+
</br>
|
16
|
+
<br>
|
17
|
+
3) String: The project, e.g. facter, puppet
|
18
|
+
</br>
|
19
|
+
<p>
|
20
|
+
This job will be triggered automatically after generation by the packaging
|
21
|
+
repo.
|
22
|
+
</p>
|
23
|
+
<br>
|
24
|
+
To trigger another downstream job after completion of this and the downstream repo creation job, pass DOWNSTREAM_JOB=$URI with the invocation, e.g.
|
25
|
+
</br>
|
26
|
+
<p>
|
27
|
+
pl:jenkins:uber_build DOWNSTREAM_JOB=http://jenkins-release.delivery.puppetlabs.net/job/puppetlabs-packaging-downstream-test/build
|
28
|
+
</p>
|
29
|
+
<p>
|
30
|
+
To get notified of the failure of this packaging job, pass NOTIFY= with the invocation, e.g.
|
31
|
+
</p>
|
32
|
+
<p>
|
33
|
+
pl:jenkins:uber_build NOTIFY=foo@puppetlabs.com
|
34
|
+
</p>
|
35
|
+
<p>
|
36
|
+
Successful completion of packaging will result in the automatic creation of
|
37
|
+
apt/yum repositories on the distribution server with the built packages. To
|
38
|
+
generate client apt/yum repository config files for accessing these packages,
|
39
|
+
check out the ref of the git sha that was packaged, and run `bundle exec rake
|
40
|
+
pl:jenkins:(deb|rpm)_repo_configs`. Configuration files will be generated and
|
41
|
+
deposited locally in pkg/repo_configs.
|
42
|
+
</p>
|
43
|
+

|
44
|
+

|
45
|
+

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