Make lftools version configurable
[releng/global-jjb.git] / jjb-test / expected-xml / gerrit-ciman-packer-merge-ubuntu1604-java-builder
1 <?xml version="1.0" encoding="utf-8"?>
2 <project>
3   <actions/>
4   <description>&lt;!-- Managed by Jenkins Job Builder --&gt;</description>
5   <keepDependencies>false</keepDependencies>
6   <blockBuildWhenDownstreamBuilding>false</blockBuildWhenDownstreamBuilding>
7   <blockBuildWhenUpstreamBuilding>false</blockBuildWhenUpstreamBuilding>
8   <concurrentBuild>true</concurrentBuild>
9   <assignedNode>build-vm</assignedNode>
10   <canRoam>false</canRoam>
11   <properties>
12     <jenkins.model.BuildDiscarderProperty>
13       <strategy class="hudson.tasks.LogRotator">
14         <daysToKeep>7</daysToKeep>
15         <numToKeep>-1</numToKeep>
16         <artifactDaysToKeep>-1</artifactDaysToKeep>
17         <artifactNumToKeep>0</artifactNumToKeep>
18       </strategy>
19     </jenkins.model.BuildDiscarderProperty>
20     <hudson.model.ParametersDefinitionProperty>
21       <parameterDefinitions>
22         <hudson.model.StringParameterDefinition>
23           <name>PROJECT</name>
24           <description>Parameter to identify a Gerrit project. This is typically the
25 project repo path as exists in Gerrit.
26 For example: ofextensions/circuitsw
27 </description>
28           <defaultValue>releng/ciman</defaultValue>
29         </hudson.model.StringParameterDefinition>
30         <hudson.model.StringParameterDefinition>
31           <name>STREAM</name>
32           <description>Stream is often set to the same name as 'branch' but can
33 sometimes be used as a name representing a project's release code
34 name.
35 </description>
36           <defaultValue>master</defaultValue>
37         </hudson.model.StringParameterDefinition>
38         <hudson.model.StringParameterDefinition>
39           <name>GERRIT_PROJECT</name>
40           <description>Parameter to identify Gerrit project. This is typically the
41 project repo path as exists in Gerrit.
42 For example: ofextensions/circuitsw
43
44 Note that Gerrit will override this parameter automatically if a
45 job is triggered by Gerrit.
46 </description>
47           <defaultValue>releng/ciman</defaultValue>
48         </hudson.model.StringParameterDefinition>
49         <hudson.model.StringParameterDefinition>
50           <name>GERRIT_BRANCH</name>
51           <description>Parameter to identify a Gerrit branch.
52
53 Note that Gerrit will override this parameter automatically if a
54 job is triggered by Gerrit.
55 </description>
56           <defaultValue>master</defaultValue>
57         </hudson.model.StringParameterDefinition>
58         <hudson.model.StringParameterDefinition>
59           <name>GERRIT_REFSPEC</name>
60           <description>Parameter to identify a refspec when pulling from Gerrit.
61
62 Note that Gerrit will override this parameter automatically if a
63 job is triggered by Gerrit.
64 </description>
65           <defaultValue/>
66         </hudson.model.StringParameterDefinition>
67         <hudson.model.StringParameterDefinition>
68           <name>LFTOOLS_VERSION</name>
69           <description>Version of lftools to install. Can be a specific version like
70 '0.6.0' or a PEP-440 definition.
71 https://www.python.org/dev/peps/pep-0440/
72 For example '&lt;1.0.0' or '&gt;=1.0.0,&lt;2.0.0'.
73 </description>
74           <defaultValue>&lt;1.0.0</defaultValue>
75         </hudson.model.StringParameterDefinition>
76         <hudson.model.StringParameterDefinition>
77           <name>PACKER_VERSION</name>
78           <description>Packer version to download and install.</description>
79           <defaultValue>1.0.2</defaultValue>
80         </hudson.model.StringParameterDefinition>
81       </parameterDefinitions>
82     </hudson.model.ParametersDefinitionProperty>
83   </properties>
84   <scm class="hudson.plugins.git.GitSCM">
85     <configVersion>2</configVersion>
86     <userRemoteConfigs>
87       <hudson.plugins.git.UserRemoteConfig>
88         <name>origin</name>
89         <refspec>$GERRIT_REFSPEC</refspec>
90         <url>$GIT_URL/$GERRIT_PROJECT</url>
91         <credentialsId>test-credential</credentialsId>
92       </hudson.plugins.git.UserRemoteConfig>
93     </userRemoteConfigs>
94     <branches>
95       <hudson.plugins.git.BranchSpec>
96         <name>refs/heads/$GERRIT_BRANCH</name>
97       </hudson.plugins.git.BranchSpec>
98     </branches>
99     <excludedUsers/>
100     <buildChooser class="com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.GerritTriggerBuildChooser"/>
101     <doGenerateSubmoduleConfigurations>false</doGenerateSubmoduleConfigurations>
102     <authorOrCommitter>false</authorOrCommitter>
103     <wipeOutWorkspace>true</wipeOutWorkspace>
104     <pruneBranches>false</pruneBranches>
105     <remotePoll>false</remotePoll>
106     <gitTool>Default</gitTool>
107     <submoduleCfg class="list"/>
108     <relativeTargetDir/>
109     <reference/>
110     <gitConfigName/>
111     <gitConfigEmail/>
112     <skipTag>true</skipTag>
113     <scmName/>
114     <useShallowClone>false</useShallowClone>
115     <ignoreNotifyCommit>false</ignoreNotifyCommit>
116     <extensions>
117       <hudson.plugins.git.extensions.impl.SubmoduleOption>
118         <disableSubmodules>false</disableSubmodules>
119         <recursiveSubmodules>true</recursiveSubmodules>
120         <trackingSubmodules>false</trackingSubmodules>
121         <reference/>
122         <timeout>10</timeout>
123       </hudson.plugins.git.extensions.impl.SubmoduleOption>
124       <hudson.plugins.git.extensions.impl.WipeWorkspace/>
125     </extensions>
126   </scm>
127   <triggers class="vector">
128     <hudson.triggers.TimerTrigger>
129       <spec>00 10 1 * *</spec>
130     </hudson.triggers.TimerTrigger>
131     <com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.GerritTrigger>
132       <spec/>
133       <gerritProjects>
134         <com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.data.GerritProject>
135           <compareType>ANT</compareType>
136           <pattern>releng/ciman</pattern>
137           <branches>
138             <com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.data.Branch>
139               <compareType>ANT</compareType>
140               <pattern>**/master</pattern>
141             </com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.data.Branch>
142           </branches>
143           <filePaths>
144             <com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.data.FilePath>
145               <compareType>ANT</compareType>
146               <pattern>packer/vars/ubuntu1604.json</pattern>
147             </com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.data.FilePath>
148             <com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.data.FilePath>
149               <compareType>ANT</compareType>
150               <pattern>packer/templates/java-builder.json</pattern>
151             </com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.data.FilePath>
152             <com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.data.FilePath>
153               <compareType>ANT</compareType>
154               <pattern>packer/provision/java-builder.sh</pattern>
155             </com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.data.FilePath>
156             <com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.data.FilePath>
157               <compareType>ANT</compareType>
158               <pattern>packer/provision/lib/**</pattern>
159             </com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.data.FilePath>
160           </filePaths>
161           <disableStrictForbiddenFileVerification>false</disableStrictForbiddenFileVerification>
162         </com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.data.GerritProject>
163       </gerritProjects>
164       <skipVote>
165         <onSuccessful>false</onSuccessful>
166         <onFailed>false</onFailed>
167         <onUnstable>false</onUnstable>
168         <onNotBuilt>false</onNotBuilt>
169       </skipVote>
170       <silentMode>false</silentMode>
171       <silentStartMode>false</silentStartMode>
172       <escapeQuotes>true</escapeQuotes>
173       <noNameAndEmailParameters>false</noNameAndEmailParameters>
174       <readableMessage>false</readableMessage>
175       <dependencyJobsNames/>
176       <notificationLevel/>
177       <dynamicTriggerConfiguration>False</dynamicTriggerConfiguration>
178       <triggerConfigURL/>
179       <allowTriggeringUnreviewedPatches>false</allowTriggeringUnreviewedPatches>
180       <triggerOnEvents>
181         <com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.events.PluginChangeMergedEvent/>
182         <com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.events.PluginCommentAddedContainsEvent>
183           <commentAddedCommentContains>remerge$</commentAddedCommentContains>
184         </com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.events.PluginCommentAddedContainsEvent>
185       </triggerOnEvents>
186       <buildStartMessage/>
187       <buildFailureMessage/>
188       <buildSuccessfulMessage/>
189       <buildUnstableMessage/>
190       <buildNotBuiltMessage/>
191       <buildUnsuccessfulFilepath/>
192       <customUrl/>
193       <serverName>test-server</serverName>
194     </com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.GerritTrigger>
195   </triggers>
196   <builders>
197     <org.jenkinsci.plugins.configfiles.builder.ConfigFileBuildStep plugin="config-file-provider">
198       <managedFiles>
199         <org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
200           <fileId>ci-packer-cloud-env</fileId>
201           <targetLocation/>
202           <variable>CLOUDENV</variable>
203         </org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
204       </managedFiles>
205     </org.jenkinsci.plugins.configfiles.builder.ConfigFileBuildStep>
206     <EnvInjectBuilder>
207       <info>
208         <propertiesContent>PACKER_VERSION=1.0.2
209 </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; packer-install.sh&quot;
224 # The script checks for the packer binaries and installs the binary
225 # if its not available
226
227 # $PACKER_VERSION        : Define a packer version passed as job paramter
228
229 PACKER_VERSION=&quot;${PACKER_VERSION:-1.0.2}&quot;
230
231 # Ensure we fail the job if any steps fail.
232 set -eu -o pipefail
233 # Default packer binary made available on the build image
234 packer_bin=&quot;/usr/local/bin/packer.io&quot;
235
236 if hash &quot;$packer_bin&quot; 2&gt;/dev/null; then
237     echo &quot;packer.io command is available.&quot;
238 else
239     echo &quot;packer.io command not is available. Installing packer ...&quot;
240     # Installs Hashicorp's Packer binary, required for verify &amp; merge packer jobs
241     pushd packer
242     wget &quot;https://releases.hashicorp.com/packer/${PACKER_VERSION}/packer_${PACKER_VERSION}_linux_amd64.zip&quot;
243     mkdir -p &quot;${WORKSPACE}/bin&quot;
244     unzip &quot;packer_${PACKER_VERSION}_linux_amd64.zip&quot; -d ${WORKSPACE}/bin/
245     # rename packer to avoid conflict with binary in cracklib
246     mv ${WORKSPACE}/bin/packer &quot;${WORKSPACE}/bin/packer.io&quot;
247     popd
248 fi
249
250 #!/bin/bash
251 # SPDX-License-Identifier: EPL-1.0
252 ##############################################################################
253 # Copyright (c) 2017 The Linux Foundation and others.
254 #
255 # All rights reserved. This program and the accompanying materials
256 # are made available under the terms of the Eclipse Public License v1.0
257 # which accompanies this distribution, and is available at
258 # http://www.eclipse.org/legal/epl-v10.html
259 ##############################################################################
260 echo &quot;---&gt; packer-validate.sh&quot;
261 # The script validates an packers files.
262
263 # $CLOUDENV            :  Provides the cloud credential file.
264
265 # Ensure we fail the job if any steps fail.
266 set -eu -o pipefail
267
268 PACKER_LOGS_DIR=&quot;$WORKSPACE/archives/packer&quot;
269 mkdir -p &quot;$PACKER_LOGS_DIR&quot;
270 export PATH=&quot;${WORKSPACE}/bin:$PATH&quot;
271
272 cd packer
273 varfiles=(../packer/vars/*.json)
274 templates=(../packer/templates/*.json)
275
276 for varfile in &quot;${varfiles[@]}&quot;; do
277     for template in &quot;${templates[@]}&quot;; do
278         export PACKER_LOG=&quot;yes&quot; &amp;&amp; \
279         export PACKER_LOG_PATH=&quot;$PACKER_LOGS_DIR/packer-validate-${varfile##*/}-${template##*/}.log&quot; &amp;&amp; \
280                     packer.io validate -var-file=&quot;$CLOUDENV&quot; \
281                     -var-file=&quot;$varfile&quot; &quot;$template&quot;
282         if [ $? -ne 0 ]; then
283             break
284         fi
285     done
286 done
287 </command>
288     </hudson.tasks.Shell>
289     <hudson.tasks.Shell>
290       <command>#!/bin/bash
291 # SPDX-License-Identifier: EPL-1.0
292 ##############################################################################
293 # Copyright (c) 2017 The Linux Foundation and others.
294 #
295 # All rights reserved. This program and the accompanying materials
296 # are made available under the terms of the Eclipse Public License v1.0
297 # which accompanies this distribution, and is available at
298 # http://www.eclipse.org/legal/epl-v10.html
299 ##############################################################################
300 echo &quot;---&gt; packer-clear-credentials.sh&quot;
301
302 set +e  # DO NOT cause build failure if any of the rm calls fail.
303 rm &quot;$CLOUDENV&quot;
304 exit 0
305 </command>
306     </hudson.tasks.Shell>
307     <org.jenkinsci.plugins.configfiles.builder.ConfigFileBuildStep plugin="config-file-provider">
308       <managedFiles>
309         <org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
310           <fileId>ci-packer-cloud-env</fileId>
311           <targetLocation/>
312           <variable>CLOUDENV</variable>
313         </org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
314       </managedFiles>
315     </org.jenkinsci.plugins.configfiles.builder.ConfigFileBuildStep>
316     <EnvInjectBuilder>
317       <info>
318         <propertiesContent>PACKER_PLATFORM=ubuntu1604
319 PACKER_TEMPLATE=java-builder
320 PACKER_VERSION=1.0.2
321 </propertiesContent>
322       </info>
323     </EnvInjectBuilder>
324     <hudson.tasks.Shell>
325       <command>#!/bin/bash
326 # SPDX-License-Identifier: EPL-1.0
327 ##############################################################################
328 # Copyright (c) 2017 The Linux Foundation and others.
329 #
330 # All rights reserved. This program and the accompanying materials
331 # are made available under the terms of the Eclipse Public License v1.0
332 # which accompanies this distribution, and is available at
333 # http://www.eclipse.org/legal/epl-v10.html
334 ##############################################################################
335 echo &quot;---&gt; packer-install.sh&quot;
336 # The script checks for the packer binaries and installs the binary
337 # if its not available
338
339 # $PACKER_VERSION        : Define a packer version passed as job paramter
340
341 PACKER_VERSION=&quot;${PACKER_VERSION:-1.0.2}&quot;
342
343 # Ensure we fail the job if any steps fail.
344 set -eu -o pipefail
345 # Default packer binary made available on the build image
346 packer_bin=&quot;/usr/local/bin/packer.io&quot;
347
348 if hash &quot;$packer_bin&quot; 2&gt;/dev/null; then
349     echo &quot;packer.io command is available.&quot;
350 else
351     echo &quot;packer.io command not is available. Installing packer ...&quot;
352     # Installs Hashicorp's Packer binary, required for verify &amp; merge packer jobs
353     pushd packer
354     wget &quot;https://releases.hashicorp.com/packer/${PACKER_VERSION}/packer_${PACKER_VERSION}_linux_amd64.zip&quot;
355     mkdir -p &quot;${WORKSPACE}/bin&quot;
356     unzip &quot;packer_${PACKER_VERSION}_linux_amd64.zip&quot; -d ${WORKSPACE}/bin/
357     # rename packer to avoid conflict with binary in cracklib
358     mv ${WORKSPACE}/bin/packer &quot;${WORKSPACE}/bin/packer.io&quot;
359     popd
360 fi
361
362 #!/bin/bash
363 # SPDX-License-Identifier: EPL-1.0
364 ##############################################################################
365 # Copyright (c) 2017 The Linux Foundation and others.
366 #
367 # All rights reserved. This program and the accompanying materials
368 # are made available under the terms of the Eclipse Public License v1.0
369 # which accompanies this distribution, and is available at
370 # http://www.eclipse.org/legal/epl-v10.html
371 ##############################################################################
372 echo &quot;---&gt; packer-build.sh&quot;
373 # The script builds an image using packer
374 # $CLOUDENV            :  Provides the cloud credential file.
375 # $PACKER_PLATFORM     :  Provides the packer platform.
376 # $PACKER_TEMPLATE     :  Provides the packer temnplate.
377
378 # Ensure we fail the job if any steps fail.
379 set -eu -o pipefail
380
381 PACKER_LOGS_DIR=&quot;$WORKSPACE/archives/packer&quot;
382 PACKER_BUILD_LOG=&quot;$PACKER_LOGS_DIR/packer-build.log&quot;
383 mkdir -p &quot;$PACKER_LOGS_DIR&quot;
384 export PATH=&quot;${WORKSPACE}/bin:$PATH&quot;
385
386 cd packer
387 export PACKER_LOG=&quot;yes&quot; &amp;&amp; \
388 export PACKER_LOG_PATH=&quot;$PACKER_BUILD_LOG&quot; &amp;&amp; \
389                  packer.io build -color=false \
390                         -var-file=&quot;$CLOUDENV&quot; \
391                         -var-file=&quot;../packer/vars/$PACKER_PLATFORM.json&quot; \
392                         &quot;../packer/templates/$PACKER_TEMPLATE.json&quot;
393
394 # Retrive the list of cloud providers
395 clouds=($(jq -r '.builders[].name' &quot;../packer/templates/$PACKER_TEMPLATE.json&quot;))
396
397 # Split public/private clouds logs
398 for cloud in &quot;${clouds[@]}&quot;; do
399     grep -e &quot;$cloud&quot; &quot;$PACKER_BUILD_LOG&quot; &gt; &quot;$PACKER_LOGS_DIR/packer-build_$cloud.log&quot; 2&gt;&amp;1
400 done
401 </command>
402     </hudson.tasks.Shell>
403     <hudson.tasks.Shell>
404       <command>#!/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 echo &quot;---&gt; packer-clear-credentials.sh&quot;
415
416 set +e  # DO NOT cause build failure if any of the rm calls fail.
417 rm &quot;$CLOUDENV&quot;
418 exit 0
419 </command>
420     </hudson.tasks.Shell>
421   </builders>
422   <publishers>
423     <org.jenkinsci.plugins.postbuildscript.PostBuildScript>
424       <buildSteps>
425         <hudson.tasks.Shell>
426           <command>#!/bin/bash
427 # SPDX-License-Identifier: EPL-1.0
428 ##############################################################################
429 # Copyright (c) 2017 The Linux Foundation and others.
430 #
431 # All rights reserved. This program and the accompanying materials
432 # are made available under the terms of the Eclipse Public License v1.0
433 # which accompanies this distribution, and is available at
434 # http://www.eclipse.org/legal/epl-v10.html
435 ##############################################################################
436 echo &quot;---&gt; sysstat.sh&quot;
437 set +e  # DON'T fail build if script fails.
438
439 OS=$(facter operatingsystem)
440 case &quot;$OS&quot; in
441     Ubuntu)
442         SYSSTAT_PATH=&quot;/var/log/sysstat&quot;
443
444         # Dont run the script when systat is not enabled by default
445         if ! grep --quiet 'ENABLED=&quot;true&quot;' &quot;/etc/default/sysstat&quot;; then
446             exit 0
447         fi
448     ;;
449     CentOS|RedHat)
450         SYSSTAT_PATH=&quot;/var/log/sa&quot;
451     ;;
452     *)
453         # nothing to do
454         exit 0
455     ;;
456 esac
457
458 SAR_DIR=&quot;$WORKSPACE/archives/sar-reports&quot;
459 mkdir -p &quot;$SAR_DIR&quot;
460 cp &quot;$SYSSTAT_PATH/&quot;* &quot;$_&quot;
461 # convert sar data to ascii format
462 while IFS=&quot;&quot; read -r s
463 do
464     [ -f &quot;$s&quot; ] &amp;&amp; LC_TIME=POSIX sar -A -f &quot;$s&quot; &gt; &quot;$SAR_DIR/sar${s//[!0-9]/}&quot;
465 done &lt; &lt;(find &quot;$SYSSTAT_PATH&quot; -name &quot;sa[0-9]*&quot; || true)
466
467 # DON'T fail build if script fails.
468 exit 0
469 </command>
470         </hudson.tasks.Shell>
471         <org.jenkinsci.plugins.configfiles.builder.ConfigFileBuildStep plugin="config-file-provider">
472           <managedFiles>
473             <org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
474               <fileId>jenkins-log-archives-settings</fileId>
475               <targetLocation/>
476               <variable>SETTINGS_FILE</variable>
477             </org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
478           </managedFiles>
479         </org.jenkinsci.plugins.configfiles.builder.ConfigFileBuildStep>
480         <EnvInjectBuilder>
481           <info>
482             <propertiesContent>SERVER_ID=logs</propertiesContent>
483           </info>
484         </EnvInjectBuilder>
485         <hudson.tasks.Shell>
486           <command>#!/bin/bash
487 # SPDX-License-Identifier: EPL-1.0
488 ##############################################################################
489 # Copyright (c) 2017 The Linux Foundation and others.
490 #
491 # All rights reserved. This program and the accompanying materials
492 # are made available under the terms of the Eclipse Public License v1.0
493 # which accompanies this distribution, and is available at
494 # http://www.eclipse.org/legal/epl-v10.html
495 ##############################################################################
496 echo &quot;---&gt; create-netrc.sh&quot;
497
498 # Ensure we fail the job if any steps fail.
499 set -eu -o pipefail
500
501 NEXUS_URL=&quot;${NEXUS_URL:-$NEXUSPROXY}&quot;
502 CREDENTIAL=$(xmlstarlet sel -N &quot;x=http://maven.apache.org/SETTINGS/1.0.0&quot; \
503     -t -m &quot;/x:settings/x:servers/x:server[x:id='${SERVER_ID}']&quot; \
504     -v x:username -o &quot;:&quot; -v x:password \
505     &quot;$SETTINGS_FILE&quot;)
506
507 machine=$(echo &quot;$NEXUS_URL&quot; | awk -F/ '{print $3}')
508 user=$(echo &quot;$CREDENTIAL&quot; | cut -f1 -d:)
509 pass=$(echo &quot;$CREDENTIAL&quot; | cut -f2 -d:)
510
511 echo &quot;machine $machine login $user password $pass&quot; &gt; ~/.netrc
512 </command>
513         </hudson.tasks.Shell>
514         <hudson.tasks.Shell>
515           <command>#!/bin/bash
516 # SPDX-License-Identifier: EPL-1.0
517 ##############################################################################
518 # Copyright (c) 2017 The Linux Foundation and others.
519 #
520 # All rights reserved. This program and the accompanying materials
521 # are made available under the terms of the Eclipse Public License v1.0
522 # which accompanies this distribution, and is available at
523 # http://www.eclipse.org/legal/epl-v10.html
524 ##############################################################################
525 echo &quot;---&gt; lftools-install.sh&quot;
526
527 # Script to install lftools via a version passed in via lf-infra-parameters
528 #
529 # Required parameters:
530 #
531 #     LFTOOLS_VERSION: Passed in via lf-infra-parameters configuration. Can be
532 #                      set to a strict version number like '1.2.3' or using
533 #                      PEP-440 definitions.
534 #
535 #                      Examples:
536 #                          &lt;1.0.0
537 #                          &gt;=1.0.0,&lt;2.0.0
538 #
539 # By default a released version of lftools should always be used.
540 # The purpose of the 2 variables below is so that lftools devs can test
541 # unreleased versions of lftools. There are 2 methods to install a dev version
542 # of lftools:
543 #
544 #     1) gerrit patch: Used to test a patch that has not yet been merged.
545 #                      To do this set something like this:
546 #                          LFTOOLS_MODE=gerrit
547 #                          LFTOOLS_REFSPEC=refs/changes/96/5296/7
548 #
549 #     2) git branch: Used to install an lftools version from a specific branch.
550 #                    To use this set the variables as follows:
551 #                          LFTOOLS_MODE=git
552 #                          LFTOOLS_REFSPEC=master
553 #
554 #     3) release : The intended use case and default setting.
555 #                  Set LFTOOLS_MODE=release, in this case LFTOOLS_REFSPEC is unused.
556
557 LFTOOLS_MODE=release  # release | git | gerrit
558 LFTOOLS_REFSPEC=master
559
560 # Ensure we fail the job if any steps fail.
561 # DO NOT set -u as virtualenv's activate script has unbound variables
562 set -e -o pipefail
563
564 virtualenv --quiet &quot;/tmp/v/lftools&quot;
565 # shellcheck source=/tmp/v/lftools/bin/activate disable=SC1091
566 source &quot;/tmp/v/lftools/bin/activate&quot;
567 pip install --quiet --upgrade pip
568
569 case $LFTOOLS_MODE in
570     gerrit)
571         git clone https://gerrit.linuxfoundation.org/infra/releng/lftools.git /tmp/lftools
572         pushd /tmp/lftools
573         git fetch origin &quot;$LFTOOLS_REFSPEC&quot;
574         git checkout FETCH_HEAD
575         pip install --quiet --upgrade -r requirements.txt
576         pip install --quiet --upgrade -e .
577         popd
578         ;;
579
580     git)
581         pip install --quiet --upgrade git+https://gerrit.linuxfoundation.org/infra/releng/lftools.git@&quot;$BRANCH&quot;
582         ;;
583
584     release)
585         if [[ $LFTOOLS_VERSION =~ ^[0-9] ]]; then
586             LFTOOLS_VERSION=&quot;==$LFTOOLS_VERSION&quot;
587         fi
588
589         pip install --quiet --upgrade &quot;lftools${LFTOOLS_VERSION}&quot;
590         ;;
591 esac
592
593 lftools --version
594
595 # pipdeptree prints out a lot of information because lftools pulls in many
596 # dependencies. Let's only print it if we want to debug.
597 # echo &quot;----&gt; Pip Dependency Tree&quot;
598 # pip install --quiet --upgrade pipdeptree
599 # pipdeptree
600
601 #!/bin/bash
602 # SPDX-License-Identifier: EPL-1.0
603 ##############################################################################
604 # Copyright (c) 2017 The Linux Foundation and others.
605 #
606 # All rights reserved. This program and the accompanying materials
607 # are made available under the terms of the Eclipse Public License v1.0
608 # which accompanies this distribution, and is available at
609 # http://www.eclipse.org/legal/epl-v10.html
610 ##############################################################################
611 echo &quot;---&gt; logs-deploy.sh&quot;
612
613 # Ensure we fail the job if any steps fail.
614 set -eu -o pipefail
615
616 set -x  # Trace commands for this script to make debugging easier.
617
618 ARCHIVE_ARTIFACTS=&quot;${ARCHIVE_ARTIFACTS:-}&quot;
619 LOGS_SERVER=&quot;${LOGS_SERVER:-None}&quot;
620
621 if [ &quot;${LOGS_SERVER}&quot; == 'None' ]
622 then
623     set +x # Disable trace since we no longer need it
624
625     echo &quot;WARNING: Logging server not set&quot;
626 else
627     NEXUS_URL=&quot;${NEXUS_URL:-$NEXUSPROXY}&quot;
628     NEXUS_PATH=&quot;${SILO}/${JENKINS_HOSTNAME}/${JOB_NAME}/${BUILD_NUMBER}&quot;
629     BUILD_URL=&quot;${BUILD_URL}&quot;
630
631     lftools deploy archives -p &quot;$ARCHIVE_ARTIFACTS&quot; &quot;$NEXUS_URL&quot; &quot;$NEXUS_PATH&quot; &quot;$WORKSPACE&quot;
632     lftools deploy logs &quot;$NEXUS_URL&quot; &quot;$NEXUS_PATH&quot; &quot;$BUILD_URL&quot;
633
634     set +x  # Disable trace since we no longer need it.
635
636     echo &quot;Build logs: &lt;a href=\&quot;$LOGS_SERVER/$NEXUS_PATH\&quot;&gt;$LOGS_SERVER/$NEXUS_PATH&lt;/a&gt;&quot;
637 fi
638 </command>
639         </hudson.tasks.Shell>
640         <hudson.tasks.Shell>
641           <command>#!/bin/bash
642 # SPDX-License-Identifier: EPL-1.0
643 ##############################################################################
644 # Copyright (c) 2017 The Linux Foundation and others.
645 #
646 # All rights reserved. This program and the accompanying materials
647 # are made available under the terms of the Eclipse Public License v1.0
648 # which accompanies this distribution, and is available at
649 # http://www.eclipse.org/legal/epl-v10.html
650 ##############################################################################
651
652 # Clear log credential files
653 rm &quot;$SETTINGS_FILE&quot;
654 rm ~/.netrc
655 </command>
656         </hudson.tasks.Shell>
657         <hudson.plugins.descriptionsetter.DescriptionSetterBuilder>
658           <regexp>^Build logs: .*</regexp>
659         </hudson.plugins.descriptionsetter.DescriptionSetterBuilder>
660       </buildSteps>
661       <scriptOnlyIfSuccess>false</scriptOnlyIfSuccess>
662       <scriptOnlyIfFailure>false</scriptOnlyIfFailure>
663       <markBuildUnstable>false</markBuildUnstable>
664     </org.jenkinsci.plugins.postbuildscript.PostBuildScript>
665     <hudson.plugins.ws__cleanup.WsCleanup plugin="ws-cleanup">
666       <patterns>
667         <hudson.plugins.ws__cleanup.Pattern>
668           <pattern>**/*.jenkins-trigger</pattern>
669           <type>EXCLUDE</type>
670         </hudson.plugins.ws__cleanup.Pattern>
671       </patterns>
672       <deleteDirs>false</deleteDirs>
673       <cleanupMatrixParent>false</cleanupMatrixParent>
674       <externalDelete/>
675       <cleanWhenSuccess>true</cleanWhenSuccess>
676       <cleanWhenUnstable>true</cleanWhenUnstable>
677       <cleanWhenFailure>true</cleanWhenFailure>
678       <cleanWhenNotBuilt>true</cleanWhenNotBuilt>
679       <cleanWhenAborted>true</cleanWhenAborted>
680       <notFailBuild>true</notFailBuild>
681     </hudson.plugins.ws__cleanup.WsCleanup>
682   </publishers>
683   <buildWrappers>
684     <com.michelin.cio.hudson.plugins.maskpasswords.MaskPasswordsBuildWrapper/>
685     <hudson.plugins.build__timeout.BuildTimeoutWrapper>
686       <timeoutMinutes>45</timeoutMinutes>
687       <timeoutEnvVar>BUILD_TIMEOUT</timeoutEnvVar>
688       <failBuild>true</failBuild>
689       <writingDescription>false</writingDescription>
690       <timeoutPercentage>0</timeoutPercentage>
691       <timeoutMinutesElasticDefault>3</timeoutMinutesElasticDefault>
692       <timeoutType>absolute</timeoutType>
693     </hudson.plugins.build__timeout.BuildTimeoutWrapper>
694     <hudson.plugins.timestamper.TimestamperBuildWrapper/>
695     <com.cloudbees.jenkins.plugins.sshagent.SSHAgentBuildWrapper>
696       <user>test-credential</user>
697     </com.cloudbees.jenkins.plugins.sshagent.SSHAgentBuildWrapper>
698     <jenkins.plugins.openstack.compute.JCloudsOneOffSlave/>
699   </buildWrappers>
700 </project>