packaging 0.88.77

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.
Files changed (123) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +17 -0
  3. data/README-Solaris.md +117 -0
  4. data/README.md +977 -0
  5. data/lib/packaging.rb +32 -0
  6. data/lib/packaging/archive.rb +126 -0
  7. data/lib/packaging/artifactory.rb +651 -0
  8. data/lib/packaging/artifactory/extensions.rb +94 -0
  9. data/lib/packaging/config.rb +492 -0
  10. data/lib/packaging/config/params.rb +387 -0
  11. data/lib/packaging/config/validations.rb +13 -0
  12. data/lib/packaging/deb.rb +28 -0
  13. data/lib/packaging/deb/repo.rb +264 -0
  14. data/lib/packaging/gem.rb +70 -0
  15. data/lib/packaging/metrics.rb +15 -0
  16. data/lib/packaging/nuget.rb +39 -0
  17. data/lib/packaging/paths.rb +376 -0
  18. data/lib/packaging/platforms.rb +507 -0
  19. data/lib/packaging/repo.rb +155 -0
  20. data/lib/packaging/retrieve.rb +75 -0
  21. data/lib/packaging/rpm.rb +5 -0
  22. data/lib/packaging/rpm/repo.rb +254 -0
  23. data/lib/packaging/sign.rb +8 -0
  24. data/lib/packaging/sign/deb.rb +9 -0
  25. data/lib/packaging/sign/dmg.rb +41 -0
  26. data/lib/packaging/sign/ips.rb +57 -0
  27. data/lib/packaging/sign/msi.rb +124 -0
  28. data/lib/packaging/sign/rpm.rb +115 -0
  29. data/lib/packaging/tar.rb +163 -0
  30. data/lib/packaging/util.rb +146 -0
  31. data/lib/packaging/util/date.rb +20 -0
  32. data/lib/packaging/util/execution.rb +85 -0
  33. data/lib/packaging/util/file.rb +125 -0
  34. data/lib/packaging/util/git.rb +174 -0
  35. data/lib/packaging/util/git_tags.rb +73 -0
  36. data/lib/packaging/util/gpg.rb +66 -0
  37. data/lib/packaging/util/jenkins.rb +95 -0
  38. data/lib/packaging/util/misc.rb +69 -0
  39. data/lib/packaging/util/net.rb +410 -0
  40. data/lib/packaging/util/os.rb +17 -0
  41. data/lib/packaging/util/platform.rb +40 -0
  42. data/lib/packaging/util/rake_utils.rb +112 -0
  43. data/lib/packaging/util/serialization.rb +19 -0
  44. data/lib/packaging/util/ship.rb +300 -0
  45. data/lib/packaging/util/tool.rb +41 -0
  46. data/lib/packaging/util/version.rb +334 -0
  47. data/spec/fixtures/config/ext/build_defaults.yaml +2 -0
  48. data/spec/fixtures/config/ext/project_data.yaml +2 -0
  49. data/spec/fixtures/configs/components/test_file.json +1 -0
  50. data/spec/fixtures/configs/components/test_file_2.json +0 -0
  51. data/spec/fixtures/configs/components/test_file_not_tagged.json +1 -0
  52. data/spec/fixtures/configs/components/test_file_wrong_ext.txt +0 -0
  53. data/spec/fixtures/configs/components/test_file_wrong_ext.wrong +0 -0
  54. data/spec/fixtures/util/pre_tasks.yaml +4 -0
  55. data/spec/lib/packaging/artifactory_spec.rb +221 -0
  56. data/spec/lib/packaging/config_spec.rb +576 -0
  57. data/spec/lib/packaging/deb/repo_spec.rb +157 -0
  58. data/spec/lib/packaging/deb_spec.rb +52 -0
  59. data/spec/lib/packaging/gem_spec.rb +86 -0
  60. data/spec/lib/packaging/paths_spec.rb +418 -0
  61. data/spec/lib/packaging/platforms_spec.rb +178 -0
  62. data/spec/lib/packaging/repo_spec.rb +135 -0
  63. data/spec/lib/packaging/retrieve_spec.rb +100 -0
  64. data/spec/lib/packaging/rpm/repo_spec.rb +133 -0
  65. data/spec/lib/packaging/sign_spec.rb +133 -0
  66. data/spec/lib/packaging/tar_spec.rb +116 -0
  67. data/spec/lib/packaging/util/execution_spec.rb +56 -0
  68. data/spec/lib/packaging/util/file_spec.rb +139 -0
  69. data/spec/lib/packaging/util/git_spec.rb +160 -0
  70. data/spec/lib/packaging/util/git_tag_spec.rb +36 -0
  71. data/spec/lib/packaging/util/gpg_spec.rb +64 -0
  72. data/spec/lib/packaging/util/jenkins_spec.rb +112 -0
  73. data/spec/lib/packaging/util/misc_spec.rb +31 -0
  74. data/spec/lib/packaging/util/net_spec.rb +259 -0
  75. data/spec/lib/packaging/util/os_spec.rb +31 -0
  76. data/spec/lib/packaging/util/rake_utils_spec.rb +70 -0
  77. data/spec/lib/packaging/util/ship_spec.rb +199 -0
  78. data/spec/lib/packaging/util/version_spec.rb +123 -0
  79. data/spec/lib/packaging_spec.rb +19 -0
  80. data/spec/spec_helper.rb +22 -0
  81. data/static_artifacts/PackageInfo.plist +3 -0
  82. data/tasks/00_utils.rake +214 -0
  83. data/tasks/30_metrics.rake +33 -0
  84. data/tasks/apple.rake +268 -0
  85. data/tasks/archive.rake +69 -0
  86. data/tasks/build.rake +12 -0
  87. data/tasks/clean.rake +5 -0
  88. data/tasks/config.rake +35 -0
  89. data/tasks/deb.rake +129 -0
  90. data/tasks/deb_repos.rake +28 -0
  91. data/tasks/deprecated.rake +130 -0
  92. data/tasks/doc.rake +20 -0
  93. data/tasks/education.rake +57 -0
  94. data/tasks/fetch.rake +60 -0
  95. data/tasks/gem.rake +159 -0
  96. data/tasks/jenkins.rake +538 -0
  97. data/tasks/jenkins_dynamic.rake +202 -0
  98. data/tasks/load_extras.rake +21 -0
  99. data/tasks/mock.rake +348 -0
  100. data/tasks/nightly_repos.rake +286 -0
  101. data/tasks/pe_deb.rake +12 -0
  102. data/tasks/pe_rpm.rake +13 -0
  103. data/tasks/pe_ship.rake +226 -0
  104. data/tasks/pe_sign.rake +13 -0
  105. data/tasks/pe_tar.rake +5 -0
  106. data/tasks/retrieve.rake +52 -0
  107. data/tasks/rpm.rake +66 -0
  108. data/tasks/rpm_repos.rake +29 -0
  109. data/tasks/ship.rake +692 -0
  110. data/tasks/sign.rake +154 -0
  111. data/tasks/tag.rake +8 -0
  112. data/tasks/tar.rake +28 -0
  113. data/tasks/update.rake +16 -0
  114. data/tasks/vanagon.rake +35 -0
  115. data/tasks/vendor_gems.rake +117 -0
  116. data/tasks/version.rake +33 -0
  117. data/tasks/z_data_dump.rake +65 -0
  118. data/templates/README +1 -0
  119. data/templates/downstream.xml.erb +47 -0
  120. data/templates/msi.xml.erb +197 -0
  121. data/templates/packaging.xml.erb +346 -0
  122. data/templates/repo.xml.erb +117 -0
  123. 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>&lt;p&gt;&#xd;
