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