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