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