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