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