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