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