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