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