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