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