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