5
+ When DOWNSTREAM_JOB is passed to the packaging repo, this job is created to wrap the call to that job.&#xd;
6
+ This allows us to use jenkins&apos; upstream/downstream chaining facilities while retaining the ability to trigger jobs on other jenkins hosts&#xd;
7
+ &lt;/p&gt;</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 &quot;http://<%= "#{Pkg::Config.jenkins_build_host}" %>/job/<%= "#{Pkg::Config.project}-repo-#{Pkg::Config.build_date}-#{Pkg::Config.ref}" %>/lastBuild/api/json&quot; | grep result\&quot;:\&quot;SUCCESS\&quot; &gt; /dev/null
28
+
29
+ UPSTREAM_BUILD_STATUS=$?
30
+
31
+ set -e
32
+
33
+ if [ $UPSTREAM_BUILD_STATUS -eq 0 ] ; then
34
+ UPSTREAM_BUILD_STATUS=&quot;success&quot;
35
+ else
36
+ UPSTREAM_BUILD_STATUS=&quot;failure&quot;
37
+ fi
38
+
39
+ # This URI was passed in as an argument to the original rake package call
40
+ curl -v --fail -i &quot;<%= 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"]}")) %>&quot;</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>&lt;p&gt;&#xd;
5
+ Dynamically created job to generate the MSI for this version of Puppet&#xd;
6
+ &#xd;
7
+ The artifacts are sent out to builds.delivery.puppetlabs.net
8
+ &lt;p&gt;&#xd;
9
+ This job will trigger the downstream job supplied with DOWNSTREAM_JOB if passed to rake in the upstream invocation.&#xd;
10
+ &lt;/p&gt;&#xd;
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 &apos;yaml&apos;
89
+
90
+ puts &quot;arch is #{ENV[&apos;ARCH&apos;]}&quot;
91
+
92
+ if ENV[&apos;ARCH&apos;] == &quot;x64&quot;
93
+ SYS_REF=&apos;<%= Pkg::Config.build_msi["sys"]["ref"]["x64"] %>&apos;
94
+ <% if Pkg::Config.build_msi["cfacter"] -%>
95
+ CFACTER=&apos;<%= Pkg::Config.build_msi["cfacter"]["archive"]["x64"] %>&apos;
96
+ <% end -%>
97
+ else
98
+ SYS_REF=&apos;<%= Pkg::Config.build_msi["sys"]["ref"]["x86"] %>&apos;
99
+ <% if Pkg::Config.build_msi["cfacter"] -%>
100
+ CFACTER=&apos;<%= Pkg::Config.build_msi["cfacter"]["archive"]["x86"] %>&apos;
101
+ <% end -%>
102
+ end
103
+
104
+ CONFIG = {
105
+ :repos =&gt; {
106
+ &apos;puppet&apos; =&gt; {
107
+ :ref =&gt; &apos;<%= ref %>&apos;,
108
+ :repo =&gt; &quot;#{ENV[&apos;WORKSPACE&apos;]}/puppet-<%= Pkg::Config.version %>-signing_bundle&quot;
109
+ },
110
+ <% Pkg::Config.build_msi.each do |project, info| -%>
111
+ <% next if project == "puppet_for_the_win" || project == "cfacter" -%>
112
+ &apos;<%= project %>&apos; =&gt; {
113
+ :ref =&gt; &quot;<%= ('#{SYS_REF}' if project == "sys") || info["ref"] %>&quot;,
114
+ :repo =&gt; &apos;<%= info["repo"] %>&apos;
115
+ },
116
+ <% end -%>
117
+ <% if Pkg::Config.build_msi["cfacter"] -%>
118
+ &apos;cfacter&apos; =&gt; {
119
+ :archive =&gt; &quot;#{CFACTER}&quot;,
120
+ :path =&gt; &apos;<%= Pkg::Config.build_msi["cfacter"]["path"] %>&apos;
121
+ },
122
+ <% end -%>
123
+ }
124
+ }
125
+
126
+ File.open(&quot;#{ENV[&apos;WORKSPACE&apos;]}/ondemand.yaml&quot;, &apos;w&apos;) { |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 &quot;%ARCH%&quot; == &quot;x86&quot; (
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% &quot;mkdir -p %DEST_PATH%&quot;
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&apos;s package name is: %PKG_NAME%
172
+ echo Puppet&apos;s version is: %AGENT_VERSION_STRING%
173
+ echo Puppet&apos;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>&lt;p&gt;&#xd;
5
+ Dynamically Created Packaging Job for a packaging repo-compatible project.&#xd;
6
+ Intended to be triggered from within a project with the packaging gem installed.&#xd;
7
+ &lt;/p&gt;&#xd;
8
+ &lt;p&gt;&#xd;
9
+ Three parameters are expected:&#xd;
10
+ &lt;/p&gt;&#xd;
11
+ 1) File: A build parameters file that describes information about the build state&#xd;
12
+ &lt;br&gt;&#xd;
13
+ 2) File: A tar.gz of a git bundle, created by the packaging repo, of the&#xd;
14
+ current state of the project to be packaged&#xd;
15
+ &lt;/br&gt;&#xd;
16
+ &lt;br&gt;&#xd;
17
+ 3) String: The project, e.g. facter, puppet&#xd;
18
+ &lt;/br&gt;&#xd;
19
+ &lt;p&gt;&#xd;
20
+ This job will be triggered automatically after generation by the packaging&#xd;
21
+ repo.&#xd;
22
+ &lt;/p&gt;&#xd;
23
+ &lt;br&gt;&#xd;
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.&#xd;
25
+ &lt;/br&gt;&#xd;
26
+ &lt;p&gt;&#xd;
27
+ pl:jenkins:uber_build DOWNSTREAM_JOB=http://jenkins-release.delivery.puppetlabs.net/job/puppetlabs-packaging-downstream-test/build&#xd;
28
+ &lt;/p&gt;&#xd;
29
+ &lt;p&gt;&#xd;
30
+ To get notified of the failure of this packaging job, pass NOTIFY= with the invocation, e.g.&#xd;
31
+ &lt;/p&gt;&#xd;
32
+ &lt;p&gt;&#xd;
33
+ pl:jenkins:uber_build NOTIFY=foo@puppetlabs.com&#xd;
34
+ &lt;/p&gt;&#xd;
35
+ &lt;p&gt;&#xd;
36
+ Successful completion of packaging will result in the automatic creation of&#xd;
37
+ apt/yum repositories on the distribution server with the built packages. To&#xd;
38
+ generate client apt/yum repository config files for accessing these packages,&#xd;
39
+ check out the ref of the git sha that was packaged, and run `bundle exec rake&#xd;
40
+ pl:jenkins:(deb|rpm)_repo_configs`. Configuration files will be generated and&#xd;
41
+ deposited locally in pkg/repo_configs.&#xd;
42
+ &lt;/p&gt;&#xd;
43
+ &#xd;
44
+ &#xd;
45
+ &#xd;
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
+ &quot;pl_deb COW=<%= cow %>&quot;: &quot;cumulus&quot;,
61
+ <% else %>
62
+ &quot;pl_deb COW=<%= cow %>&quot;: &quot;deb&quot;,
63
+ <% end %>
64
+ <% end %>
65
+ <% end %>
66
+ <% if Pkg::Config.final_mocks %>
67
+ <% Pkg::Config.final_mocks.split(' ').each do |mock| %>&quot;pl_mock MOCK=<%= mock %>&quot;: &quot;rpm&quot;,<% end %>
68
+ <% end %>
69
+ <% if Pkg::Config.build_tar then %>&quot;package_tar&quot;: &quot;tar&quot;,<% end %>
70
+ <% if Pkg::Config.build_gem then %>&quot;package_gem&quot;: &quot;gem&quot;,<% end %>
71
+ <% if Pkg::Config.build_dmg then %>&quot;package_apple&quot;: &quot;dmg&quot;,<% end %>
72
+ ];
73
+ return labelMap.get(binding.getVariables().get(&quot;command&quot;));</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 &quot;PROJECT_BUNDLE&quot; ] || exit 1
140
+ mkdir project &amp;&amp; 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=&quot;<%= ENV['PACKAGING_LOCATION'] %>&quot;
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=&quot;$WORKSPACE/BUILD_PROPERTIES&quot; --trace
155
+
156
+ ### Send the results
157
+ bundle exec rake pl:jenkins:ship[&quot;artifacts&quot;] PARAMS_FILE=&quot;$WORKSPACE/BUILD_PROPERTIES&quot; --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 = &quot;<%= Pkg::Config.metrics_url %>&quot;
180
+ task_metrics = manager.build.getEnvironment(manager.listener)[&apos;METRICS&apos;]
181
+ charset = &quot;UTF-8&quot;
182
+
183
+ // Maintain backwards compatibility
184
+ if ( task_metrics == null) {
185
+ build_user = &quot;N/A&quot;
186
+ version = &quot;N/A&quot;
187
+ pe_version = &quot;N/A&quot;
188
+ build_team = &quot;N/A&quot;
189
+ } else {
190
+ build_user = task_metrics.split(&quot;~&quot;)[0]
191
+ version = task_metrics.split(&quot;~&quot;)[1]
192
+ pe_version = task_metrics.split(&quot;~&quot;)[2]
193
+ build_team = task_metrics.split(&quot;~&quot;)[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 = &quot;N/A&quot;
201
+ }
202
+
203
+ cmd_string = manager.build.getEnvironment(manager.listener)[&apos;command&apos;]
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)[&apos;PROJECT&apos;]
244
+ build_loc = manager.build.getEnvironment(manager.listener)[&apos;NODE_NAME&apos;]
245
+ build_log = &quot;${manager.build.getEnvironment(manager.listener)[&apos;BUILD_URL&apos;]}&quot; + &quot;consoleText&quot;
246
+ success = String.valueOf(manager.build.result)
247
+
248
+ String query = String.format(&quot;package_name=%s&amp;dist=%s&amp;package_type=%s&amp;build_user=%s&amp;build_team=%s&amp;build_loc=%s&amp;version=%s&amp;pe_version=%s&amp;success=%s&amp;build_log=%s&amp;jenkins_build_time=%s&amp;package_build_time=%s&quot;,
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(&quot;GET&quot;);
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(&quot;Accept-Charset&quot;, charset);
287
+ connection.setRequestProperty(&quot;Content-Type&quot;, &quot;application/x-www-form-urlencoded;charset=&quot; + 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>