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