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