Add default refspec reference
[releng/global-jjb.git] / jjb-test / expected-xml / gerrit-ciman-jjb-merge
1 <?xml version="1.0" encoding="utf-8"?>
2 <project>
3   <actions/>
4   <description>&lt;!-- Managed by Jenkins Job Builder --&gt;</description>
5   <keepDependencies>false</keepDependencies>
6   <blockBuildWhenDownstreamBuilding>false</blockBuildWhenDownstreamBuilding>
7   <blockBuildWhenUpstreamBuilding>false</blockBuildWhenUpstreamBuilding>
8   <concurrentBuild>false</concurrentBuild>
9   <assignedNode>build-vm</assignedNode>
10   <canRoam>false</canRoam>
11   <properties>
12     <jenkins.model.BuildDiscarderProperty>
13       <strategy class="hudson.tasks.LogRotator">
14         <daysToKeep>7</daysToKeep>
15         <numToKeep>-1</numToKeep>
16         <artifactDaysToKeep>-1</artifactDaysToKeep>
17         <artifactNumToKeep>0</artifactNumToKeep>
18       </strategy>
19     </jenkins.model.BuildDiscarderProperty>
20     <hudson.model.ParametersDefinitionProperty>
21       <parameterDefinitions>
22         <hudson.model.StringParameterDefinition>
23           <name>PROJECT</name>
24           <description>Parameter to identify a Gerrit project. This is typically the
25 project repo path as exists in Gerrit.
26 For example: ofextensions/circuitsw
27 </description>
28           <defaultValue>releng/ciman</defaultValue>
29         </hudson.model.StringParameterDefinition>
30         <hudson.model.StringParameterDefinition>
31           <name>STREAM</name>
32           <description>Stream is often set to the same name as 'branch' but can
33 sometimes be used as a name representing a project's release code
34 name.
35 </description>
36           <defaultValue>master</defaultValue>
37         </hudson.model.StringParameterDefinition>
38         <hudson.model.StringParameterDefinition>
39           <name>GERRIT_PROJECT</name>
40           <description>Parameter to identify Gerrit project. This is typically the
41 project repo path as exists in Gerrit.
42 For example: ofextensions/circuitsw
43
44 Note that Gerrit will override this parameter automatically if a
45 job is triggered by Gerrit.
46 </description>
47           <defaultValue>releng/ciman</defaultValue>
48         </hudson.model.StringParameterDefinition>
49         <hudson.model.StringParameterDefinition>
50           <name>GERRIT_BRANCH</name>
51           <description>Parameter to identify a Gerrit branch.
52
53 Note that Gerrit will override this parameter automatically if a
54 job is triggered by Gerrit.
55 </description>
56           <defaultValue>master</defaultValue>
57         </hudson.model.StringParameterDefinition>
58         <hudson.model.StringParameterDefinition>
59           <name>GERRIT_REFSPEC</name>
60           <description>Parameter to identify a refspec when pulling from Gerrit.
61
62 Note that Gerrit will override this parameter automatically if a
63 job is triggered by Gerrit.
64 </description>
65           <defaultValue>refs/heads/master</defaultValue>
66         </hudson.model.StringParameterDefinition>
67         <hudson.model.StringParameterDefinition>
68           <name>JJB_VERSION</name>
69           <description>Jenkins Job Builder version to download and install.</description>
70           <defaultValue>1.6.2</defaultValue>
71         </hudson.model.StringParameterDefinition>
72       </parameterDefinitions>
73     </hudson.model.ParametersDefinitionProperty>
74   </properties>
75   <scm class="hudson.plugins.git.GitSCM">
76     <configVersion>2</configVersion>
77     <userRemoteConfigs>
78       <hudson.plugins.git.UserRemoteConfig>
79         <name>origin</name>
80         <refspec/>
81         <url>$GIT_URL/$GERRIT_PROJECT</url>
82         <credentialsId>test-credential</credentialsId>
83       </hudson.plugins.git.UserRemoteConfig>
84     </userRemoteConfigs>
85     <branches>
86       <hudson.plugins.git.BranchSpec>
87         <name>refs/heads/master</name>
88       </hudson.plugins.git.BranchSpec>
89     </branches>
90     <excludedUsers/>
91     <buildChooser class="hudson.plugins.git.util.DefaultBuildChooser"/>
92     <doGenerateSubmoduleConfigurations>false</doGenerateSubmoduleConfigurations>
93     <authorOrCommitter>false</authorOrCommitter>
94     <wipeOutWorkspace>true</wipeOutWorkspace>
95     <pruneBranches>false</pruneBranches>
96     <remotePoll>false</remotePoll>
97     <gitTool>Default</gitTool>
98     <submoduleCfg class="list"/>
99     <relativeTargetDir/>
100     <reference/>
101     <gitConfigName/>
102     <gitConfigEmail/>
103     <skipTag>true</skipTag>
104     <scmName/>
105     <useShallowClone>false</useShallowClone>
106     <ignoreNotifyCommit>false</ignoreNotifyCommit>
107     <extensions>
108       <hudson.plugins.git.extensions.impl.SubmoduleOption>
109         <disableSubmodules>false</disableSubmodules>
110         <recursiveSubmodules>true</recursiveSubmodules>
111         <trackingSubmodules>false</trackingSubmodules>
112         <reference/>
113         <timeout>10</timeout>
114       </hudson.plugins.git.extensions.impl.SubmoduleOption>
115       <hudson.plugins.git.extensions.impl.WipeWorkspace/>
116     </extensions>
117   </scm>
118   <triggers class="vector">
119     <com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.GerritTrigger>
120       <spec/>
121       <gerritProjects>
122         <com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.data.GerritProject>
123           <compareType>ANT</compareType>
124           <pattern>releng/ciman</pattern>
125           <branches>
126             <com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.data.Branch>
127               <compareType>ANT</compareType>
128               <pattern>**/master</pattern>
129             </com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.data.Branch>
130           </branches>
131           <filePaths>
132             <com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.data.FilePath>
133               <compareType>ANT</compareType>
134               <pattern>**/*.sh</pattern>
135             </com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.data.FilePath>
136             <com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.data.FilePath>
137               <compareType>ANT</compareType>
138               <pattern>**/*.yaml</pattern>
139             </com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.data.FilePath>
140           </filePaths>
141           <disableStrictForbiddenFileVerification>false</disableStrictForbiddenFileVerification>
142         </com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.data.GerritProject>
143       </gerritProjects>
144       <skipVote>
145         <onSuccessful>false</onSuccessful>
146         <onFailed>false</onFailed>
147         <onUnstable>false</onUnstable>
148         <onNotBuilt>false</onNotBuilt>
149       </skipVote>
150       <silentMode>false</silentMode>
151       <silentStartMode>false</silentStartMode>
152       <escapeQuotes>true</escapeQuotes>
153       <noNameAndEmailParameters>false</noNameAndEmailParameters>
154       <readableMessage>false</readableMessage>
155       <dependencyJobsNames/>
156       <notificationLevel/>
157       <dynamicTriggerConfiguration>False</dynamicTriggerConfiguration>
158       <triggerConfigURL/>
159       <allowTriggeringUnreviewedPatches>false</allowTriggeringUnreviewedPatches>
160       <triggerOnEvents>
161         <com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.events.PluginChangeMergedEvent/>
162         <com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.events.PluginCommentAddedContainsEvent>
163           <commentAddedCommentContains>remerge$</commentAddedCommentContains>
164         </com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.events.PluginCommentAddedContainsEvent>
165       </triggerOnEvents>
166       <buildStartMessage/>
167       <buildFailureMessage/>
168       <buildSuccessfulMessage/>
169       <buildUnstableMessage/>
170       <buildNotBuiltMessage/>
171       <buildUnsuccessfulFilepath/>
172       <customUrl/>
173       <serverName>test-server</serverName>
174     </com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.GerritTrigger>
175   </triggers>
176   <builders>
177     <org.jenkinsci.plugins.configfiles.builder.ConfigFileBuildStep plugin="config-file-provider">
178       <managedFiles>
179         <org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
180           <fileId>jjbini</fileId>
181           <targetLocation>$HOME/.config/jenkins_jobs/jenkins_jobs.ini</targetLocation>
182           <variable/>
183         </org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
184       </managedFiles>
185     </org.jenkinsci.plugins.configfiles.builder.ConfigFileBuildStep>
186     <hudson.tasks.Shell>
187       <command>#!/bin/bash
188 # SPDX-License-Identifier: EPL-1.0
189 ##############################################################################
190 # Copyright (c) 2017 The Linux Foundation and others.
191 #
192 # All rights reserved. This program and the accompanying materials
193 # are made available under the terms of the Eclipse Public License v1.0
194 # which accompanies this distribution, and is available at
195 # http://www.eclipse.org/legal/epl-v10.html
196 ##############################################################################
197 echo &quot;---&gt; jjb-install.sh&quot;
198
199 # Ensure we fail the job if any steps fail.
200 # DO NOT set -u as virtualenv's activate script has unbound variables
201 set -e -o pipefail
202
203 virtualenv &quot;/tmp/v/jjb&quot;
204 # shellcheck source=/tmp/v/jjb/bin/activate disable=SC1091
205 source &quot;/tmp/v/jjb/bin/activate&quot;
206 pip install --quiet --upgrade pip
207 pip install --quiet --upgrade pipdeptree
208 pip install --quiet --upgrade &quot;jenkins-job-builder==$JJB_VERSION&quot;
209
210 echo &quot;----&gt; Pip Dependency Tree&quot;
211 pipdeptree
212
213 #!/bin/bash
214 # SPDX-License-Identifier: EPL-1.0
215 ##############################################################################
216 # Copyright (c) 2017 The Linux Foundation and others.
217 #
218 # All rights reserved. This program and the accompanying materials
219 # are made available under the terms of the Eclipse Public License v1.0
220 # which accompanies this distribution, and is available at
221 # http://www.eclipse.org/legal/epl-v10.html
222 ##############################################################################
223 echo &quot;---&gt; jjb-merge-job.sh&quot;
224
225 # Ensure we fail the job if any steps fail.
226 set -eu -o pipefail
227
228 jenkins-jobs update --recursive --delete-old --workers 4 --exclude jjb-test jjb
229 </command>
230     </hudson.tasks.Shell>
231   </builders>
232   <publishers>
233     <org.jenkinsci.plugins.postbuildscript.PostBuildScript>
234       <buildSteps>
235         <hudson.tasks.Shell>
236           <command>#!/bin/bash
237 # SPDX-License-Identifier: EPL-1.0
238 ##############################################################################
239 # Copyright (c) 2017 The Linux Foundation and others.
240 #
241 # All rights reserved. This program and the accompanying materials
242 # are made available under the terms of the Eclipse Public License v1.0
243 # which accompanies this distribution, and is available at
244 # http://www.eclipse.org/legal/epl-v10.html
245 ##############################################################################
246 echo &quot;---&gt; sysstat.sh&quot;
247 set +e  # DON'T fail build if script fails.
248
249 OS=$(facter operatingsystem)
250 case &quot;$OS&quot; in
251     Ubuntu)
252         SYSSTAT_PATH=&quot;/var/log/sysstat&quot;
253
254         # Dont run the script when systat is not enabled by default
255         if ! grep --quiet 'ENABLED=&quot;true&quot;' &quot;/etc/default/sysstat&quot;; then
256             exit 0
257         fi
258     ;;
259     CentOS|RedHat)
260         SYSSTAT_PATH=&quot;/var/log/sa&quot;
261     ;;
262     *)
263         # nothing to do
264         exit 0
265     ;;
266 esac
267
268 SAR_DIR=&quot;$WORKSPACE/archives/sar-reports&quot;
269 mkdir -p &quot;$SAR_DIR&quot;
270 cp &quot;$SYSSTAT_PATH/&quot;* &quot;$_&quot;
271 # convert sar data to ascii format
272 while IFS=&quot;&quot; read -r s
273 do
274     [ -f &quot;$s&quot; ] &amp;&amp; LC_TIME=POSIX sar -A -f &quot;$s&quot; &gt; &quot;$SAR_DIR/sar${s//[!0-9]/}&quot;
275 done &lt; &lt;(find &quot;$SYSSTAT_PATH&quot; -name &quot;sa[0-9]*&quot; || true)
276
277 # DON'T fail build if script fails.
278 exit 0
279 </command>
280         </hudson.tasks.Shell>
281         <org.jenkinsci.plugins.configfiles.builder.ConfigFileBuildStep plugin="config-file-provider">
282           <managedFiles>
283             <org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
284               <fileId>jenkins-log-archives-settings</fileId>
285               <targetLocation/>
286               <variable>SETTINGS_FILE</variable>
287             </org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
288           </managedFiles>
289         </org.jenkinsci.plugins.configfiles.builder.ConfigFileBuildStep>
290         <EnvInjectBuilder>
291           <info>
292             <propertiesContent>SERVER_ID=logs</propertiesContent>
293           </info>
294         </EnvInjectBuilder>
295         <hudson.tasks.Shell>
296           <command>#!/bin/bash
297 # SPDX-License-Identifier: EPL-1.0
298 ##############################################################################
299 # Copyright (c) 2017 The Linux Foundation and others.
300 #
301 # All rights reserved. This program and the accompanying materials
302 # are made available under the terms of the Eclipse Public License v1.0
303 # which accompanies this distribution, and is available at
304 # http://www.eclipse.org/legal/epl-v10.html
305 ##############################################################################
306 echo &quot;---&gt; create-netrc.sh&quot;
307
308 # Ensure we fail the job if any steps fail.
309 set -eu -o pipefail
310
311 NEXUS_URL=&quot;${NEXUS_URL:-$NEXUSPROXY}&quot;
312 CREDENTIAL=$(xmlstarlet sel -N &quot;x=http://maven.apache.org/SETTINGS/1.0.0&quot; \
313     -t -m &quot;/x:settings/x:servers/x:server[x:id='${SERVER_ID}']&quot; \
314     -v x:username -o &quot;:&quot; -v x:password \
315     &quot;$SETTINGS_FILE&quot;)
316
317 machine=$(echo &quot;$NEXUS_URL&quot; | awk -F/ '{print $3}')
318 user=$(echo &quot;$CREDENTIAL&quot; | cut -f1 -d:)
319 pass=$(echo &quot;$CREDENTIAL&quot; | cut -f2 -d:)
320
321 echo &quot;machine $machine login $user password $pass&quot; &gt; ~/.netrc
322 </command>
323         </hudson.tasks.Shell>
324         <hudson.tasks.Shell>
325           <command>#!/bin/bash
326 # SPDX-License-Identifier: EPL-1.0
327 ##############################################################################
328 # Copyright (c) 2017 The Linux Foundation and others.
329 #
330 # All rights reserved. This program and the accompanying materials
331 # are made available under the terms of the Eclipse Public License v1.0
332 # which accompanies this distribution, and is available at
333 # http://www.eclipse.org/legal/epl-v10.html
334 ##############################################################################
335 echo &quot;---&gt; lftools-install.sh&quot;
336
337 # Ensure we fail the job if any steps fail.
338 # DO NOT set -u as virtualenv's activate script has unbound variables
339 set -e -o pipefail
340
341 virtualenv --quiet &quot;/tmp/v/lftools&quot;
342 # shellcheck source=/tmp/v/lftools/bin/activate disable=SC1091
343 source &quot;/tmp/v/lftools/bin/activate&quot;
344 pip install --quiet --upgrade pip
345 pip install --quiet --upgrade &quot;lftools&lt;1.0.0&quot;
346
347 # pipdeptree prints out a lot of information because lftools pulls in many
348 # dependencies. Let's only print it if we want to debug.
349 # echo &quot;----&gt; Pip Dependency Tree&quot;
350 # pip install --quiet --upgrade pipdeptree
351 # pipdeptree
352
353 #!/bin/bash
354 # SPDX-License-Identifier: EPL-1.0
355 ##############################################################################
356 # Copyright (c) 2017 The Linux Foundation and others.
357 #
358 # All rights reserved. This program and the accompanying materials
359 # are made available under the terms of the Eclipse Public License v1.0
360 # which accompanies this distribution, and is available at
361 # http://www.eclipse.org/legal/epl-v10.html
362 ##############################################################################
363 echo &quot;---&gt; logs-deploy.sh&quot;
364
365 # Ensure we fail the job if any steps fail.
366 set -eu -o pipefail
367
368 set -x  # Trace commands for this script to make debugging easier.
369
370 ARCHIVE_ARTIFACTS=&quot;${ARCHIVE_ARTIFACTS:-}&quot;
371 LOGS_SERVER=&quot;${LOGS_SERVER:-None}&quot;
372
373 if [ &quot;${LOGS_SERVER}&quot; == 'None' ]
374 then
375     set +x # Disable trace since we no longer need it
376
377     echo &quot;WARNING: Logging server not set&quot;
378 else
379     NEXUS_URL=&quot;${NEXUS_URL:-$NEXUSPROXY}&quot;
380     NEXUS_PATH=&quot;${SILO}/${JENKINS_HOSTNAME}/${JOB_NAME}/${BUILD_NUMBER}&quot;
381     BUILD_URL=&quot;${BUILD_URL}&quot;
382
383     lftools deploy archives -p &quot;$ARCHIVE_ARTIFACTS&quot; &quot;$NEXUS_URL&quot; &quot;$NEXUS_PATH&quot; &quot;$WORKSPACE&quot;
384     lftools deploy logs &quot;$NEXUS_URL&quot; &quot;$NEXUS_PATH&quot; &quot;$BUILD_URL&quot;
385
386     set +x  # Disable trace since we no longer need it.
387
388     echo &quot;Build logs: &lt;a href=\&quot;$LOGS_SERVER/$NEXUS_PATH\&quot;&gt;$LOGS_SERVER/$NEXUS_PATH&lt;/a&gt;&quot;
389 fi
390 </command>
391         </hudson.tasks.Shell>
392         <hudson.tasks.Shell>
393           <command>#!/bin/bash
394 # SPDX-License-Identifier: EPL-1.0
395 ##############################################################################
396 # Copyright (c) 2017 The Linux Foundation and others.
397 #
398 # All rights reserved. This program and the accompanying materials
399 # are made available under the terms of the Eclipse Public License v1.0
400 # which accompanies this distribution, and is available at
401 # http://www.eclipse.org/legal/epl-v10.html
402 ##############################################################################
403
404 # Clear log credential files
405 rm &quot;$SETTINGS_FILE&quot;
406 rm ~/.netrc
407 </command>
408         </hudson.tasks.Shell>
409         <hudson.plugins.descriptionsetter.DescriptionSetterBuilder>
410           <regexp>^Build logs: .*</regexp>
411         </hudson.plugins.descriptionsetter.DescriptionSetterBuilder>
412       </buildSteps>
413       <scriptOnlyIfSuccess>false</scriptOnlyIfSuccess>
414       <scriptOnlyIfFailure>false</scriptOnlyIfFailure>
415       <markBuildUnstable>false</markBuildUnstable>
416     </org.jenkinsci.plugins.postbuildscript.PostBuildScript>
417     <hudson.plugins.ws__cleanup.WsCleanup plugin="ws-cleanup">
418       <patterns>
419         <hudson.plugins.ws__cleanup.Pattern>
420           <pattern>**/*.jenkins-trigger</pattern>
421           <type>EXCLUDE</type>
422         </hudson.plugins.ws__cleanup.Pattern>
423       </patterns>
424       <deleteDirs>false</deleteDirs>
425       <cleanupMatrixParent>false</cleanupMatrixParent>
426       <externalDelete/>
427       <cleanWhenSuccess>true</cleanWhenSuccess>
428       <cleanWhenUnstable>true</cleanWhenUnstable>
429       <cleanWhenFailure>true</cleanWhenFailure>
430       <cleanWhenNotBuilt>true</cleanWhenNotBuilt>
431       <cleanWhenAborted>true</cleanWhenAborted>
432       <notFailBuild>true</notFailBuild>
433     </hudson.plugins.ws__cleanup.WsCleanup>
434   </publishers>
435   <buildWrappers>
436     <com.michelin.cio.hudson.plugins.maskpasswords.MaskPasswordsBuildWrapper/>
437     <hudson.plugins.build__timeout.BuildTimeoutWrapper>
438       <timeoutMinutes>10</timeoutMinutes>
439       <timeoutEnvVar>BUILD_TIMEOUT</timeoutEnvVar>
440       <failBuild>true</failBuild>
441       <writingDescription>false</writingDescription>
442       <timeoutPercentage>0</timeoutPercentage>
443       <timeoutMinutesElasticDefault>3</timeoutMinutesElasticDefault>
444       <timeoutType>absolute</timeoutType>
445     </hudson.plugins.build__timeout.BuildTimeoutWrapper>
446     <hudson.plugins.timestamper.TimestamperBuildWrapper/>
447     <com.cloudbees.jenkins.plugins.sshagent.SSHAgentBuildWrapper>
448       <user>test-credential</user>
449     </com.cloudbees.jenkins.plugins.sshagent.SSHAgentBuildWrapper>
450     <jenkins.plugins.openstack.compute.JCloudsOneOffSlave/>
451   </buildWrappers>
452 </project>