9e899d3c81affecf8dce9963da9554b3ba61224d
[releng/global-jjb.git] / .jjb-test / expected-xml / github-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     <com.coravy.hudson.plugins.github.GithubProjectProperty plugin="github">
13       <projectUrl>https://github.com/example-org/releng/ciman</projectUrl>
14       <displayName/>
15     </com.coravy.hudson.plugins.github.GithubProjectProperty>
16     <hudson.model.ParametersDefinitionProperty>
17       <parameterDefinitions>
18         <hudson.model.StringParameterDefinition>
19           <name>PROJECT</name>
20           <description>Parameter to identify a Gerrit project. This is typically the
21 project repo path as exists in Gerrit.
22 For example: ofextensions/circuitsw
23 </description>
24           <defaultValue>releng/ciman</defaultValue>
25         </hudson.model.StringParameterDefinition>
26         <hudson.model.StringParameterDefinition>
27           <name>STREAM</name>
28           <description>Stream is often set to the same name as 'branch' but can
29 sometimes be used as a name representing a project's release code
30 name.
31 </description>
32           <defaultValue>master</defaultValue>
33         </hudson.model.StringParameterDefinition>
34         <hudson.model.StringParameterDefinition>
35           <name>GERRIT_PROJECT</name>
36           <description>Parameter to identify Gerrit project. This is typically the
37 project repo path as exists in Gerrit.
38 For example: ofextensions/circuitsw
39
40 Note that Gerrit will override this parameter automatically if a
41 job is triggered by Gerrit.
42 </description>
43           <defaultValue>releng/ciman</defaultValue>
44         </hudson.model.StringParameterDefinition>
45         <hudson.model.StringParameterDefinition>
46           <name>GERRIT_BRANCH</name>
47           <description>Parameter to identify a Gerrit branch.
48
49 Note that Gerrit will override this parameter automatically if a
50 job is triggered by Gerrit.
51 </description>
52           <defaultValue>master</defaultValue>
53         </hudson.model.StringParameterDefinition>
54         <hudson.model.StringParameterDefinition>
55           <name>GERRIT_REFSPEC</name>
56           <description>Parameter to identify a refspec when pulling from Gerrit.
57
58 Note that Gerrit will override this parameter automatically if a
59 job is triggered by Gerrit.
60 </description>
61           <defaultValue>refs/heads/master</defaultValue>
62         </hudson.model.StringParameterDefinition>
63         <hudson.model.StringParameterDefinition>
64           <name>LFTOOLS_VERSION</name>
65           <description>Version of lftools to install. Can be a specific version like
66 '0.6.0' or a PEP-440 definition.
67 https://www.python.org/dev/peps/pep-0440/
68 For example '&lt;1.0.0' or '&gt;=1.0.0,&lt;2.0.0'.
69 </description>
70           <defaultValue>&lt;1.0.0</defaultValue>
71         </hudson.model.StringParameterDefinition>
72         <hudson.model.StringParameterDefinition>
73           <name>JJB_VERSION</name>
74           <description>Jenkins Job Builder version to download and install.</description>
75           <defaultValue>1.6.2</defaultValue>
76         </hudson.model.StringParameterDefinition>
77       </parameterDefinitions>
78     </hudson.model.ParametersDefinitionProperty>
79   </properties>
80   <scm class="hudson.plugins.git.GitSCM">
81     <configVersion>2</configVersion>
82     <userRemoteConfigs>
83       <hudson.plugins.git.UserRemoteConfig>
84         <name>origin</name>
85         <refspec/>
86         <url>git@github.com:example-org/releng/ciman</url>
87         <credentialsId>test-credential</credentialsId>
88       </hudson.plugins.git.UserRemoteConfig>
89     </userRemoteConfigs>
90     <branches>
91       <hudson.plugins.git.BranchSpec>
92         <name>refs/heads/master</name>
93       </hudson.plugins.git.BranchSpec>
94     </branches>
95     <doGenerateSubmoduleConfigurations>false</doGenerateSubmoduleConfigurations>
96     <remotePoll>false</remotePoll>
97     <gitTool>Default</gitTool>
98     <submoduleCfg class="list"/>
99     <reference/>
100     <gitConfigName/>
101     <gitConfigEmail/>
102     <extensions>
103       <hudson.plugins.git.extensions.impl.BuildChooserSetting>
104         <buildChooser class="hudson.plugins.git.util.DefaultBuildChooser"/>
105       </hudson.plugins.git.extensions.impl.BuildChooserSetting>
106       <hudson.plugins.git.extensions.impl.SubmoduleOption>
107         <disableSubmodules>false</disableSubmodules>
108         <recursiveSubmodules>true</recursiveSubmodules>
109         <trackingSubmodules>false</trackingSubmodules>
110         <parentCredentials>false</parentCredentials>
111         <reference/>
112         <timeout>10</timeout>
113       </hudson.plugins.git.extensions.impl.SubmoduleOption>
114       <hudson.plugins.git.extensions.impl.WipeWorkspace/>
115     </extensions>
116   </scm>
117   <triggers class="vector">
118     <com.cloudbees.jenkins.GitHubPushTrigger>
119       <spec/>
120     </com.cloudbees.jenkins.GitHubPushTrigger>
121     <hudson.triggers.SCMTrigger>
122       <spec/>
123       <ignorePostCommitHooks>false</ignorePostCommitHooks>
124     </hudson.triggers.SCMTrigger>
125     <org.jenkinsci.plugins.ghprb.GhprbTrigger>
126       <spec/>
127       <adminlist>tykeal</adminlist>
128       <allowMembersOfWhitelistedOrgsAsAdmin>false</allowMembersOfWhitelistedOrgsAsAdmin>
129       <whitelist>jpwku
130 tykeal
131 zxiiro</whitelist>
132       <orgslist>example-org</orgslist>
133       <whiteListLabels/>
134       <blackListLabels/>
135       <cron/>
136       <triggerPhrase>^remerge$</triggerPhrase>
137       <skipBuildPhrase/>
138       <onlyTriggerPhrase>true</onlyTriggerPhrase>
139       <useGitHubHooks>true</useGitHubHooks>
140       <permitAll>false</permitAll>
141       <autoCloseFailedPullRequests>false</autoCloseFailedPullRequests>
142       <extensions>
143         <org.jenkinsci.plugins.ghprb.extensions.status.GhprbSimpleStatus>
144           <commitStatusContext>JJB Merge</commitStatusContext>
145         </org.jenkinsci.plugins.ghprb.extensions.status.GhprbSimpleStatus>
146       </extensions>
147     </org.jenkinsci.plugins.ghprb.GhprbTrigger>
148   </triggers>
149   <builders>
150     <org.jenkinsci.plugins.configfiles.builder.ConfigFileBuildStep plugin="config-file-provider">
151       <managedFiles>
152         <org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
153           <fileId>jjbini</fileId>
154           <targetLocation>$HOME/.config/jenkins_jobs/jenkins_jobs.ini</targetLocation>
155           <variable/>
156         </org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
157       </managedFiles>
158     </org.jenkinsci.plugins.configfiles.builder.ConfigFileBuildStep>
159     <hudson.tasks.Shell>
160       <command>#!/bin/bash
161 # SPDX-License-Identifier: EPL-1.0
162 ##############################################################################
163 # Copyright (c) 2017 The Linux Foundation and others.
164 #
165 # All rights reserved. This program and the accompanying materials
166 # are made available under the terms of the Eclipse Public License v1.0
167 # which accompanies this distribution, and is available at
168 # http://www.eclipse.org/legal/epl-v10.html
169 ##############################################################################
170 echo &quot;---&gt; jjb-install.sh&quot;
171
172 # Ensure we fail the job if any steps fail.
173 # DO NOT set -u as virtualenv's activate script has unbound variables
174 set -e -o pipefail
175
176 virtualenv &quot;/tmp/v/jjb&quot;
177 # shellcheck source=/tmp/v/jjb/bin/activate disable=SC1091
178 source &quot;/tmp/v/jjb/bin/activate&quot;
179 pip install --quiet --upgrade pip
180 pip install --quiet --upgrade pipdeptree
181 pip install --quiet --upgrade &quot;jenkins-job-builder==$JJB_VERSION&quot;
182
183 echo &quot;----&gt; Pip Dependency Tree&quot;
184 pipdeptree
185
186 #!/bin/bash
187 # SPDX-License-Identifier: EPL-1.0
188 ##############################################################################
189 # Copyright (c) 2017 The Linux Foundation and others.
190 #
191 # All rights reserved. This program and the accompanying materials
192 # are made available under the terms of the Eclipse Public License v1.0
193 # which accompanies this distribution, and is available at
194 # http://www.eclipse.org/legal/epl-v10.html
195 ##############################################################################
196 echo &quot;---&gt; jjb-merge-job.sh&quot;
197
198 # Ensure we fail the job if any steps fail.
199 set -eu -o pipefail
200
201 jenkins-jobs update --recursive --delete-old --workers 4 jjb/
202 </command>
203     </hudson.tasks.Shell>
204   </builders>
205   <publishers>
206     <org.jenkinsci.plugins.postbuildscript.PostBuildScript>
207       <buildSteps>
208         <hudson.tasks.Shell>
209           <command>#!/bin/bash
210 # SPDX-License-Identifier: EPL-1.0
211 ##############################################################################
212 # Copyright (c) 2017 The Linux Foundation and others.
213 #
214 # All rights reserved. This program and the accompanying materials
215 # are made available under the terms of the Eclipse Public License v1.0
216 # which accompanies this distribution, and is available at
217 # http://www.eclipse.org/legal/epl-v10.html
218 ##############################################################################
219 echo &quot;---&gt; sysstat.sh&quot;
220 set +e  # DON'T fail build if script fails.
221
222 OS=$(facter operatingsystem)
223 case &quot;$OS&quot; in
224     Ubuntu)
225         SYSSTAT_PATH=&quot;/var/log/sysstat&quot;
226
227         # Dont run the script when systat is not enabled by default
228         if ! grep --quiet 'ENABLED=&quot;true&quot;' &quot;/etc/default/sysstat&quot;; then
229             exit 0
230         fi
231     ;;
232     CentOS|RedHat)
233         SYSSTAT_PATH=&quot;/var/log/sa&quot;
234     ;;
235     *)
236         # nothing to do
237         exit 0
238     ;;
239 esac
240
241 SAR_DIR=&quot;$WORKSPACE/archives/sar-reports&quot;
242 mkdir -p &quot;$SAR_DIR&quot;
243 cp &quot;$SYSSTAT_PATH/&quot;* &quot;$_&quot;
244 # convert sar data to ascii format
245 while IFS=&quot;&quot; read -r sarfilenum
246 do
247     [ -f &quot;$sarfilenum&quot; ] &amp;&amp; LC_TIME=POSIX sar -A -f &quot;$sarfilenum&quot; &gt; &quot;$SAR_DIR/sar${sarfilenum//[!0-9]/}&quot;
248 done &lt; &lt;(find &quot;$SYSSTAT_PATH&quot; -name &quot;sa[0-9]*&quot; || true)
249
250 # DON'T fail build if script fails.
251 exit 0
252 </command>
253         </hudson.tasks.Shell>
254         <org.jenkinsci.plugins.configfiles.builder.ConfigFileBuildStep plugin="config-file-provider">
255           <managedFiles>
256             <org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
257               <fileId>jenkins-log-archives-settings</fileId>
258               <targetLocation/>
259               <variable>SETTINGS_FILE</variable>
260             </org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
261           </managedFiles>
262         </org.jenkinsci.plugins.configfiles.builder.ConfigFileBuildStep>
263         <EnvInjectBuilder>
264           <info>
265             <propertiesContent>SERVER_ID=logs</propertiesContent>
266           </info>
267         </EnvInjectBuilder>
268         <hudson.tasks.Shell>
269           <command>#!/bin/bash
270 # SPDX-License-Identifier: EPL-1.0
271 ##############################################################################
272 # Copyright (c) 2017 The Linux Foundation and others.
273 #
274 # All rights reserved. This program and the accompanying materials
275 # are made available under the terms of the Eclipse Public License v1.0
276 # which accompanies this distribution, and is available at
277 # http://www.eclipse.org/legal/epl-v10.html
278 ##############################################################################
279 echo &quot;---&gt; create-netrc.sh&quot;
280
281 # Ensure we fail the job if any steps fail.
282 set -eu -o pipefail
283
284 NEXUS_URL=&quot;${NEXUSPROXY:-$NEXUS_URL}&quot;
285 CREDENTIAL=$(xmlstarlet sel -N &quot;x=http://maven.apache.org/SETTINGS/1.0.0&quot; \
286     -t -m &quot;/x:settings/x:servers/x:server[x:id='${SERVER_ID}']&quot; \
287     -v x:username -o &quot;:&quot; -v x:password \
288     &quot;$SETTINGS_FILE&quot;)
289
290 machine=$(echo &quot;$NEXUS_URL&quot; | awk -F/ '{print $3}')
291 user=$(echo &quot;$CREDENTIAL&quot; | cut -f1 -d:)
292 pass=$(echo &quot;$CREDENTIAL&quot; | cut -f2 -d:)
293
294 echo &quot;machine ${machine%:*} login $user password $pass&quot; &gt; ~/.netrc
295 </command>
296         </hudson.tasks.Shell>
297         <hudson.tasks.Shell>
298           <command>#!/bin/bash
299 # SPDX-License-Identifier: EPL-1.0
300 ##############################################################################
301 # Copyright (c) 2017 The Linux Foundation and others.
302 #
303 # All rights reserved. This program and the accompanying materials
304 # are made available under the terms of the Eclipse Public License v1.0
305 # which accompanies this distribution, and is available at
306 # http://www.eclipse.org/legal/epl-v10.html
307 ##############################################################################
308 echo &quot;---&gt; lftools-install.sh&quot;
309
310 # Script to install lftools via a version passed in via lf-infra-parameters
311 #
312 # Required parameters:
313 #
314 #     LFTOOLS_VERSION: Passed in via lf-infra-parameters configuration. Can be
315 #                      set to a strict version number like '1.2.3' or using
316 #                      PEP-440 definitions.
317 #
318 #                      Examples:
319 #                          &lt;1.0.0
320 #                          &gt;=1.0.0,&lt;2.0.0
321 #
322 # By default a released version of lftools should always be used.
323 # The purpose of the 2 variables below is so that lftools devs can test
324 # unreleased versions of lftools. There are 2 methods to install a dev version
325 # of lftools:
326 #
327 #     1) gerrit patch: Used to test a patch that has not yet been merged.
328 #                      To do this set something like this:
329 #                          LFTOOLS_MODE=gerrit
330 #                          LFTOOLS_REFSPEC=refs/changes/96/5296/7
331 #
332 #     2) git branch: Used to install an lftools version from a specific branch.
333 #                    To use this set the variables as follows:
334 #                          LFTOOLS_MODE=git
335 #                          LFTOOLS_REFSPEC=master
336 #
337 #     3) release : The intended use case and default setting.
338 #                  Set LFTOOLS_MODE=release, in this case LFTOOLS_REFSPEC is unused.
339
340 LFTOOLS_MODE=release  # release | git | gerrit
341 LFTOOLS_REFSPEC=master
342
343 # Ensure we fail the job if any steps fail.
344 # DO NOT set -u as virtualenv's activate script has unbound variables
345 set -e -o pipefail
346
347 virtualenv --quiet &quot;/tmp/v/lftools&quot;
348 # shellcheck source=/tmp/v/lftools/bin/activate disable=SC1091
349 source &quot;/tmp/v/lftools/bin/activate&quot;
350 pip install --quiet --upgrade pip
351
352 case $LFTOOLS_MODE in
353     gerrit)
354         git clone https://gerrit.linuxfoundation.org/infra/releng/lftools.git /tmp/lftools
355         pushd /tmp/lftools
356         git fetch origin &quot;$LFTOOLS_REFSPEC&quot;
357         git checkout FETCH_HEAD
358         pip install --quiet --upgrade -r requirements.txt
359         pip install --quiet --upgrade -e .
360         popd
361         ;;
362
363     git)
364         pip install --quiet --upgrade git+https://gerrit.linuxfoundation.org/infra/releng/lftools.git@&quot;$BRANCH&quot;
365         ;;
366
367     release)
368         if [[ $LFTOOLS_VERSION =~ ^[0-9] ]]; then
369             LFTOOLS_VERSION=&quot;==$LFTOOLS_VERSION&quot;
370         fi
371
372         pip install --quiet --upgrade &quot;lftools${LFTOOLS_VERSION}&quot;
373         ;;
374 esac
375
376 lftools --version
377
378 # pipdeptree prints out a lot of information because lftools pulls in many
379 # dependencies. Let's only print it if we want to debug.
380 # echo &quot;----&gt; Pip Dependency Tree&quot;
381 # pip install --quiet --upgrade pipdeptree
382 # pipdeptree
383
384 #!/bin/bash
385 # SPDX-License-Identifier: EPL-1.0
386 ##############################################################################
387 # Copyright (c) 2017 The Linux Foundation and others.
388 #
389 # All rights reserved. This program and the accompanying materials
390 # are made available under the terms of the Eclipse Public License v1.0
391 # which accompanies this distribution, and is available at
392 # http://www.eclipse.org/legal/epl-v10.html
393 ##############################################################################
394 echo &quot;---&gt; logs-deploy.sh&quot;
395
396 # Ensure we fail the job if any steps fail.
397 set -eu -o pipefail
398
399 set -x  # Trace commands for this script to make debugging easier.
400
401 ARCHIVE_ARTIFACTS=&quot;${ARCHIVE_ARTIFACTS:-}&quot;
402 LOGS_SERVER=&quot;${LOGS_SERVER:-None}&quot;
403
404 if [ &quot;${LOGS_SERVER}&quot; == 'None' ]
405 then
406     set +x # Disable trace since we no longer need it
407
408     echo &quot;WARNING: Logging server not set&quot;
409 else
410     NEXUS_URL=&quot;${NEXUSPROXY:-$NEXUS_URL}&quot;
411     NEXUS_PATH=&quot;${SILO}/${JENKINS_HOSTNAME}/${JOB_NAME}/${BUILD_NUMBER}&quot;
412     BUILD_URL=&quot;${BUILD_URL}&quot;
413
414     lftools deploy archives -p &quot;$ARCHIVE_ARTIFACTS&quot; &quot;$NEXUS_URL&quot; &quot;$NEXUS_PATH&quot; &quot;$WORKSPACE&quot;
415     lftools deploy logs &quot;$NEXUS_URL&quot; &quot;$NEXUS_PATH&quot; &quot;$BUILD_URL&quot;
416
417     set +x  # Disable trace since we no longer need it.
418
419     echo &quot;Build logs: &lt;a href=\&quot;$LOGS_SERVER/$NEXUS_PATH\&quot;&gt;$LOGS_SERVER/$NEXUS_PATH&lt;/a&gt;&quot;
420 fi
421 </command>
422         </hudson.tasks.Shell>
423         <hudson.tasks.Shell>
424           <command>#!/bin/bash
425 # SPDX-License-Identifier: EPL-1.0
426 ##############################################################################
427 # Copyright (c) 2017 The Linux Foundation and others.
428 #
429 # All rights reserved. This program and the accompanying materials
430 # are made available under the terms of the Eclipse Public License v1.0
431 # which accompanies this distribution, and is available at
432 # http://www.eclipse.org/legal/epl-v10.html
433 ##############################################################################
434
435 # Clear log credential files
436 rm &quot;$SETTINGS_FILE&quot;
437 rm ~/.netrc
438 </command>
439         </hudson.tasks.Shell>
440         <hudson.plugins.descriptionsetter.DescriptionSetterBuilder>
441           <regexp>^Build logs: .*</regexp>
442         </hudson.plugins.descriptionsetter.DescriptionSetterBuilder>
443       </buildSteps>
444       <scriptOnlyIfSuccess>false</scriptOnlyIfSuccess>
445       <scriptOnlyIfFailure>false</scriptOnlyIfFailure>
446       <markBuildUnstable>false</markBuildUnstable>
447     </org.jenkinsci.plugins.postbuildscript.PostBuildScript>
448     <hudson.plugins.ws__cleanup.WsCleanup plugin="ws-cleanup">
449       <patterns>
450         <hudson.plugins.ws__cleanup.Pattern>
451           <pattern>**/*.jenkins-trigger</pattern>
452           <type>EXCLUDE</type>
453         </hudson.plugins.ws__cleanup.Pattern>
454       </patterns>
455       <deleteDirs>false</deleteDirs>
456       <cleanupMatrixParent>false</cleanupMatrixParent>
457       <externalDelete/>
458       <cleanWhenSuccess>true</cleanWhenSuccess>
459       <cleanWhenUnstable>true</cleanWhenUnstable>
460       <cleanWhenFailure>true</cleanWhenFailure>
461       <cleanWhenNotBuilt>true</cleanWhenNotBuilt>
462       <cleanWhenAborted>true</cleanWhenAborted>
463       <notFailBuild>true</notFailBuild>
464     </hudson.plugins.ws__cleanup.WsCleanup>
465   </publishers>
466   <buildWrappers>
467     <com.michelin.cio.hudson.plugins.maskpasswords.MaskPasswordsBuildWrapper/>
468     <hudson.plugins.build__timeout.BuildTimeoutWrapper>
469       <timeoutMinutes>10</timeoutMinutes>
470       <timeoutEnvVar>BUILD_TIMEOUT</timeoutEnvVar>
471       <failBuild>true</failBuild>
472       <writingDescription>false</writingDescription>
473       <timeoutPercentage>0</timeoutPercentage>
474       <timeoutMinutesElasticDefault>3</timeoutMinutesElasticDefault>
475       <timeoutType>absolute</timeoutType>
476     </hudson.plugins.build__timeout.BuildTimeoutWrapper>
477     <hudson.plugins.timestamper.TimestamperBuildWrapper/>
478     <com.cloudbees.jenkins.plugins.sshagent.SSHAgentBuildWrapper>
479       <user>test-credential</user>
480     </com.cloudbees.jenkins.plugins.sshagent.SSHAgentBuildWrapper>
481     <jenkins.plugins.openstack.compute.JCloudsOneOffSlave/>
482     <org.jenkinsci.plugins.configfiles.buildwrapper.ConfigFileBuildWrapper plugin="config-file-provider">
483       <managedFiles>
484         <org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
485           <fileId>npmrc</fileId>
486           <targetLocation>$HOME/.npmrc</targetLocation>
487           <variable/>
488         </org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
489       </managedFiles>
490     </org.jenkinsci.plugins.configfiles.buildwrapper.ConfigFileBuildWrapper>
491   </buildWrappers>
492 </project>