Add install goal to javadoc job
[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 install javadoc:aggregate \
293     -DskipTests=true \
294     -Dcheckstyle.skip=true \
295     -Dfindbugs.skip=true \
296     --global-settings &quot;$GLOBAL_SETTINGS_FILE&quot; \
297     --settings &quot;$SETTINGS_FILE&quot; \
298     $MAVEN_PARAMS $MAVEN_OPTIONS
299
300 mv &quot;$WORKSPACE/target/site/apidocs&quot; &quot;$JAVADOC_DIR&quot;
301
302 #!/bin/bash
303 # SPDX-License-Identifier: EPL-1.0
304 ##############################################################################
305 # Copyright (c) 2017 The Linux Foundation and others.
306 #
307 # All rights reserved. This program and the accompanying materials
308 # are made available under the terms of the Eclipse Public License v1.0
309 # which accompanies this distribution, and is available at
310 # http://www.eclipse.org/legal/epl-v10.html
311 ##############################################################################
312 echo &quot;---&gt; lftools-install.sh&quot;
313
314 # Script to install lftools via a version passed in via lf-infra-parameters
315 #
316 # Required parameters:
317 #
318 #     LFTOOLS_VERSION: Passed in via lf-infra-parameters configuration. Can be
319 #                      set to a strict version number like '1.2.3' or using
320 #                      PEP-440 definitions.
321 #
322 #                      Examples:
323 #                          &lt;1.0.0
324 #                          &gt;=1.0.0,&lt;2.0.0
325 #
326 # By default a released version of lftools should always be used.
327 # The purpose of the 2 variables below is so that lftools devs can test
328 # unreleased versions of lftools. There are 2 methods to install a dev version
329 # of lftools:
330 #
331 #     1) gerrit patch: Used to test a patch that has not yet been merged.
332 #                      To do this set something like this:
333 #                          LFTOOLS_MODE=gerrit
334 #                          LFTOOLS_REFSPEC=refs/changes/96/5296/7
335 #
336 #     2) git branch: Used to install an lftools version from a specific branch.
337 #                    To use this set the variables as follows:
338 #                          LFTOOLS_MODE=git
339 #                          LFTOOLS_REFSPEC=master
340 #
341 #     3) release : The intended use case and default setting.
342 #                  Set LFTOOLS_MODE=release, in this case LFTOOLS_REFSPEC is unused.
343
344 LFTOOLS_MODE=release  # release | git | gerrit
345 LFTOOLS_REFSPEC=master
346
347 # Ensure we fail the job if any steps fail.
348 # DO NOT set -u as virtualenv's activate script has unbound variables
349 set -e -o pipefail
350
351 virtualenv --quiet &quot;/tmp/v/lftools&quot;
352 # shellcheck source=/tmp/v/lftools/bin/activate disable=SC1091
353 source &quot;/tmp/v/lftools/bin/activate&quot;
354 pip install --quiet --upgrade pip
355
356 case $LFTOOLS_MODE in
357     gerrit)
358         git clone https://gerrit.linuxfoundation.org/infra/releng/lftools.git /tmp/lftools
359         pushd /tmp/lftools
360         git fetch origin &quot;$LFTOOLS_REFSPEC&quot;
361         git checkout FETCH_HEAD
362         pip install --quiet --upgrade -r requirements.txt
363         pip install --quiet --upgrade -e .
364         popd
365         ;;
366
367     git)
368         pip install --quiet --upgrade git+https://gerrit.linuxfoundation.org/infra/releng/lftools.git@&quot;$BRANCH&quot;
369         ;;
370
371     release)
372         if [[ $LFTOOLS_VERSION =~ ^[0-9] ]]; then
373             LFTOOLS_VERSION=&quot;==$LFTOOLS_VERSION&quot;
374         fi
375
376         pip install --quiet --upgrade &quot;lftools${LFTOOLS_VERSION}&quot;
377         ;;
378 esac
379
380 lftools --version
381
382 # pipdeptree prints out a lot of information because lftools pulls in many
383 # dependencies. Let's only print it if we want to debug.
384 # echo &quot;----&gt; Pip Dependency Tree&quot;
385 # pip install --quiet --upgrade pipdeptree
386 # pipdeptree
387
388 #!/bin/bash
389 # SPDX-License-Identifier: EPL-1.0
390 ##############################################################################
391 # Copyright (c) 2017 The Linux Foundation and others.
392 #
393 # All rights reserved. This program and the accompanying materials
394 # are made available under the terms of the Eclipse Public License v1.0
395 # which accompanies this distribution, and is available at
396 # http://www.eclipse.org/legal/epl-v10.html
397 ##############################################################################
398
399 # Publishes javadoc to a Maven project.
400
401 # DO NOT enable -u because $MAVEN_PARAMS and $MAVEN_OPTIONS could be unbound.
402 # Ensure we fail the job if any steps fail.
403 set -e -o pipefail
404 set +u
405
406 JAVADOC_DIR=&quot;$WORKSPACE/archives/javadoc&quot;
407
408 pushd &quot;$JAVADOC_DIR&quot;
409 zip -r &quot;$WORKSPACE/javadoc.zip&quot; .
410 popd
411
412 lftools deploy nexus-zip &quot;$NEXUS_URL&quot; &quot;javadoc&quot; &quot;$DEPLOY_PATH&quot; &quot;$WORKSPACE/javadoc.zip&quot;
413 </command>
414     </hudson.tasks.Shell>
415     <hudson.tasks.Shell>
416       <command>#!/bin/bash
417 set +e  # DO NOT cause build failure if any of the rm calls fail.
418
419 rm &quot;$GLOBAL_SETTINGS_FILE&quot; &quot;$SETTINGS_FILE&quot;
420
421 # In some cases we use the lf-provide-maven-settings macro to produce
422 # a &quot;$HOME/.netrc&quot; file containing credentials. Remove that file here
423 # too if it exists.
424 rm &quot;$HOME/.netrc&quot;
425
426 # DO NOT fail build if any of the above lines fail.
427 exit 0
428 </command>
429     </hudson.tasks.Shell>
430   </builders>
431   <publishers>
432     <org.jenkinsci.plugins.postbuildscript.PostBuildScript>
433       <buildSteps>
434         <hudson.tasks.Shell>
435           <command>#!/bin/bash
436 # SPDX-License-Identifier: EPL-1.0
437 ##############################################################################
438 # Copyright (c) 2017 The Linux Foundation and others.
439 #
440 # All rights reserved. This program and the accompanying materials
441 # are made available under the terms of the Eclipse Public License v1.0
442 # which accompanies this distribution, and is available at
443 # http://www.eclipse.org/legal/epl-v10.html
444 ##############################################################################
445 echo &quot;---&gt; sysstat.sh&quot;
446 set +e  # DON'T fail build if script fails.
447
448 OS=$(facter operatingsystem)
449 case &quot;$OS&quot; in
450     Ubuntu)
451         SYSSTAT_PATH=&quot;/var/log/sysstat&quot;
452
453         # Dont run the script when systat is not enabled by default
454         if ! grep --quiet 'ENABLED=&quot;true&quot;' &quot;/etc/default/sysstat&quot;; then
455             exit 0
456         fi
457     ;;
458     CentOS|RedHat)
459         SYSSTAT_PATH=&quot;/var/log/sa&quot;
460     ;;
461     *)
462         # nothing to do
463         exit 0
464     ;;
465 esac
466
467 SAR_DIR=&quot;$WORKSPACE/archives/sar-reports&quot;
468 mkdir -p &quot;$SAR_DIR&quot;
469 cp &quot;$SYSSTAT_PATH/&quot;* &quot;$_&quot;
470 # convert sar data to ascii format
471 while IFS=&quot;&quot; read -r s
472 do
473     [ -f &quot;$s&quot; ] &amp;&amp; LC_TIME=POSIX sar -A -f &quot;$s&quot; &gt; &quot;$SAR_DIR/sar${s//[!0-9]/}&quot;
474 done &lt; &lt;(find &quot;$SYSSTAT_PATH&quot; -name &quot;sa[0-9]*&quot; || true)
475
476 # DON'T fail build if script fails.
477 exit 0
478 </command>
479         </hudson.tasks.Shell>
480         <org.jenkinsci.plugins.configfiles.builder.ConfigFileBuildStep plugin="config-file-provider">
481           <managedFiles>
482             <org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
483               <fileId>jenkins-log-archives-settings</fileId>
484               <targetLocation/>
485               <variable>SETTINGS_FILE</variable>
486             </org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
487           </managedFiles>
488         </org.jenkinsci.plugins.configfiles.builder.ConfigFileBuildStep>
489         <EnvInjectBuilder>
490           <info>
491             <propertiesContent>SERVER_ID=logs</propertiesContent>
492           </info>
493         </EnvInjectBuilder>
494         <hudson.tasks.Shell>
495           <command>#!/bin/bash
496 # SPDX-License-Identifier: EPL-1.0
497 ##############################################################################
498 # Copyright (c) 2017 The Linux Foundation and others.
499 #
500 # All rights reserved. This program and the accompanying materials
501 # are made available under the terms of the Eclipse Public License v1.0
502 # which accompanies this distribution, and is available at
503 # http://www.eclipse.org/legal/epl-v10.html
504 ##############################################################################
505 echo &quot;---&gt; create-netrc.sh&quot;
506
507 # Ensure we fail the job if any steps fail.
508 set -eu -o pipefail
509
510 NEXUS_URL=&quot;${NEXUSPROXY:-$NEXUS_URL}&quot;
511 CREDENTIAL=$(xmlstarlet sel -N &quot;x=http://maven.apache.org/SETTINGS/1.0.0&quot; \
512     -t -m &quot;/x:settings/x:servers/x:server[x:id='${SERVER_ID}']&quot; \
513     -v x:username -o &quot;:&quot; -v x:password \
514     &quot;$SETTINGS_FILE&quot;)
515
516 machine=$(echo &quot;$NEXUS_URL&quot; | awk -F/ '{print $3}')
517 user=$(echo &quot;$CREDENTIAL&quot; | cut -f1 -d:)
518 pass=$(echo &quot;$CREDENTIAL&quot; | cut -f2 -d:)
519
520 echo &quot;machine ${machine%:*} login $user password $pass&quot; &gt; ~/.netrc
521 </command>
522         </hudson.tasks.Shell>
523         <hudson.tasks.Shell>
524           <command>#!/bin/bash
525 # SPDX-License-Identifier: EPL-1.0
526 ##############################################################################
527 # Copyright (c) 2017 The Linux Foundation and others.
528 #
529 # All rights reserved. This program and the accompanying materials
530 # are made available under the terms of the Eclipse Public License v1.0
531 # which accompanies this distribution, and is available at
532 # http://www.eclipse.org/legal/epl-v10.html
533 ##############################################################################
534 echo &quot;---&gt; lftools-install.sh&quot;
535
536 # Script to install lftools via a version passed in via lf-infra-parameters
537 #
538 # Required parameters:
539 #
540 #     LFTOOLS_VERSION: Passed in via lf-infra-parameters configuration. Can be
541 #                      set to a strict version number like '1.2.3' or using
542 #                      PEP-440 definitions.
543 #
544 #                      Examples:
545 #                          &lt;1.0.0
546 #                          &gt;=1.0.0,&lt;2.0.0
547 #
548 # By default a released version of lftools should always be used.
549 # The purpose of the 2 variables below is so that lftools devs can test
550 # unreleased versions of lftools. There are 2 methods to install a dev version
551 # of lftools:
552 #
553 #     1) gerrit patch: Used to test a patch that has not yet been merged.
554 #                      To do this set something like this:
555 #                          LFTOOLS_MODE=gerrit
556 #                          LFTOOLS_REFSPEC=refs/changes/96/5296/7
557 #
558 #     2) git branch: Used to install an lftools version from a specific branch.
559 #                    To use this set the variables as follows:
560 #                          LFTOOLS_MODE=git
561 #                          LFTOOLS_REFSPEC=master
562 #
563 #     3) release : The intended use case and default setting.
564 #                  Set LFTOOLS_MODE=release, in this case LFTOOLS_REFSPEC is unused.
565
566 LFTOOLS_MODE=release  # release | git | gerrit
567 LFTOOLS_REFSPEC=master
568
569 # Ensure we fail the job if any steps fail.
570 # DO NOT set -u as virtualenv's activate script has unbound variables
571 set -e -o pipefail
572
573 virtualenv --quiet &quot;/tmp/v/lftools&quot;
574 # shellcheck source=/tmp/v/lftools/bin/activate disable=SC1091
575 source &quot;/tmp/v/lftools/bin/activate&quot;
576 pip install --quiet --upgrade pip
577
578 case $LFTOOLS_MODE in
579     gerrit)
580         git clone https://gerrit.linuxfoundation.org/infra/releng/lftools.git /tmp/lftools
581         pushd /tmp/lftools
582         git fetch origin &quot;$LFTOOLS_REFSPEC&quot;
583         git checkout FETCH_HEAD
584         pip install --quiet --upgrade -r requirements.txt
585         pip install --quiet --upgrade -e .
586         popd
587         ;;
588
589     git)
590         pip install --quiet --upgrade git+https://gerrit.linuxfoundation.org/infra/releng/lftools.git@&quot;$BRANCH&quot;
591         ;;
592
593     release)
594         if [[ $LFTOOLS_VERSION =~ ^[0-9] ]]; then
595             LFTOOLS_VERSION=&quot;==$LFTOOLS_VERSION&quot;
596         fi
597
598         pip install --quiet --upgrade &quot;lftools${LFTOOLS_VERSION}&quot;
599         ;;
600 esac
601
602 lftools --version
603
604 # pipdeptree prints out a lot of information because lftools pulls in many
605 # dependencies. Let's only print it if we want to debug.
606 # echo &quot;----&gt; Pip Dependency Tree&quot;
607 # pip install --quiet --upgrade pipdeptree
608 # pipdeptree
609
610 #!/bin/bash
611 # SPDX-License-Identifier: EPL-1.0
612 ##############################################################################
613 # Copyright (c) 2017 The Linux Foundation and others.
614 #
615 # All rights reserved. This program and the accompanying materials
616 # are made available under the terms of the Eclipse Public License v1.0
617 # which accompanies this distribution, and is available at
618 # http://www.eclipse.org/legal/epl-v10.html
619 ##############################################################################
620 echo &quot;---&gt; logs-deploy.sh&quot;
621
622 # Ensure we fail the job if any steps fail.
623 set -eu -o pipefail
624
625 set -x  # Trace commands for this script to make debugging easier.
626
627 ARCHIVE_ARTIFACTS=&quot;${ARCHIVE_ARTIFACTS:-}&quot;
628 LOGS_SERVER=&quot;${LOGS_SERVER:-None}&quot;
629
630 if [ &quot;${LOGS_SERVER}&quot; == 'None' ]
631 then
632     set +x # Disable trace since we no longer need it
633
634     echo &quot;WARNING: Logging server not set&quot;
635 else
636     NEXUS_URL=&quot;${NEXUSPROXY:-$NEXUS_URL}&quot;
637     NEXUS_PATH=&quot;${SILO}/${JENKINS_HOSTNAME}/${JOB_NAME}/${BUILD_NUMBER}&quot;
638     BUILD_URL=&quot;${BUILD_URL}&quot;
639
640     lftools deploy archives -p &quot;$ARCHIVE_ARTIFACTS&quot; &quot;$NEXUS_URL&quot; &quot;$NEXUS_PATH&quot; &quot;$WORKSPACE&quot;
641     lftools deploy logs &quot;$NEXUS_URL&quot; &quot;$NEXUS_PATH&quot; &quot;$BUILD_URL&quot;
642
643     set +x  # Disable trace since we no longer need it.
644
645     echo &quot;Build logs: &lt;a href=\&quot;$LOGS_SERVER/$NEXUS_PATH\&quot;&gt;$LOGS_SERVER/$NEXUS_PATH&lt;/a&gt;&quot;
646 fi
647 </command>
648         </hudson.tasks.Shell>
649         <hudson.tasks.Shell>
650           <command>#!/bin/bash
651 # SPDX-License-Identifier: EPL-1.0
652 ##############################################################################
653 # Copyright (c) 2017 The Linux Foundation and others.
654 #
655 # All rights reserved. This program and the accompanying materials
656 # are made available under the terms of the Eclipse Public License v1.0
657 # which accompanies this distribution, and is available at
658 # http://www.eclipse.org/legal/epl-v10.html
659 ##############################################################################
660
661 # Clear log credential files
662 rm &quot;$SETTINGS_FILE&quot;
663 rm ~/.netrc
664 </command>
665         </hudson.tasks.Shell>
666         <hudson.plugins.descriptionsetter.DescriptionSetterBuilder>
667           <regexp>^Build logs: .*</regexp>
668         </hudson.plugins.descriptionsetter.DescriptionSetterBuilder>
669       </buildSteps>
670       <scriptOnlyIfSuccess>false</scriptOnlyIfSuccess>
671       <scriptOnlyIfFailure>false</scriptOnlyIfFailure>
672       <markBuildUnstable>false</markBuildUnstable>
673     </org.jenkinsci.plugins.postbuildscript.PostBuildScript>
674     <hudson.plugins.ws__cleanup.WsCleanup plugin="ws-cleanup">
675       <patterns>
676         <hudson.plugins.ws__cleanup.Pattern>
677           <pattern>**/*.jenkins-trigger</pattern>
678           <type>EXCLUDE</type>
679         </hudson.plugins.ws__cleanup.Pattern>
680       </patterns>
681       <deleteDirs>false</deleteDirs>
682       <cleanupMatrixParent>false</cleanupMatrixParent>
683       <externalDelete/>
684       <cleanWhenSuccess>true</cleanWhenSuccess>
685       <cleanWhenUnstable>true</cleanWhenUnstable>
686       <cleanWhenFailure>true</cleanWhenFailure>
687       <cleanWhenNotBuilt>true</cleanWhenNotBuilt>
688       <cleanWhenAborted>true</cleanWhenAborted>
689       <notFailBuild>true</notFailBuild>
690     </hudson.plugins.ws__cleanup.WsCleanup>
691   </publishers>
692   <buildWrappers>
693     <com.michelin.cio.hudson.plugins.maskpasswords.MaskPasswordsBuildWrapper/>
694     <hudson.plugins.build__timeout.BuildTimeoutWrapper>
695       <timeoutMinutes>30</timeoutMinutes>
696       <timeoutEnvVar>BUILD_TIMEOUT</timeoutEnvVar>
697       <failBuild>true</failBuild>
698       <writingDescription>false</writingDescription>
699       <timeoutPercentage>0</timeoutPercentage>
700       <timeoutMinutesElasticDefault>3</timeoutMinutesElasticDefault>
701       <timeoutType>absolute</timeoutType>
702     </hudson.plugins.build__timeout.BuildTimeoutWrapper>
703     <hudson.plugins.timestamper.TimestamperBuildWrapper/>
704     <com.cloudbees.jenkins.plugins.sshagent.SSHAgentBuildWrapper>
705       <user>test-credential</user>
706     </com.cloudbees.jenkins.plugins.sshagent.SSHAgentBuildWrapper>
707     <jenkins.plugins.openstack.compute.JCloudsOneOffSlave/>
708   </buildWrappers>
709 </project>