Fix branch variable in github scm
[releng/global-jjb.git] / .jjb-test / expected-xml / github-ciman-packer-merge-centos-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>
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.1</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>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-$mininet 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.1
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.0.2}&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=(../packer/vars/*.json)
230 templates=(../packer/templates/*.json)
231
232 for varfile in &quot;${varfiles[@]}&quot;; do
233     for template in &quot;${templates[@]}&quot;; do
234         export PACKER_LOG=&quot;yes&quot; &amp;&amp; \
235         export PACKER_LOG_PATH=&quot;$PACKER_LOGS_DIR/packer-validate-${varfile##*/}-${template##*/}.log&quot; &amp;&amp; \
236                     packer.io validate -var-file=&quot;$CLOUDENV&quot; \
237                     -var-file=&quot;$varfile&quot; &quot;$template&quot;
238         if [ $? -ne 0 ]; then
239             break
240         fi
241     done
242 done
243 </command>
244     </hudson.tasks.Shell>
245     <hudson.tasks.Shell>
246       <command>#!/bin/bash
247 # SPDX-License-Identifier: EPL-1.0
248 ##############################################################################
249 # Copyright (c) 2017 The Linux Foundation and others.
250 #
251 # All rights reserved. This program and the accompanying materials
252 # are made available under the terms of the Eclipse Public License v1.0
253 # which accompanies this distribution, and is available at
254 # http://www.eclipse.org/legal/epl-v10.html
255 ##############################################################################
256 echo &quot;---&gt; packer-clear-credentials.sh&quot;
257
258 set +e  # DO NOT cause build failure if any of the rm calls fail.
259 rm &quot;$CLOUDENV&quot;
260 exit 0
261 </command>
262     </hudson.tasks.Shell>
263     <org.jenkinsci.plugins.configfiles.builder.ConfigFileBuildStep plugin="config-file-provider">
264       <managedFiles>
265         <org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
266           <fileId>ci-packer-cloud-env</fileId>
267           <targetLocation/>
268           <variable>CLOUDENV</variable>
269         </org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
270       </managedFiles>
271     </org.jenkinsci.plugins.configfiles.builder.ConfigFileBuildStep>
272     <EnvInjectBuilder>
273       <info>
274         <propertiesContent>PACKER_PLATFORM=centos
275 PACKER_TEMPLATE=mininet
276 PACKER_VERSION=1.1.1
277 </propertiesContent>
278       </info>
279     </EnvInjectBuilder>
280     <hudson.tasks.Shell>
281       <command>#!/bin/bash
282 # SPDX-License-Identifier: EPL-1.0
283 ##############################################################################
284 # Copyright (c) 2017 The Linux Foundation and others.
285 #
286 # All rights reserved. This program and the accompanying materials
287 # are made available under the terms of the Eclipse Public License v1.0
288 # which accompanies this distribution, and is available at
289 # http://www.eclipse.org/legal/epl-v10.html
290 ##############################################################################
291 echo &quot;---&gt; packer-install.sh&quot;
292 # The script checks for the packer binaries and installs the binary
293 # if its not available
294
295 # $PACKER_VERSION        : Define a packer version passed as job paramter
296
297 PACKER_VERSION=&quot;${PACKER_VERSION:-1.0.2}&quot;
298
299 # Ensure we fail the job if any steps fail.
300 set -eu -o pipefail
301
302 if hash packer.io 2&gt;/dev/null; then
303     echo &quot;packer.io command is available.&quot;
304 else
305     echo &quot;packer.io command not is available. Installing packer ...&quot;
306     # Installs Hashicorp's Packer binary, required for verify &amp; merge packer jobs
307     pushd packer
308     wget -nv &quot;https://releases.hashicorp.com/packer/${PACKER_VERSION}/packer_${PACKER_VERSION}_linux_amd64.zip&quot;
309     mkdir -p &quot;${WORKSPACE}/bin&quot;
310     unzip &quot;packer_${PACKER_VERSION}_linux_amd64.zip&quot; -d ${WORKSPACE}/bin/
311     # rename packer to avoid conflict with binary in cracklib
312     mv ${WORKSPACE}/bin/packer &quot;${WORKSPACE}/bin/packer.io&quot;
313     popd
314 fi
315
316 #!/bin/bash
317 # SPDX-License-Identifier: EPL-1.0
318 ##############################################################################
319 # Copyright (c) 2017 The Linux Foundation and others.
320 #
321 # All rights reserved. This program and the accompanying materials
322 # are made available under the terms of the Eclipse Public License v1.0
323 # which accompanies this distribution, and is available at
324 # http://www.eclipse.org/legal/epl-v10.html
325 ##############################################################################
326 echo &quot;---&gt; packer-build.sh&quot;
327 # The script builds an image using packer
328 # $CLOUDENV            :  Provides the cloud credential file.
329 # $PACKER_PLATFORM     :  Provides the packer platform.
330 # $PACKER_TEMPLATE     :  Provides the packer temnplate.
331
332 # Ensure we fail the job if any steps fail.
333 set -eu -o pipefail
334
335 PACKER_LOGS_DIR=&quot;$WORKSPACE/archives/packer&quot;
336 PACKER_BUILD_LOG=&quot;$PACKER_LOGS_DIR/packer-build.log&quot;
337 mkdir -p &quot;$PACKER_LOGS_DIR&quot;
338 export PATH=&quot;${WORKSPACE}/bin:$PATH&quot;
339
340 cd packer
341 export PACKER_LOG=&quot;yes&quot; &amp;&amp; \
342 export PACKER_LOG_PATH=&quot;$PACKER_BUILD_LOG&quot; &amp;&amp; \
343                  packer.io build -color=false \
344                         -var-file=&quot;$CLOUDENV&quot; \
345                         -var-file=&quot;../packer/vars/$PACKER_PLATFORM.json&quot; \
346                         &quot;../packer/templates/$PACKER_TEMPLATE.json&quot;
347
348 # Retrive the list of cloud providers
349 clouds=($(jq -r '.builders[].name' &quot;../packer/templates/$PACKER_TEMPLATE.json&quot;))
350
351 # Split public/private clouds logs
352 for cloud in &quot;${clouds[@]}&quot;; do
353     grep -e &quot;$cloud&quot; &quot;$PACKER_BUILD_LOG&quot; &gt; &quot;$PACKER_LOGS_DIR/packer-build_$cloud.log&quot; 2&gt;&amp;1
354 done
355 </command>
356     </hudson.tasks.Shell>
357     <hudson.tasks.Shell>
358       <command>#!/bin/bash
359 # SPDX-License-Identifier: EPL-1.0
360 ##############################################################################
361 # Copyright (c) 2017 The Linux Foundation and others.
362 #
363 # All rights reserved. This program and the accompanying materials
364 # are made available under the terms of the Eclipse Public License v1.0
365 # which accompanies this distribution, and is available at
366 # http://www.eclipse.org/legal/epl-v10.html
367 ##############################################################################
368 echo &quot;---&gt; packer-clear-credentials.sh&quot;
369
370 set +e  # DO NOT cause build failure if any of the rm calls fail.
371 rm &quot;$CLOUDENV&quot;
372 exit 0
373 </command>
374     </hudson.tasks.Shell>
375   </builders>
376   <publishers>
377     <org.jenkinsci.plugins.postbuildscript.PostBuildScript>
378       <buildSteps>
379         <hudson.tasks.Shell>
380           <command>#!/bin/bash
381 # SPDX-License-Identifier: EPL-1.0
382 ##############################################################################
383 # Copyright (c) 2017 The Linux Foundation and others.
384 #
385 # All rights reserved. This program and the accompanying materials
386 # are made available under the terms of the Eclipse Public License v1.0
387 # which accompanies this distribution, and is available at
388 # http://www.eclipse.org/legal/epl-v10.html
389 ##############################################################################
390 echo &quot;---&gt; sysstat.sh&quot;
391 set +e  # DON'T fail build if script fails.
392
393 OS=$(facter operatingsystem)
394 case &quot;$OS&quot; in
395     Ubuntu)
396         SYSSTAT_PATH=&quot;/var/log/sysstat&quot;
397
398         # Dont run the script when systat is not enabled by default
399         if ! grep --quiet 'ENABLED=&quot;true&quot;' &quot;/etc/default/sysstat&quot;; then
400             exit 0
401         fi
402     ;;
403     CentOS|RedHat)
404         SYSSTAT_PATH=&quot;/var/log/sa&quot;
405     ;;
406     *)
407         # nothing to do
408         exit 0
409     ;;
410 esac
411
412 SAR_DIR=&quot;$WORKSPACE/archives/sar-reports&quot;
413 mkdir -p &quot;$SAR_DIR&quot;
414 cp &quot;$SYSSTAT_PATH/&quot;* &quot;$_&quot;
415 # convert sar data to ascii format
416 while IFS=&quot;&quot; read -r s
417 do
418     [ -f &quot;$s&quot; ] &amp;&amp; LC_TIME=POSIX sar -A -f &quot;$s&quot; &gt; &quot;$SAR_DIR/sar${s//[!0-9]/}&quot;
419 done &lt; &lt;(find &quot;$SYSSTAT_PATH&quot; -name &quot;sa[0-9]*&quot; || true)
420
421 # DON'T fail build if script fails.
422 exit 0
423 </command>
424         </hudson.tasks.Shell>
425         <org.jenkinsci.plugins.configfiles.builder.ConfigFileBuildStep plugin="config-file-provider">
426           <managedFiles>
427             <org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
428               <fileId>jenkins-log-archives-settings</fileId>
429               <targetLocation/>
430               <variable>SETTINGS_FILE</variable>
431             </org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
432           </managedFiles>
433         </org.jenkinsci.plugins.configfiles.builder.ConfigFileBuildStep>
434         <EnvInjectBuilder>
435           <info>
436             <propertiesContent>SERVER_ID=logs</propertiesContent>
437           </info>
438         </EnvInjectBuilder>
439         <hudson.tasks.Shell>
440           <command>#!/bin/bash
441 # SPDX-License-Identifier: EPL-1.0
442 ##############################################################################
443 # Copyright (c) 2017 The Linux Foundation and others.
444 #
445 # All rights reserved. This program and the accompanying materials
446 # are made available under the terms of the Eclipse Public License v1.0
447 # which accompanies this distribution, and is available at
448 # http://www.eclipse.org/legal/epl-v10.html
449 ##############################################################################
450 echo &quot;---&gt; create-netrc.sh&quot;
451
452 # Ensure we fail the job if any steps fail.
453 set -eu -o pipefail
454
455 NEXUS_URL=&quot;${NEXUSPROXY:-$NEXUS_URL}&quot;
456 CREDENTIAL=$(xmlstarlet sel -N &quot;x=http://maven.apache.org/SETTINGS/1.0.0&quot; \
457     -t -m &quot;/x:settings/x:servers/x:server[x:id='${SERVER_ID}']&quot; \
458     -v x:username -o &quot;:&quot; -v x:password \
459     &quot;$SETTINGS_FILE&quot;)
460
461 machine=$(echo &quot;$NEXUS_URL&quot; | awk -F/ '{print $3}')
462 user=$(echo &quot;$CREDENTIAL&quot; | cut -f1 -d:)
463 pass=$(echo &quot;$CREDENTIAL&quot; | cut -f2 -d:)
464
465 echo &quot;machine ${machine%:*} login $user password $pass&quot; &gt; ~/.netrc
466 </command>
467         </hudson.tasks.Shell>
468         <hudson.tasks.Shell>
469           <command>#!/bin/bash
470 # SPDX-License-Identifier: EPL-1.0
471 ##############################################################################
472 # Copyright (c) 2017 The Linux Foundation and others.
473 #
474 # All rights reserved. This program and the accompanying materials
475 # are made available under the terms of the Eclipse Public License v1.0
476 # which accompanies this distribution, and is available at
477 # http://www.eclipse.org/legal/epl-v10.html
478 ##############################################################################
479 echo &quot;---&gt; lftools-install.sh&quot;
480
481 # Script to install lftools via a version passed in via lf-infra-parameters
482 #
483 # Required parameters:
484 #
485 #     LFTOOLS_VERSION: Passed in via lf-infra-parameters configuration. Can be
486 #                      set to a strict version number like '1.2.3' or using
487 #                      PEP-440 definitions.
488 #
489 #                      Examples:
490 #                          &lt;1.0.0
491 #                          &gt;=1.0.0,&lt;2.0.0
492 #
493 # By default a released version of lftools should always be used.
494 # The purpose of the 2 variables below is so that lftools devs can test
495 # unreleased versions of lftools. There are 2 methods to install a dev version
496 # of lftools:
497 #
498 #     1) gerrit patch: Used to test a patch that has not yet been merged.
499 #                      To do this set something like this:
500 #                          LFTOOLS_MODE=gerrit
501 #                          LFTOOLS_REFSPEC=refs/changes/96/5296/7
502 #
503 #     2) git branch: Used to install an lftools version from a specific branch.
504 #                    To use this set the variables as follows:
505 #                          LFTOOLS_MODE=git
506 #                          LFTOOLS_REFSPEC=master
507 #
508 #     3) release : The intended use case and default setting.
509 #                  Set LFTOOLS_MODE=release, in this case LFTOOLS_REFSPEC is unused.
510
511 LFTOOLS_MODE=release  # release | git | gerrit
512 LFTOOLS_REFSPEC=master
513
514 # Ensure we fail the job if any steps fail.
515 # DO NOT set -u as virtualenv's activate script has unbound variables
516 set -e -o pipefail
517
518 virtualenv --quiet &quot;/tmp/v/lftools&quot;
519 # shellcheck source=/tmp/v/lftools/bin/activate disable=SC1091
520 source &quot;/tmp/v/lftools/bin/activate&quot;
521 pip install --quiet --upgrade pip
522
523 case $LFTOOLS_MODE in
524     gerrit)
525         git clone https://gerrit.linuxfoundation.org/infra/releng/lftools.git /tmp/lftools
526         pushd /tmp/lftools
527         git fetch origin &quot;$LFTOOLS_REFSPEC&quot;
528         git checkout FETCH_HEAD
529         pip install --quiet --upgrade -r requirements.txt
530         pip install --quiet --upgrade -e .
531         popd
532         ;;
533
534     git)
535         pip install --quiet --upgrade git+https://gerrit.linuxfoundation.org/infra/releng/lftools.git@&quot;$BRANCH&quot;
536         ;;
537
538     release)
539         if [[ $LFTOOLS_VERSION =~ ^[0-9] ]]; then
540             LFTOOLS_VERSION=&quot;==$LFTOOLS_VERSION&quot;
541         fi
542
543         pip install --quiet --upgrade &quot;lftools${LFTOOLS_VERSION}&quot;
544         ;;
545 esac
546
547 lftools --version
548
549 # pipdeptree prints out a lot of information because lftools pulls in many
550 # dependencies. Let's only print it if we want to debug.
551 # echo &quot;----&gt; Pip Dependency Tree&quot;
552 # pip install --quiet --upgrade pipdeptree
553 # pipdeptree
554
555 #!/bin/bash
556 # SPDX-License-Identifier: EPL-1.0
557 ##############################################################################
558 # Copyright (c) 2017 The Linux Foundation and others.
559 #
560 # All rights reserved. This program and the accompanying materials
561 # are made available under the terms of the Eclipse Public License v1.0
562 # which accompanies this distribution, and is available at
563 # http://www.eclipse.org/legal/epl-v10.html
564 ##############################################################################
565 echo &quot;---&gt; logs-deploy.sh&quot;
566
567 # Ensure we fail the job if any steps fail.
568 set -eu -o pipefail
569
570 set -x  # Trace commands for this script to make debugging easier.
571
572 ARCHIVE_ARTIFACTS=&quot;${ARCHIVE_ARTIFACTS:-}&quot;
573 LOGS_SERVER=&quot;${LOGS_SERVER:-None}&quot;
574
575 if [ &quot;${LOGS_SERVER}&quot; == 'None' ]
576 then
577     set +x # Disable trace since we no longer need it
578
579     echo &quot;WARNING: Logging server not set&quot;
580 else
581     NEXUS_URL=&quot;${NEXUSPROXY:-$NEXUS_URL}&quot;
582     NEXUS_PATH=&quot;${SILO}/${JENKINS_HOSTNAME}/${JOB_NAME}/${BUILD_NUMBER}&quot;
583     BUILD_URL=&quot;${BUILD_URL}&quot;
584
585     lftools deploy archives -p &quot;$ARCHIVE_ARTIFACTS&quot; &quot;$NEXUS_URL&quot; &quot;$NEXUS_PATH&quot; &quot;$WORKSPACE&quot;
586     lftools deploy logs &quot;$NEXUS_URL&quot; &quot;$NEXUS_PATH&quot; &quot;$BUILD_URL&quot;
587
588     set +x  # Disable trace since we no longer need it.
589
590     echo &quot;Build logs: &lt;a href=\&quot;$LOGS_SERVER/$NEXUS_PATH\&quot;&gt;$LOGS_SERVER/$NEXUS_PATH&lt;/a&gt;&quot;
591 fi
592 </command>
593         </hudson.tasks.Shell>
594         <hudson.tasks.Shell>
595           <command>#!/bin/bash
596 # SPDX-License-Identifier: EPL-1.0
597 ##############################################################################
598 # Copyright (c) 2017 The Linux Foundation and others.
599 #
600 # All rights reserved. This program and the accompanying materials
601 # are made available under the terms of the Eclipse Public License v1.0
602 # which accompanies this distribution, and is available at
603 # http://www.eclipse.org/legal/epl-v10.html
604 ##############################################################################
605
606 # Clear log credential files
607 rm &quot;$SETTINGS_FILE&quot;
608 rm ~/.netrc
609 </command>
610         </hudson.tasks.Shell>
611         <hudson.plugins.descriptionsetter.DescriptionSetterBuilder>
612           <regexp>^Build logs: .*</regexp>
613         </hudson.plugins.descriptionsetter.DescriptionSetterBuilder>
614       </buildSteps>
615       <scriptOnlyIfSuccess>false</scriptOnlyIfSuccess>
616       <scriptOnlyIfFailure>false</scriptOnlyIfFailure>
617       <markBuildUnstable>false</markBuildUnstable>
618     </org.jenkinsci.plugins.postbuildscript.PostBuildScript>
619     <hudson.plugins.ws__cleanup.WsCleanup plugin="ws-cleanup">
620       <patterns>
621         <hudson.plugins.ws__cleanup.Pattern>
622           <pattern>**/*.jenkins-trigger</pattern>
623           <type>EXCLUDE</type>
624         </hudson.plugins.ws__cleanup.Pattern>
625       </patterns>
626       <deleteDirs>false</deleteDirs>
627       <cleanupMatrixParent>false</cleanupMatrixParent>
628       <externalDelete/>
629       <cleanWhenSuccess>true</cleanWhenSuccess>
630       <cleanWhenUnstable>true</cleanWhenUnstable>
631       <cleanWhenFailure>true</cleanWhenFailure>
632       <cleanWhenNotBuilt>true</cleanWhenNotBuilt>
633       <cleanWhenAborted>true</cleanWhenAborted>
634       <notFailBuild>true</notFailBuild>
635     </hudson.plugins.ws__cleanup.WsCleanup>
636   </publishers>
637   <buildWrappers>
638     <com.michelin.cio.hudson.plugins.maskpasswords.MaskPasswordsBuildWrapper/>
639     <hudson.plugins.build__timeout.BuildTimeoutWrapper>
640       <timeoutMinutes>45</timeoutMinutes>
641       <timeoutEnvVar>BUILD_TIMEOUT</timeoutEnvVar>
642       <failBuild>true</failBuild>
643       <writingDescription>false</writingDescription>
644       <timeoutPercentage>0</timeoutPercentage>
645       <timeoutMinutesElasticDefault>3</timeoutMinutesElasticDefault>
646       <timeoutType>absolute</timeoutType>
647     </hudson.plugins.build__timeout.BuildTimeoutWrapper>
648     <hudson.plugins.timestamper.TimestamperBuildWrapper/>
649     <com.cloudbees.jenkins.plugins.sshagent.SSHAgentBuildWrapper>
650       <user>test-credential</user>
651     </com.cloudbees.jenkins.plugins.sshagent.SSHAgentBuildWrapper>
652     <jenkins.plugins.openstack.compute.JCloudsOneOffSlave/>
653     <org.jenkinsci.plugins.configfiles.buildwrapper.ConfigFileBuildWrapper plugin="config-file-provider">
654       <managedFiles>
655         <org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
656           <fileId>npmrc</fileId>
657           <targetLocation>$HOME/.npmrc</targetLocation>
658           <variable/>
659         </org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
660       </managedFiles>
661     </org.jenkinsci.plugins.configfiles.buildwrapper.ConfigFileBuildWrapper>
662   </buildWrappers>
663 </project>