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