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