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