568bdf4034f7be242e26686cd4034ef76b03d0eb
[releng/global-jjb.git] / .jjb-test / expected-xml / gerrit-maven-maven-release-master
1 <?xml version="1.0" encoding="utf-8"?>
2 <project>
3   <jdk>openjdk8</jdk>
4   <actions/>
5   <description>&lt;!-- Managed by Jenkins Job Builder --&gt;</description>
6   <keepDependencies>false</keepDependencies>
7   <blockBuildWhenDownstreamBuilding>false</blockBuildWhenDownstreamBuilding>
8   <blockBuildWhenUpstreamBuilding>false</blockBuildWhenUpstreamBuilding>
9   <concurrentBuild>false</concurrentBuild>
10   <assignedNode>build-vm</assignedNode>
11   <canRoam>false</canRoam>
12   <properties>
13     <jenkins.model.BuildDiscarderProperty>
14       <strategy class="hudson.tasks.LogRotator">
15         <daysToKeep>30</daysToKeep>
16         <numToKeep>-1</numToKeep>
17         <artifactDaysToKeep>-1</artifactDaysToKeep>
18         <artifactNumToKeep>0</artifactNumToKeep>
19       </strategy>
20     </jenkins.model.BuildDiscarderProperty>
21     <hudson.model.ParametersDefinitionProperty>
22       <parameterDefinitions>
23         <hudson.model.StringParameterDefinition>
24           <name>PROJECT</name>
25           <description>Parameter to identify a Gerrit project. This is typically the
26 project repo path as exists in Gerrit.
27 For example: ofextensions/circuitsw
28 </description>
29           <defaultValue>releng/ciman</defaultValue>
30         </hudson.model.StringParameterDefinition>
31         <hudson.model.StringParameterDefinition>
32           <name>STREAM</name>
33           <description>Stream is often set to the same name as 'branch' but can
34 sometimes be used as a name representing a project's release code
35 name.
36 </description>
37           <defaultValue>master</defaultValue>
38         </hudson.model.StringParameterDefinition>
39         <hudson.model.StringParameterDefinition>
40           <name>GERRIT_PROJECT</name>
41           <description>Parameter to identify Gerrit project. This is typically the
42 project repo path as exists in Gerrit.
43 For example: ofextensions/circuitsw
44
45 Note that Gerrit will override this parameter automatically if a
46 job is triggered by Gerrit.
47 </description>
48           <defaultValue>releng/ciman</defaultValue>
49         </hudson.model.StringParameterDefinition>
50         <hudson.model.StringParameterDefinition>
51           <name>GERRIT_BRANCH</name>
52           <description>Parameter to identify a Gerrit branch.
53
54 Note that Gerrit will override this parameter automatically if a
55 job is triggered by Gerrit.
56 </description>
57           <defaultValue>master</defaultValue>
58         </hudson.model.StringParameterDefinition>
59         <hudson.model.StringParameterDefinition>
60           <name>GERRIT_REFSPEC</name>
61           <description>Parameter to identify a refspec when pulling from Gerrit.
62
63 Note that Gerrit will override this parameter automatically if a
64 job is triggered by Gerrit.
65 </description>
66           <defaultValue>refs/heads/master</defaultValue>
67         </hudson.model.StringParameterDefinition>
68         <hudson.model.StringParameterDefinition>
69           <name>LFTOOLS_VERSION</name>
70           <description>Version of lftools to install. Can be a specific version like
71 '0.6.0' or a PEP-440 definition.
72 https://www.python.org/dev/peps/pep-0440/
73 For example '&lt;1.0.0' or '&gt;=1.0.0,&lt;2.0.0'.
74 </description>
75           <defaultValue>&lt;1.0.0</defaultValue>
76         </hudson.model.StringParameterDefinition>
77         <hudson.model.StringParameterDefinition>
78           <name>M2_HOME</name>
79           <description>Maven selector to be used by shell scripts</description>
80           <defaultValue>/w/tools/hudson.tasks.Maven_MavenInstallation/mvn33</defaultValue>
81         </hudson.model.StringParameterDefinition>
82         <hudson.model.StringParameterDefinition>
83           <name>MAVEN_OPTS</name>
84           <description>Maven Java opts. Example: -Xmx1024m -XX:MaxPermSize=256m
85 </description>
86           <defaultValue/>
87         </hudson.model.StringParameterDefinition>
88         <hudson.model.StringParameterDefinition>
89           <name>MAVEN_PARAMS</name>
90           <description>Maven parameters to pass to the mvn command.
91 </description>
92           <defaultValue/>
93         </hudson.model.StringParameterDefinition>
94         <hudson.model.StringParameterDefinition>
95           <name>MVN</name>
96           <description>Maven selector to be used by shell scripts</description>
97           <defaultValue>/w/tools/hudson.tasks.Maven_MavenInstallation/mvn33/bin/mvn</defaultValue>
98         </hudson.model.StringParameterDefinition>
99         <hudson.model.StringParameterDefinition>
100           <name>STAGING_PROFILE_ID</name>
101           <description>Nexus staging profile ID.
102 </description>
103           <defaultValue>uuddlrlrba</defaultValue>
104         </hudson.model.StringParameterDefinition>
105         <hudson.model.StringParameterDefinition>
106           <name>ARCHIVE_ARTIFACTS</name>
107           <description>Artifacts to archive to the logs server.</description>
108           <defaultValue/>
109         </hudson.model.StringParameterDefinition>
110       </parameterDefinitions>
111     </hudson.model.ParametersDefinitionProperty>
112   </properties>
113   <scm class="hudson.plugins.git.GitSCM">
114     <configVersion>2</configVersion>
115     <userRemoteConfigs>
116       <hudson.plugins.git.UserRemoteConfig>
117         <name>origin</name>
118         <refspec>$GERRIT_REFSPEC</refspec>
119         <url>$GIT_URL/$PROJECT</url>
120         <credentialsId>test-credential</credentialsId>
121       </hudson.plugins.git.UserRemoteConfig>
122     </userRemoteConfigs>
123     <branches>
124       <hudson.plugins.git.BranchSpec>
125         <name>refs/heads/$GERRIT_BRANCH</name>
126       </hudson.plugins.git.BranchSpec>
127     </branches>
128     <excludedUsers/>
129     <buildChooser class="hudson.plugins.git.util.DefaultBuildChooser"/>
130     <doGenerateSubmoduleConfigurations>false</doGenerateSubmoduleConfigurations>
131     <authorOrCommitter>false</authorOrCommitter>
132     <wipeOutWorkspace>true</wipeOutWorkspace>
133     <pruneBranches>false</pruneBranches>
134     <remotePoll>false</remotePoll>
135     <gitTool>Default</gitTool>
136     <submoduleCfg class="list"/>
137     <relativeTargetDir/>
138     <reference/>
139     <gitConfigName/>
140     <gitConfigEmail/>
141     <skipTag>true</skipTag>
142     <scmName/>
143     <useShallowClone>false</useShallowClone>
144     <ignoreNotifyCommit>false</ignoreNotifyCommit>
145     <extensions>
146       <hudson.plugins.git.extensions.impl.SubmoduleOption>
147         <disableSubmodules>false</disableSubmodules>
148         <recursiveSubmodules>true</recursiveSubmodules>
149         <trackingSubmodules>false</trackingSubmodules>
150         <reference/>
151         <timeout>10</timeout>
152       </hudson.plugins.git.extensions.impl.SubmoduleOption>
153       <hudson.plugins.git.extensions.impl.WipeWorkspace/>
154     </extensions>
155   </scm>
156   <triggers class="vector">
157     <hudson.triggers.TimerTrigger>
158       <spec/>
159     </hudson.triggers.TimerTrigger>
160     <com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.GerritTrigger>
161       <spec/>
162       <gerritProjects>
163         <com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.data.GerritProject>
164           <compareType>ANT</compareType>
165           <pattern>releng/ciman</pattern>
166           <branches>
167             <com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.data.Branch>
168               <compareType>ANT</compareType>
169               <pattern>**/master</pattern>
170             </com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.data.Branch>
171           </branches>
172           <disableStrictForbiddenFileVerification>false</disableStrictForbiddenFileVerification>
173         </com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.data.GerritProject>
174       </gerritProjects>
175       <skipVote>
176         <onSuccessful>false</onSuccessful>
177         <onFailed>false</onFailed>
178         <onUnstable>false</onUnstable>
179         <onNotBuilt>false</onNotBuilt>
180       </skipVote>
181       <silentMode>false</silentMode>
182       <silentStartMode>false</silentStartMode>
183       <escapeQuotes>true</escapeQuotes>
184       <noNameAndEmailParameters>false</noNameAndEmailParameters>
185       <readableMessage>false</readableMessage>
186       <dependencyJobsNames/>
187       <notificationLevel/>
188       <dynamicTriggerConfiguration>False</dynamicTriggerConfiguration>
189       <triggerConfigURL/>
190       <allowTriggeringUnreviewedPatches>false</allowTriggeringUnreviewedPatches>
191       <triggerOnEvents>
192         <com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.events.PluginCommentAddedContainsEvent>
193           <commentAddedCommentContains>build release$</commentAddedCommentContains>
194         </com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.events.PluginCommentAddedContainsEvent>
195       </triggerOnEvents>
196       <buildStartMessage/>
197       <buildFailureMessage/>
198       <buildSuccessfulMessage/>
199       <buildUnstableMessage/>
200       <buildNotBuiltMessage/>
201       <buildUnsuccessfulFilepath/>
202       <customUrl/>
203       <serverName>test-server</serverName>
204     </com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.GerritTrigger>
205   </triggers>
206   <builders>
207     <hudson.tasks.Shell>
208       <command>mkdir -p $WORKSPACE/target/classes $WORKSPACE/jacoco/classes</command>
209     </hudson.tasks.Shell>
210     <hudson.tasks.Shell>
211       <command>echo &quot;quiet=on&quot; &gt; &quot;$HOME/.wgetrc&quot;</command>
212     </hudson.tasks.Shell>
213     <hudson.tasks.Maven>
214       <targets>--version</targets>
215       <properties/>
216       <mavenName>mvn33</mavenName>
217       <usePrivateRepository>false</usePrivateRepository>
218       <settings class="jenkins.mvn.DefaultSettingsProvider"/>
219       <globalSettings class="jenkins.mvn.DefaultGlobalSettingsProvider"/>
220     </hudson.tasks.Maven>
221     <hudson.tasks.Shell>
222       <command>rm &quot;$HOME/.wgetrc&quot;</command>
223     </hudson.tasks.Shell>
224     <org.jenkinsci.plugins.configfiles.builder.ConfigFileBuildStep plugin="config-file-provider">
225       <managedFiles>
226         <org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
227           <fileId>global-settings</fileId>
228           <targetLocation/>
229           <variable>GLOBAL_SETTINGS_FILE</variable>
230         </org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
231         <org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
232           <fileId>gerrit-maven-project-settings</fileId>
233           <targetLocation/>
234           <variable>SETTINGS_FILE</variable>
235         </org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
236       </managedFiles>
237     </org.jenkinsci.plugins.configfiles.builder.ConfigFileBuildStep>
238     <EnvInjectBuilder>
239       <info>
240         <propertiesContent>SERVER_ID=project-staging</propertiesContent>
241       </info>
242     </EnvInjectBuilder>
243     <hudson.tasks.Shell>
244       <command>#!/bin/bash
245 # SPDX-License-Identifier: EPL-1.0
246 ##############################################################################
247 # Copyright (c) 2017 The Linux Foundation and others.
248 #
249 # All rights reserved. This program and the accompanying materials
250 # are made available under the terms of the Eclipse Public License v1.0
251 # which accompanies this distribution, and is available at
252 # http://www.eclipse.org/legal/epl-v10.html
253 ##############################################################################
254 echo &quot;---&gt; create-netrc.sh&quot;
255
256 # Ensure we fail the job if any steps fail.
257 set -eu -o pipefail
258
259 NEXUS_URL=&quot;${NEXUSPROXY:-$NEXUS_URL}&quot;
260 CREDENTIAL=$(xmlstarlet sel -N &quot;x=http://maven.apache.org/SETTINGS/1.0.0&quot; \
261     -t -m &quot;/x:settings/x:servers/x:server[x:id='${SERVER_ID}']&quot; \
262     -v x:username -o &quot;:&quot; -v x:password \
263     &quot;$SETTINGS_FILE&quot;)
264
265 machine=$(echo &quot;$NEXUS_URL&quot; | awk -F/ '{print $3}')
266 user=$(echo &quot;$CREDENTIAL&quot; | cut -f1 -d:)
267 pass=$(echo &quot;$CREDENTIAL&quot; | cut -f2 -d:)
268
269 echo &quot;machine ${machine%:*} login $user password $pass&quot; &gt; ~/.netrc
270 </command>
271     </hudson.tasks.Shell>
272     <hudson.tasks.Shell>
273       <command>#!/bin/bash
274 # SPDX-License-Identifier: EPL-1.0
275 ##############################################################################
276 # Copyright (c) 2017 The Linux Foundation and others.
277 #
278 # All rights reserved. This program and the accompanying materials
279 # are made available under the terms of the Eclipse Public License v1.0
280 # which accompanies this distribution, and is available at
281 # http://www.eclipse.org/legal/epl-v10.html
282 ##############################################################################
283 echo &quot;---&gt; lftools-install.sh&quot;
284
285 # Script to install lftools via a version passed in via lf-infra-parameters
286 #
287 # Required parameters:
288 #
289 #     LFTOOLS_VERSION: Passed in via lf-infra-parameters configuration. Can be
290 #                      set to a strict version number like '1.2.3' or using
291 #                      PEP-440 definitions.
292 #
293 #                      Examples:
294 #                          &lt;1.0.0
295 #                          &gt;=1.0.0,&lt;2.0.0
296 #
297 # By default a released version of lftools should always be used.
298 # The purpose of the 2 variables below is so that lftools devs can test
299 # unreleased versions of lftools. There are 2 methods to install a dev version
300 # of lftools:
301 #
302 #     1) gerrit patch: Used to test a patch that has not yet been merged.
303 #                      To do this set something like this:
304 #                          LFTOOLS_MODE=gerrit
305 #                          LFTOOLS_REFSPEC=refs/changes/96/5296/7
306 #
307 #     2) git branch: Used to install an lftools version from a specific branch.
308 #                    To use this set the variables as follows:
309 #                          LFTOOLS_MODE=git
310 #                          LFTOOLS_REFSPEC=master
311 #
312 #     3) release : The intended use case and default setting.
313 #                  Set LFTOOLS_MODE=release, in this case LFTOOLS_REFSPEC is unused.
314
315 LFTOOLS_MODE=release  # release | git | gerrit
316 LFTOOLS_REFSPEC=master
317
318 # Ensure we fail the job if any steps fail.
319 # DO NOT set -u as virtualenv's activate script has unbound variables
320 set -e -o pipefail
321
322 virtualenv --quiet &quot;/tmp/v/lftools&quot;
323 # shellcheck source=/tmp/v/lftools/bin/activate disable=SC1091
324 source &quot;/tmp/v/lftools/bin/activate&quot;
325 pip install --quiet --upgrade pip
326
327 case $LFTOOLS_MODE in
328     gerrit)
329         git clone https://gerrit.linuxfoundation.org/infra/releng/lftools.git /tmp/lftools
330         pushd /tmp/lftools
331         git fetch origin &quot;$LFTOOLS_REFSPEC&quot;
332         git checkout FETCH_HEAD
333         pip install --quiet --upgrade -r requirements.txt
334         pip install --quiet --upgrade -e .
335         popd
336         ;;
337
338     git)
339         pip install --quiet --upgrade git+https://gerrit.linuxfoundation.org/infra/releng/lftools.git@&quot;$BRANCH&quot;
340         ;;
341
342     release)
343         if [[ $LFTOOLS_VERSION =~ ^[0-9] ]]; then
344             LFTOOLS_VERSION=&quot;==$LFTOOLS_VERSION&quot;
345         fi
346
347         pip install --quiet --upgrade &quot;lftools${LFTOOLS_VERSION}&quot;
348         ;;
349 esac
350
351 lftools --version
352
353 # pipdeptree prints out a lot of information because lftools pulls in many
354 # dependencies. Let's only print it if we want to debug.
355 # echo &quot;----&gt; Pip Dependency Tree&quot;
356 # pip install --quiet --upgrade pipdeptree
357 # pipdeptree
358
359 #!/bin/bash
360 # SPDX-License-Identifier: EPL-1.0
361 ##############################################################################
362 # Copyright (c) 2017 The Linux Foundation and others.
363 #
364 # All rights reserved. This program and the accompanying materials
365 # are made available under the terms of the Eclipse Public License v1.0
366 # which accompanies this distribution, and is available at
367 # http://www.eclipse.org/legal/epl-v10.html
368 ##############################################################################
369
370 # This file contains a list of variables that are generally useful in many
371 # scripts. It is meant to be sourced in other scripts so that the variables can
372 # be called.
373
374 MAVEN_OPTIONS=&quot;$(echo --show-version \
375     --batch-mode \
376     -Djenkins \
377     -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn \
378     -Dmaven.repo.local=/tmp/r \
379     -Dorg.ops4j.pax.url.mvn.localRepository=/tmp/r)&quot;
380 echo &quot;$MAVEN_OPTIONS&quot;
381
382 #!/bin/bash
383 # SPDX-License-Identifier: EPL-1.0
384 ##############################################################################
385 # Copyright (c) 2017 The Linux Foundation and others.
386 #
387 # All rights reserved. This program and the accompanying materials
388 # are made available under the terms of the Eclipse Public License v1.0
389 # which accompanies this distribution, and is available at
390 # http://www.eclipse.org/legal/epl-v10.html
391 ##############################################################################
392
393 # This script removes the -SNAPSHOT from a project to prepare it for release.
394
395 PATCH_DIR=&quot;$WORKSPACE/archives/patches&quot;
396 mkdir -p &quot;$PATCH_DIR&quot;
397
398 # Ensure we fail the job if any steps fail.
399 set -eu -o pipefail
400
401 echo &quot;$PROJECT&quot; &quot;$(git rev-parse --verify HEAD)&quot; | tee -a &quot;$PATCH_DIR/taglist.log&quot;
402
403 # Strip -SNAPSHOT from version to prepare release.
404 find . -name &quot;*.xml&quot; -print0 | xargs -0 sed -i 's/-SNAPSHOT//g'
405
406 git commit -am &quot;Release $PROJECT&quot;
407 git format-patch --stdout &quot;origin/$GERRIT_BRANCH&quot; &gt; &quot;$PATCH_DIR/${PROJECT//\//-}.patch&quot;
408 git bundle create &quot;$PATCH_DIR/${PROJECT//\//-}.bundle&quot; &quot;origin/${GERRIT_BRANCH}..HEAD&quot;
409
410 #!/bin/bash
411 # SPDX-License-Identifier: EPL-1.0
412 ##############################################################################
413 # Copyright (c) 2017 The Linux Foundation and others.
414 #
415 # All rights reserved. This program and the accompanying materials
416 # are made available under the terms of the Eclipse Public License v1.0
417 # which accompanies this distribution, and is available at
418 # http://www.eclipse.org/legal/epl-v10.html
419 ##############################################################################
420
421 # This script builds a Maven project and deploys it into a staging repo which
422 # can be used to deploy elsewhere later eg. Nexus staging / snapshot repos.
423
424 # DO NOT enable -u because $MAVEN_PARAMS and $MAVEN_OPTIONS could be unbound.
425 # Ensure we fail the job if any steps fail.
426 set -e -o pipefail
427 set +u
428
429 export MAVEN_OPTS
430
431 # Disable SC2086 because we want to allow word splitting for $MAVEN_* parameters.
432 # shellcheck disable=SC2086
433 $MVN clean deploy \
434     --global-settings &quot;$GLOBAL_SETTINGS_FILE&quot; \
435     --settings &quot;$SETTINGS_FILE&quot; \
436     -DaltDeploymentRepository=staging::default::file:&quot;$WORKSPACE&quot;/m2repo \
437     $MAVEN_PARAMS $MAVEN_OPTIONS
438
439 #!/bin/bash
440 # SPDX-License-Identifier: EPL-1.0
441 ##############################################################################
442 # Copyright (c) 2017 The Linux Foundation and others.
443 #
444 # All rights reserved. This program and the accompanying materials
445 # are made available under the terms of the Eclipse Public License v1.0
446 # which accompanies this distribution, and is available at
447 # http://www.eclipse.org/legal/epl-v10.html
448 ##############################################################################
449
450 # This script publishes artifacts to a staging repo in Nexus.
451 #
452 # $WORKSPACE/m2repo   :  Exists and used to deploy the staging repository.
453 # $NEXUS_URL          :  Jenkins global variable should be defined.
454 # $STAGING_PROFILE_ID :  Provided by a job parameter.
455
456 # Ensure we fail the job if any steps fail.
457 set -eu -o pipefail
458
459 TMP_FILE=&quot;$(mktemp)&quot;
460 lftools deploy nexus-stage &quot;$NEXUS_URL&quot; &quot;$STAGING_PROFILE_ID&quot; &quot;$WORKSPACE/m2repo&quot; | tee &quot;$TMP_FILE&quot;
461 staging_repo=$(sed -n -e 's/Staging repository \(.*\) created\./\1/p' &quot;$TMP_FILE&quot;)
462
463 # Store repo info to a file in archives
464 mkdir -p &quot;$WORKSPACE/archives&quot;
465 echo &quot;$staging_repo&quot; &gt; &quot;$WORKSPACE/archives/staging-repo.txt&quot;
466
467 # Cleanup
468 rm &quot;$TMP_FILE&quot;
469 </command>
470     </hudson.tasks.Shell>
471     <hudson.tasks.Shell>
472       <command>#!/bin/bash
473 set +e  # DO NOT cause build failure if any of the rm calls fail.
474
475 rm &quot;$GLOBAL_SETTINGS_FILE&quot; &quot;$SETTINGS_FILE&quot;
476
477 # In some cases we use the lf-provide-maven-settings macro to produce
478 # a &quot;$HOME/.netrc&quot; file containing credentials. Remove that file here
479 # too if it exists.
480 rm &quot;$HOME/.netrc&quot;
481
482 # DO NOT fail build if any of the above lines fail.
483 exit 0
484 </command>
485     </hudson.tasks.Shell>
486   </builders>
487   <publishers>
488     <org.jenkinsci.plugins.postbuildscript.PostBuildScript>
489       <buildSteps>
490         <hudson.tasks.Shell>
491           <command>#!/bin/bash
492 # SPDX-License-Identifier: EPL-1.0
493 ##############################################################################
494 # Copyright (c) 2017 The Linux Foundation and others.
495 #
496 # All rights reserved. This program and the accompanying materials
497 # are made available under the terms of the Eclipse Public License v1.0
498 # which accompanies this distribution, and is available at
499 # http://www.eclipse.org/legal/epl-v10.html
500 ##############################################################################
501 echo &quot;---&gt; sysstat.sh&quot;
502 set +e  # DON'T fail build if script fails.
503
504 OS=$(facter operatingsystem)
505 case &quot;$OS&quot; in
506     Ubuntu)
507         SYSSTAT_PATH=&quot;/var/log/sysstat&quot;
508
509         # Dont run the script when systat is not enabled by default
510         if ! grep --quiet 'ENABLED=&quot;true&quot;' &quot;/etc/default/sysstat&quot;; then
511             exit 0
512         fi
513     ;;
514     CentOS|RedHat)
515         SYSSTAT_PATH=&quot;/var/log/sa&quot;
516     ;;
517     *)
518         # nothing to do
519         exit 0
520     ;;
521 esac
522
523 SAR_DIR=&quot;$WORKSPACE/archives/sar-reports&quot;
524 mkdir -p &quot;$SAR_DIR&quot;
525 cp &quot;$SYSSTAT_PATH/&quot;* &quot;$_&quot;
526 # convert sar data to ascii format
527 while IFS=&quot;&quot; read -r sarfilenum
528 do
529     [ -f &quot;$sarfilenum&quot; ] &amp;&amp; LC_TIME=POSIX sar -A -f &quot;$sarfilenum&quot; &gt; &quot;$SAR_DIR/sar${sarfilenum//[!0-9]/}&quot;
530 done &lt; &lt;(find &quot;$SYSSTAT_PATH&quot; -name &quot;sa[0-9]*&quot; || true)
531
532 # DON'T fail build if script fails.
533 exit 0
534 </command>
535         </hudson.tasks.Shell>
536         <org.jenkinsci.plugins.configfiles.builder.ConfigFileBuildStep plugin="config-file-provider">
537           <managedFiles>
538             <org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
539               <fileId>jenkins-log-archives-settings</fileId>
540               <targetLocation/>
541               <variable>SETTINGS_FILE</variable>
542             </org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
543           </managedFiles>
544         </org.jenkinsci.plugins.configfiles.builder.ConfigFileBuildStep>
545         <EnvInjectBuilder>
546           <info>
547             <propertiesContent>SERVER_ID=logs</propertiesContent>
548           </info>
549         </EnvInjectBuilder>
550         <hudson.tasks.Shell>
551           <command>#!/bin/bash
552 # SPDX-License-Identifier: EPL-1.0
553 ##############################################################################
554 # Copyright (c) 2017 The Linux Foundation and others.
555 #
556 # All rights reserved. This program and the accompanying materials
557 # are made available under the terms of the Eclipse Public License v1.0
558 # which accompanies this distribution, and is available at
559 # http://www.eclipse.org/legal/epl-v10.html
560 ##############################################################################
561 echo &quot;---&gt; create-netrc.sh&quot;
562
563 # Ensure we fail the job if any steps fail.
564 set -eu -o pipefail
565
566 NEXUS_URL=&quot;${NEXUSPROXY:-$NEXUS_URL}&quot;
567 CREDENTIAL=$(xmlstarlet sel -N &quot;x=http://maven.apache.org/SETTINGS/1.0.0&quot; \
568     -t -m &quot;/x:settings/x:servers/x:server[x:id='${SERVER_ID}']&quot; \
569     -v x:username -o &quot;:&quot; -v x:password \
570     &quot;$SETTINGS_FILE&quot;)
571
572 machine=$(echo &quot;$NEXUS_URL&quot; | awk -F/ '{print $3}')
573 user=$(echo &quot;$CREDENTIAL&quot; | cut -f1 -d:)
574 pass=$(echo &quot;$CREDENTIAL&quot; | cut -f2 -d:)
575
576 echo &quot;machine ${machine%:*} login $user password $pass&quot; &gt; ~/.netrc
577 </command>
578         </hudson.tasks.Shell>
579         <hudson.tasks.Shell>
580           <command>#!/bin/bash
581 # SPDX-License-Identifier: EPL-1.0
582 ##############################################################################
583 # Copyright (c) 2017 The Linux Foundation and others.
584 #
585 # All rights reserved. This program and the accompanying materials
586 # are made available under the terms of the Eclipse Public License v1.0
587 # which accompanies this distribution, and is available at
588 # http://www.eclipse.org/legal/epl-v10.html
589 ##############################################################################
590 echo &quot;---&gt; lftools-install.sh&quot;
591
592 # Script to install lftools via a version passed in via lf-infra-parameters
593 #
594 # Required parameters:
595 #
596 #     LFTOOLS_VERSION: Passed in via lf-infra-parameters configuration. Can be
597 #                      set to a strict version number like '1.2.3' or using
598 #                      PEP-440 definitions.
599 #
600 #                      Examples:
601 #                          &lt;1.0.0
602 #                          &gt;=1.0.0,&lt;2.0.0
603 #
604 # By default a released version of lftools should always be used.
605 # The purpose of the 2 variables below is so that lftools devs can test
606 # unreleased versions of lftools. There are 2 methods to install a dev version
607 # of lftools:
608 #
609 #     1) gerrit patch: Used to test a patch that has not yet been merged.
610 #                      To do this set something like this:
611 #                          LFTOOLS_MODE=gerrit
612 #                          LFTOOLS_REFSPEC=refs/changes/96/5296/7
613 #
614 #     2) git branch: Used to install an lftools version from a specific branch.
615 #                    To use this set the variables as follows:
616 #                          LFTOOLS_MODE=git
617 #                          LFTOOLS_REFSPEC=master
618 #
619 #     3) release : The intended use case and default setting.
620 #                  Set LFTOOLS_MODE=release, in this case LFTOOLS_REFSPEC is unused.
621
622 LFTOOLS_MODE=release  # release | git | gerrit
623 LFTOOLS_REFSPEC=master
624
625 # Ensure we fail the job if any steps fail.
626 # DO NOT set -u as virtualenv's activate script has unbound variables
627 set -e -o pipefail
628
629 virtualenv --quiet &quot;/tmp/v/lftools&quot;
630 # shellcheck source=/tmp/v/lftools/bin/activate disable=SC1091
631 source &quot;/tmp/v/lftools/bin/activate&quot;
632 pip install --quiet --upgrade pip
633
634 case $LFTOOLS_MODE in
635     gerrit)
636         git clone https://gerrit.linuxfoundation.org/infra/releng/lftools.git /tmp/lftools
637         pushd /tmp/lftools
638         git fetch origin &quot;$LFTOOLS_REFSPEC&quot;
639         git checkout FETCH_HEAD
640         pip install --quiet --upgrade -r requirements.txt
641         pip install --quiet --upgrade -e .
642         popd
643         ;;
644
645     git)
646         pip install --quiet --upgrade git+https://gerrit.linuxfoundation.org/infra/releng/lftools.git@&quot;$BRANCH&quot;
647         ;;
648
649     release)
650         if [[ $LFTOOLS_VERSION =~ ^[0-9] ]]; then
651             LFTOOLS_VERSION=&quot;==$LFTOOLS_VERSION&quot;
652         fi
653
654         pip install --quiet --upgrade &quot;lftools${LFTOOLS_VERSION}&quot;
655         ;;
656 esac
657
658 lftools --version
659
660 # pipdeptree prints out a lot of information because lftools pulls in many
661 # dependencies. Let's only print it if we want to debug.
662 # echo &quot;----&gt; Pip Dependency Tree&quot;
663 # pip install --quiet --upgrade pipdeptree
664 # pipdeptree
665
666 #!/bin/bash
667 # SPDX-License-Identifier: EPL-1.0
668 ##############################################################################
669 # Copyright (c) 2017 The Linux Foundation and others.
670 #
671 # All rights reserved. This program and the accompanying materials
672 # are made available under the terms of the Eclipse Public License v1.0
673 # which accompanies this distribution, and is available at
674 # http://www.eclipse.org/legal/epl-v10.html
675 ##############################################################################
676 echo &quot;---&gt; logs-deploy.sh&quot;
677
678 # Ensure we fail the job if any steps fail.
679 set -eu -o pipefail
680
681 set -x  # Trace commands for this script to make debugging easier.
682
683 ARCHIVE_ARTIFACTS=&quot;${ARCHIVE_ARTIFACTS:-}&quot;
684 LOGS_SERVER=&quot;${LOGS_SERVER:-None}&quot;
685
686 if [ &quot;${LOGS_SERVER}&quot; == 'None' ]
687 then
688     set +x # Disable trace since we no longer need it
689
690     echo &quot;WARNING: Logging server not set&quot;
691 else
692     NEXUS_URL=&quot;${NEXUSPROXY:-$NEXUS_URL}&quot;
693     NEXUS_PATH=&quot;${SILO}/${JENKINS_HOSTNAME}/${JOB_NAME}/${BUILD_NUMBER}&quot;
694     BUILD_URL=&quot;${BUILD_URL}&quot;
695
696     lftools deploy archives -p &quot;$ARCHIVE_ARTIFACTS&quot; &quot;$NEXUS_URL&quot; &quot;$NEXUS_PATH&quot; &quot;$WORKSPACE&quot;
697     lftools deploy logs &quot;$NEXUS_URL&quot; &quot;$NEXUS_PATH&quot; &quot;$BUILD_URL&quot;
698
699     set +x  # Disable trace since we no longer need it.
700
701     echo &quot;Build logs: &lt;a href=\&quot;$LOGS_SERVER/$NEXUS_PATH\&quot;&gt;$LOGS_SERVER/$NEXUS_PATH&lt;/a&gt;&quot;
702 fi
703 </command>
704         </hudson.tasks.Shell>
705         <hudson.tasks.Shell>
706           <command>#!/bin/bash
707 # SPDX-License-Identifier: EPL-1.0
708 ##############################################################################
709 # Copyright (c) 2017 The Linux Foundation and others.
710 #
711 # All rights reserved. This program and the accompanying materials
712 # are made available under the terms of the Eclipse Public License v1.0
713 # which accompanies this distribution, and is available at
714 # http://www.eclipse.org/legal/epl-v10.html
715 ##############################################################################
716
717 # Clear log credential files
718 rm &quot;$SETTINGS_FILE&quot;
719 rm ~/.netrc
720 </command>
721         </hudson.tasks.Shell>
722         <hudson.plugins.descriptionsetter.DescriptionSetterBuilder>
723           <regexp>^Build logs: .*</regexp>
724         </hudson.plugins.descriptionsetter.DescriptionSetterBuilder>
725       </buildSteps>
726       <scriptOnlyIfSuccess>false</scriptOnlyIfSuccess>
727       <scriptOnlyIfFailure>false</scriptOnlyIfFailure>
728       <markBuildUnstable>false</markBuildUnstable>
729     </org.jenkinsci.plugins.postbuildscript.PostBuildScript>
730     <hudson.plugins.ws__cleanup.WsCleanup plugin="ws-cleanup">
731       <patterns>
732         <hudson.plugins.ws__cleanup.Pattern>
733           <pattern>**/*.jenkins-trigger</pattern>
734           <type>EXCLUDE</type>
735         </hudson.plugins.ws__cleanup.Pattern>
736       </patterns>
737       <deleteDirs>false</deleteDirs>
738       <cleanupMatrixParent>false</cleanupMatrixParent>
739       <externalDelete/>
740       <cleanWhenSuccess>true</cleanWhenSuccess>
741       <cleanWhenUnstable>true</cleanWhenUnstable>
742       <cleanWhenFailure>true</cleanWhenFailure>
743       <cleanWhenNotBuilt>true</cleanWhenNotBuilt>
744       <cleanWhenAborted>true</cleanWhenAborted>
745       <notFailBuild>true</notFailBuild>
746     </hudson.plugins.ws__cleanup.WsCleanup>
747   </publishers>
748   <buildWrappers>
749     <com.michelin.cio.hudson.plugins.maskpasswords.MaskPasswordsBuildWrapper/>
750     <hudson.plugins.build__timeout.BuildTimeoutWrapper>
751       <timeoutMinutes>30</timeoutMinutes>
752       <timeoutEnvVar>BUILD_TIMEOUT</timeoutEnvVar>
753       <failBuild>true</failBuild>
754       <writingDescription>false</writingDescription>
755       <timeoutPercentage>0</timeoutPercentage>
756       <timeoutMinutesElasticDefault>3</timeoutMinutesElasticDefault>
757       <timeoutType>absolute</timeoutType>
758     </hudson.plugins.build__timeout.BuildTimeoutWrapper>
759     <hudson.plugins.timestamper.TimestamperBuildWrapper/>
760     <com.cloudbees.jenkins.plugins.sshagent.SSHAgentBuildWrapper>
761       <user>test-credential</user>
762     </com.cloudbees.jenkins.plugins.sshagent.SSHAgentBuildWrapper>
763     <jenkins.plugins.openstack.compute.JCloudsOneOffSlave/>
764     <org.jenkinsci.plugins.configfiles.buildwrapper.ConfigFileBuildWrapper plugin="config-file-provider">
765       <managedFiles>
766         <org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
767           <fileId>npmrc</fileId>
768           <targetLocation>$HOME/.npmrc</targetLocation>
769           <variable/>
770         </org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
771       </managedFiles>
772     </org.jenkinsci.plugins.configfiles.buildwrapper.ConfigFileBuildWrapper>
773   </buildWrappers>
774 </project>