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