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