Verify JJB when global-jjb is updated
[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/>
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             <com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.data.FilePath>
141               <compareType>ANT</compareType>
142               <pattern>**/global-jjb</pattern>
143             </com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.data.FilePath>
144           </filePaths>
145           <disableStrictForbiddenFileVerification>false</disableStrictForbiddenFileVerification>
146         </com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.data.GerritProject>
147       </gerritProjects>
148       <skipVote>
149         <onSuccessful>false</onSuccessful>
150         <onFailed>false</onFailed>
151         <onUnstable>false</onUnstable>
152         <onNotBuilt>false</onNotBuilt>
153       </skipVote>
154       <silentMode>false</silentMode>
155       <silentStartMode>false</silentStartMode>
156       <escapeQuotes>true</escapeQuotes>
157       <noNameAndEmailParameters>false</noNameAndEmailParameters>
158       <readableMessage>false</readableMessage>
159       <dependencyJobsNames/>
160       <notificationLevel/>
161       <dynamicTriggerConfiguration>False</dynamicTriggerConfiguration>
162       <triggerConfigURL/>
163       <allowTriggeringUnreviewedPatches>false</allowTriggeringUnreviewedPatches>
164       <triggerOnEvents>
165         <com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.events.PluginChangeMergedEvent/>
166         <com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.events.PluginCommentAddedContainsEvent>
167           <commentAddedCommentContains>remerge$</commentAddedCommentContains>
168         </com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.events.PluginCommentAddedContainsEvent>
169       </triggerOnEvents>
170       <buildStartMessage/>
171       <buildFailureMessage/>
172       <buildSuccessfulMessage/>
173       <buildUnstableMessage/>
174       <buildNotBuiltMessage/>
175       <buildUnsuccessfulFilepath/>
176       <customUrl/>
177       <serverName>test-server</serverName>
178     </com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.GerritTrigger>
179   </triggers>
180   <builders>
181     <org.jenkinsci.plugins.configfiles.builder.ConfigFileBuildStep plugin="config-file-provider">
182       <managedFiles>
183         <org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
184           <fileId>jjbini</fileId>
185           <targetLocation>$HOME/.config/jenkins_jobs/jenkins_jobs.ini</targetLocation>
186           <variable/>
187         </org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
188       </managedFiles>
189     </org.jenkinsci.plugins.configfiles.builder.ConfigFileBuildStep>
190     <hudson.tasks.Shell>
191       <command>#!/bin/bash
192 # SPDX-License-Identifier: EPL-1.0
193 ##############################################################################
194 # Copyright (c) 2017 The Linux Foundation and others.
195 #
196 # All rights reserved. This program and the accompanying materials
197 # are made available under the terms of the Eclipse Public License v1.0
198 # which accompanies this distribution, and is available at
199 # http://www.eclipse.org/legal/epl-v10.html
200 ##############################################################################
201 echo &quot;---&gt; jjb-install.sh&quot;
202
203 # Ensure we fail the job if any steps fail.
204 # DO NOT set -u as virtualenv's activate script has unbound variables
205 set -e -o pipefail
206
207 virtualenv &quot;/tmp/v/jjb&quot;
208 # shellcheck source=/tmp/v/jjb/bin/activate disable=SC1091
209 source &quot;/tmp/v/jjb/bin/activate&quot;
210 pip install --quiet --upgrade pip
211 pip install --quiet --upgrade pipdeptree
212 pip install --quiet --upgrade &quot;jenkins-job-builder==$JJB_VERSION&quot;
213
214 echo &quot;----&gt; Pip Dependency Tree&quot;
215 pipdeptree
216
217 #!/bin/bash
218 # SPDX-License-Identifier: EPL-1.0
219 ##############################################################################
220 # Copyright (c) 2017 The Linux Foundation and others.
221 #
222 # All rights reserved. This program and the accompanying materials
223 # are made available under the terms of the Eclipse Public License v1.0
224 # which accompanies this distribution, and is available at
225 # http://www.eclipse.org/legal/epl-v10.html
226 ##############################################################################
227 echo &quot;---&gt; jjb-merge-job.sh&quot;
228
229 # Ensure we fail the job if any steps fail.
230 set -eu -o pipefail
231
232 jenkins-jobs update --recursive --delete-old --workers 4 --exclude jjb-test jjb
233 </command>
234     </hudson.tasks.Shell>
235   </builders>
236   <publishers>
237     <org.jenkinsci.plugins.postbuildscript.PostBuildScript>
238       <buildSteps>
239         <hudson.tasks.Shell>
240           <command>#!/bin/bash
241 # SPDX-License-Identifier: EPL-1.0
242 ##############################################################################
243 # Copyright (c) 2017 The Linux Foundation and others.
244 #
245 # All rights reserved. This program and the accompanying materials
246 # are made available under the terms of the Eclipse Public License v1.0
247 # which accompanies this distribution, and is available at
248 # http://www.eclipse.org/legal/epl-v10.html
249 ##############################################################################
250 echo &quot;---&gt; sysstat.sh&quot;
251 set +e  # DON'T fail build if script fails.
252
253 OS=$(facter operatingsystem)
254 case &quot;$OS&quot; in
255     Ubuntu)
256         SYSSTAT_PATH=&quot;/var/log/sysstat&quot;
257
258         # Dont run the script when systat is not enabled by default
259         if ! grep --quiet 'ENABLED=&quot;true&quot;' &quot;/etc/default/sysstat&quot;; then
260             exit 0
261         fi
262     ;;
263     CentOS|RedHat)
264         SYSSTAT_PATH=&quot;/var/log/sa&quot;
265     ;;
266     *)
267         # nothing to do
268         exit 0
269     ;;
270 esac
271
272 SAR_DIR=&quot;$WORKSPACE/archives/sar-reports&quot;
273 mkdir -p &quot;$SAR_DIR&quot;
274 cp &quot;$SYSSTAT_PATH/&quot;* &quot;$_&quot;
275 # convert sar data to ascii format
276 while IFS=&quot;&quot; read -r s
277 do
278     [ -f &quot;$s&quot; ] &amp;&amp; LC_TIME=POSIX sar -A -f &quot;$s&quot; &gt; &quot;$SAR_DIR/sar${s//[!0-9]/}&quot;
279 done &lt; &lt;(find &quot;$SYSSTAT_PATH&quot; -name &quot;sa[0-9]*&quot; || true)
280
281 # DON'T fail build if script fails.
282 exit 0
283 </command>
284         </hudson.tasks.Shell>
285         <org.jenkinsci.plugins.configfiles.builder.ConfigFileBuildStep plugin="config-file-provider">
286           <managedFiles>
287             <org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
288               <fileId>jenkins-log-archives-settings</fileId>
289               <targetLocation/>
290               <variable>SETTINGS_FILE</variable>
291             </org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
292           </managedFiles>
293         </org.jenkinsci.plugins.configfiles.builder.ConfigFileBuildStep>
294         <EnvInjectBuilder>
295           <info>
296             <propertiesContent>SERVER_ID=logs</propertiesContent>
297           </info>
298         </EnvInjectBuilder>
299         <hudson.tasks.Shell>
300           <command>#!/bin/bash
301 # SPDX-License-Identifier: EPL-1.0
302 ##############################################################################
303 # Copyright (c) 2017 The Linux Foundation and others.
304 #
305 # All rights reserved. This program and the accompanying materials
306 # are made available under the terms of the Eclipse Public License v1.0
307 # which accompanies this distribution, and is available at
308 # http://www.eclipse.org/legal/epl-v10.html
309 ##############################################################################
310 echo &quot;---&gt; create-netrc.sh&quot;
311
312 # Ensure we fail the job if any steps fail.
313 set -eu -o pipefail
314
315 NEXUS_URL=&quot;${NEXUS_URL:-$NEXUSPROXY}&quot;
316 CREDENTIAL=$(xmlstarlet sel -N &quot;x=http://maven.apache.org/SETTINGS/1.0.0&quot; \
317     -t -m &quot;/x:settings/x:servers/x:server[x:id='${SERVER_ID}']&quot; \
318     -v x:username -o &quot;:&quot; -v x:password \
319     &quot;$SETTINGS_FILE&quot;)
320
321 machine=$(echo &quot;$NEXUS_URL&quot; | awk -F/ '{print $3}')
322 user=$(echo &quot;$CREDENTIAL&quot; | cut -f1 -d:)
323 pass=$(echo &quot;$CREDENTIAL&quot; | cut -f2 -d:)
324
325 echo &quot;machine $machine login $user password $pass&quot; &gt; ~/.netrc
326 </command>
327         </hudson.tasks.Shell>
328         <hudson.tasks.Shell>
329           <command>#!/bin/bash
330 # SPDX-License-Identifier: EPL-1.0
331 ##############################################################################
332 # Copyright (c) 2017 The Linux Foundation and others.
333 #
334 # All rights reserved. This program and the accompanying materials
335 # are made available under the terms of the Eclipse Public License v1.0
336 # which accompanies this distribution, and is available at
337 # http://www.eclipse.org/legal/epl-v10.html
338 ##############################################################################
339 echo &quot;---&gt; lftools-install.sh&quot;
340
341 # Ensure we fail the job if any steps fail.
342 # DO NOT set -u as virtualenv's activate script has unbound variables
343 set -e -o pipefail
344
345 virtualenv --quiet &quot;/tmp/v/lftools&quot;
346 # shellcheck source=/tmp/v/lftools/bin/activate disable=SC1091
347 source &quot;/tmp/v/lftools/bin/activate&quot;
348 pip install --quiet --upgrade pip
349 pip install --quiet --upgrade &quot;lftools&lt;1.0.0&quot;
350
351 # pipdeptree prints out a lot of information because lftools pulls in many
352 # dependencies. Let's only print it if we want to debug.
353 # echo &quot;----&gt; Pip Dependency Tree&quot;
354 # pip install --quiet --upgrade pipdeptree
355 # pipdeptree
356
357 #!/bin/bash
358 # SPDX-License-Identifier: EPL-1.0
359 ##############################################################################
360 # Copyright (c) 2017 The Linux Foundation and others.
361 #
362 # All rights reserved. This program and the accompanying materials
363 # are made available under the terms of the Eclipse Public License v1.0
364 # which accompanies this distribution, and is available at
365 # http://www.eclipse.org/legal/epl-v10.html
366 ##############################################################################
367 echo &quot;---&gt; logs-deploy.sh&quot;
368
369 # Ensure we fail the job if any steps fail.
370 set -eu -o pipefail
371
372 set -x  # Trace commands for this script to make debugging easier.
373
374 ARCHIVE_ARTIFACTS=&quot;${ARCHIVE_ARTIFACTS:-}&quot;
375 LOGS_SERVER=&quot;${LOGS_SERVER:-None}&quot;
376
377 if [ &quot;${LOGS_SERVER}&quot; == 'None' ]
378 then
379     set +x # Disable trace since we no longer need it
380
381     echo &quot;WARNING: Logging server not set&quot;
382 else
383     NEXUS_URL=&quot;${NEXUS_URL:-$NEXUSPROXY}&quot;
384     NEXUS_PATH=&quot;${SILO}/${JENKINS_HOSTNAME}/${JOB_NAME}/${BUILD_NUMBER}&quot;
385     BUILD_URL=&quot;${BUILD_URL}&quot;
386
387     lftools deploy archives -p &quot;$ARCHIVE_ARTIFACTS&quot; &quot;$NEXUS_URL&quot; &quot;$NEXUS_PATH&quot; &quot;$WORKSPACE&quot;
388     lftools deploy logs &quot;$NEXUS_URL&quot; &quot;$NEXUS_PATH&quot; &quot;$BUILD_URL&quot;
389
390     set +x  # Disable trace since we no longer need it.
391
392     echo &quot;Build logs: &lt;a href=\&quot;$LOGS_SERVER/$NEXUS_PATH\&quot;&gt;$LOGS_SERVER/$NEXUS_PATH&lt;/a&gt;&quot;
393 fi
394 </command>
395         </hudson.tasks.Shell>
396         <hudson.tasks.Shell>
397           <command>#!/bin/bash
398 # SPDX-License-Identifier: EPL-1.0
399 ##############################################################################
400 # Copyright (c) 2017 The Linux Foundation and others.
401 #
402 # All rights reserved. This program and the accompanying materials
403 # are made available under the terms of the Eclipse Public License v1.0
404 # which accompanies this distribution, and is available at
405 # http://www.eclipse.org/legal/epl-v10.html
406 ##############################################################################
407
408 # Clear log credential files
409 rm &quot;$SETTINGS_FILE&quot;
410 rm ~/.netrc
411 </command>
412         </hudson.tasks.Shell>
413         <hudson.plugins.descriptionsetter.DescriptionSetterBuilder>
414           <regexp>^Build logs: .*</regexp>
415         </hudson.plugins.descriptionsetter.DescriptionSetterBuilder>
416       </buildSteps>
417       <scriptOnlyIfSuccess>false</scriptOnlyIfSuccess>
418       <scriptOnlyIfFailure>false</scriptOnlyIfFailure>
419       <markBuildUnstable>false</markBuildUnstable>
420     </org.jenkinsci.plugins.postbuildscript.PostBuildScript>
421     <hudson.plugins.ws__cleanup.WsCleanup plugin="ws-cleanup">
422       <patterns>
423         <hudson.plugins.ws__cleanup.Pattern>
424           <pattern>**/*.jenkins-trigger</pattern>
425           <type>EXCLUDE</type>
426         </hudson.plugins.ws__cleanup.Pattern>
427       </patterns>
428       <deleteDirs>false</deleteDirs>
429       <cleanupMatrixParent>false</cleanupMatrixParent>
430       <externalDelete/>
431       <cleanWhenSuccess>true</cleanWhenSuccess>
432       <cleanWhenUnstable>true</cleanWhenUnstable>
433       <cleanWhenFailure>true</cleanWhenFailure>
434       <cleanWhenNotBuilt>true</cleanWhenNotBuilt>
435       <cleanWhenAborted>true</cleanWhenAborted>
436       <notFailBuild>true</notFailBuild>
437     </hudson.plugins.ws__cleanup.WsCleanup>
438   </publishers>
439   <buildWrappers>
440     <com.michelin.cio.hudson.plugins.maskpasswords.MaskPasswordsBuildWrapper/>
441     <hudson.plugins.build__timeout.BuildTimeoutWrapper>
442       <timeoutMinutes>10</timeoutMinutes>
443       <timeoutEnvVar>BUILD_TIMEOUT</timeoutEnvVar>
444       <failBuild>true</failBuild>
445       <writingDescription>false</writingDescription>
446       <timeoutPercentage>0</timeoutPercentage>
447       <timeoutMinutesElasticDefault>3</timeoutMinutesElasticDefault>
448       <timeoutType>absolute</timeoutType>
449     </hudson.plugins.build__timeout.BuildTimeoutWrapper>
450     <hudson.plugins.timestamper.TimestamperBuildWrapper/>
451     <com.cloudbees.jenkins.plugins.sshagent.SSHAgentBuildWrapper>
452       <user>test-credential</user>
453     </com.cloudbees.jenkins.plugins.sshagent.SSHAgentBuildWrapper>
454     <jenkins.plugins.openstack.compute.JCloudsOneOffSlave/>
455   </buildWrappers>
456 </project>