Fix branch on verify and merge jobs
[releng/global-jjb.git] / .jjb-test / expected-xml / github-maven-maven-verify-master-mvn33-openjdk8
1 <?xml version="1.0" encoding="utf-8"?>
2 <project>
3   <jdk>openjdk8</jdk>
4   <actions/>
5   <description>&lt;!-- Managed by Jenkins Job Builder --&gt;</description>
6   <keepDependencies>false</keepDependencies>
7   <blockBuildWhenDownstreamBuilding>false</blockBuildWhenDownstreamBuilding>
8   <blockBuildWhenUpstreamBuilding>false</blockBuildWhenUpstreamBuilding>
9   <concurrentBuild>true</concurrentBuild>
10   <assignedNode>build-vm</assignedNode>
11   <canRoam>false</canRoam>
12   <properties>
13     <com.coravy.hudson.plugins.github.GithubProjectProperty>
14       <projectUrl>$GIT_URL/$PROJECT/example-org/releng/ciman</projectUrl>
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>M2_HOME</name>
74           <description>Maven selector to be used by shell scripts</description>
75           <defaultValue>/w/tools/hudson.tasks.Maven_MavenInstallation/mvn33</defaultValue>
76         </hudson.model.StringParameterDefinition>
77         <hudson.model.StringParameterDefinition>
78           <name>MAVEN_OPTS</name>
79           <description>Maven Java opts. Example: -Xmx1024m -XX:MaxPermSize=256m
80 </description>
81           <defaultValue/>
82         </hudson.model.StringParameterDefinition>
83         <hudson.model.StringParameterDefinition>
84           <name>MAVEN_PARAMS</name>
85           <description>Maven parameters to pass to the mvn command.
86 </description>
87           <defaultValue>-Dstream=$STREAM</defaultValue>
88         </hudson.model.StringParameterDefinition>
89         <hudson.model.StringParameterDefinition>
90           <name>MVN</name>
91           <description>Maven selector to be used by shell scripts</description>
92           <defaultValue>/w/tools/hudson.tasks.Maven_MavenInstallation/mvn33/bin/mvn</defaultValue>
93         </hudson.model.StringParameterDefinition>
94         <hudson.model.StringParameterDefinition>
95           <name>STAGING_PROFILE_ID</name>
96           <description>Nexus staging profile ID.
97 </description>
98           <defaultValue>uuddlrlrba</defaultValue>
99         </hudson.model.StringParameterDefinition>
100         <hudson.model.StringParameterDefinition>
101           <name>ARCHIVE_ARTIFACTS</name>
102           <description>Artifacts to archive to the logs server.</description>
103           <defaultValue/>
104         </hudson.model.StringParameterDefinition>
105       </parameterDefinitions>
106     </hudson.model.ParametersDefinitionProperty>
107   </properties>
108   <scm class="hudson.plugins.git.GitSCM">
109     <configVersion>2</configVersion>
110     <userRemoteConfigs>
111       <hudson.plugins.git.UserRemoteConfig>
112         <name>origin</name>
113         <refspec>+refs/pull/*:refs/remotes/origin/pr/*</refspec>
114         <url>git@github.com:example-org/releng/ciman</url>
115         <credentialsId>test-credential</credentialsId>
116       </hudson.plugins.git.UserRemoteConfig>
117     </userRemoteConfigs>
118     <branches>
119       <hudson.plugins.git.BranchSpec>
120         <name>$sha1</name>
121       </hudson.plugins.git.BranchSpec>
122     </branches>
123     <excludedUsers/>
124     <buildChooser class="hudson.plugins.git.util.DefaultBuildChooser"/>
125     <doGenerateSubmoduleConfigurations>false</doGenerateSubmoduleConfigurations>
126     <authorOrCommitter>false</authorOrCommitter>
127     <wipeOutWorkspace>true</wipeOutWorkspace>
128     <pruneBranches>false</pruneBranches>
129     <remotePoll>false</remotePoll>
130     <gitTool>Default</gitTool>
131     <submoduleCfg class="list"/>
132     <relativeTargetDir/>
133     <reference/>
134     <gitConfigName/>
135     <gitConfigEmail/>
136     <skipTag>true</skipTag>
137     <scmName/>
138     <useShallowClone>false</useShallowClone>
139     <ignoreNotifyCommit>false</ignoreNotifyCommit>
140     <extensions>
141       <hudson.plugins.git.extensions.impl.SubmoduleOption>
142         <disableSubmodules>false</disableSubmodules>
143         <recursiveSubmodules>true</recursiveSubmodules>
144         <trackingSubmodules>false</trackingSubmodules>
145         <reference/>
146         <timeout>10</timeout>
147       </hudson.plugins.git.extensions.impl.SubmoduleOption>
148       <hudson.plugins.git.extensions.impl.WipeWorkspace/>
149     </extensions>
150   </scm>
151   <triggers class="vector">
152     <org.jenkinsci.plugins.ghprb.GhprbTrigger>
153       <spec/>
154       <adminlist/>
155       <allowMembersOfWhitelistedOrgsAsAdmin>false</allowMembersOfWhitelistedOrgsAsAdmin>
156       <whitelist/>
157       <orgslist/>
158       <cron/>
159       <triggerPhrase>^recheck$</triggerPhrase>
160       <onlyTriggerPhrase>false</onlyTriggerPhrase>
161       <useGitHubHooks>true</useGitHubHooks>
162       <permitAll>true</permitAll>
163       <autoCloseFailedPullRequests>false</autoCloseFailedPullRequests>
164       <extensions>
165         <org.jenkinsci.plugins.ghprb.extensions.status.GhprbSimpleStatus>
166           <commitStatusContext>Maven Verify</commitStatusContext>
167         </org.jenkinsci.plugins.ghprb.extensions.status.GhprbSimpleStatus>
168       </extensions>
169     </org.jenkinsci.plugins.ghprb.GhprbTrigger>
170   </triggers>
171   <builders>
172     <hudson.tasks.Shell>
173       <command>mkdir -p $WORKSPACE/target/classes $WORKSPACE/jacoco/classes</command>
174     </hudson.tasks.Shell>
175     <hudson.tasks.Shell>
176       <command>echo &quot;quiet=on&quot; &gt; &quot;$HOME/.wgetrc&quot;</command>
177     </hudson.tasks.Shell>
178     <hudson.tasks.Maven>
179       <targets>--version</targets>
180       <properties/>
181       <mavenName>mvn33</mavenName>
182       <usePrivateRepository>false</usePrivateRepository>
183       <settings class="jenkins.mvn.DefaultSettingsProvider"/>
184       <globalSettings class="jenkins.mvn.DefaultGlobalSettingsProvider"/>
185     </hudson.tasks.Maven>
186     <hudson.tasks.Shell>
187       <command>rm &quot;$HOME/.wgetrc&quot;</command>
188     </hudson.tasks.Shell>
189     <org.jenkinsci.plugins.configfiles.builder.ConfigFileBuildStep plugin="config-file-provider">
190       <managedFiles>
191         <org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
192           <fileId>global-settings</fileId>
193           <targetLocation/>
194           <variable>GLOBAL_SETTINGS_FILE</variable>
195         </org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
196         <org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
197           <fileId>aproject-settings</fileId>
198           <targetLocation/>
199           <variable>SETTINGS_FILE</variable>
200         </org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
201       </managedFiles>
202     </org.jenkinsci.plugins.configfiles.builder.ConfigFileBuildStep>
203     <hudson.tasks.Shell>
204       <command>#!/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; lftools-install.sh&quot;
215
216 # Script to install lftools via a version passed in via lf-infra-parameters
217 #
218 # Required parameters:
219 #
220 #     LFTOOLS_VERSION: Passed in via lf-infra-parameters configuration. Can be
221 #                      set to a strict version number like '1.2.3' or using
222 #                      PEP-440 definitions.
223 #
224 #                      Examples:
225 #                          &lt;1.0.0
226 #                          &gt;=1.0.0,&lt;2.0.0
227 #
228 # By default a released version of lftools should always be used.
229 # The purpose of the 2 variables below is so that lftools devs can test
230 # unreleased versions of lftools. There are 2 methods to install a dev version
231 # of lftools:
232 #
233 #     1) gerrit patch: Used to test a patch that has not yet been merged.
234 #                      To do this set something like this:
235 #                          LFTOOLS_MODE=gerrit
236 #                          LFTOOLS_REFSPEC=refs/changes/96/5296/7
237 #
238 #     2) git branch: Used to install an lftools version from a specific branch.
239 #                    To use this set the variables as follows:
240 #                          LFTOOLS_MODE=git
241 #                          LFTOOLS_REFSPEC=master
242 #
243 #     3) release : The intended use case and default setting.
244 #                  Set LFTOOLS_MODE=release, in this case LFTOOLS_REFSPEC is unused.
245
246 LFTOOLS_MODE=release  # release | git | gerrit
247 LFTOOLS_REFSPEC=master
248
249 # Ensure we fail the job if any steps fail.
250 # DO NOT set -u as virtualenv's activate script has unbound variables
251 set -e -o pipefail
252
253 virtualenv --quiet &quot;/tmp/v/lftools&quot;
254 # shellcheck source=/tmp/v/lftools/bin/activate disable=SC1091
255 source &quot;/tmp/v/lftools/bin/activate&quot;
256 pip install --quiet --upgrade pip
257
258 case $LFTOOLS_MODE in
259     gerrit)
260         git clone https://gerrit.linuxfoundation.org/infra/releng/lftools.git /tmp/lftools
261         pushd /tmp/lftools
262         git fetch origin &quot;$LFTOOLS_REFSPEC&quot;
263         git checkout FETCH_HEAD
264         pip install --quiet --upgrade -r requirements.txt
265         pip install --quiet --upgrade -e .
266         popd
267         ;;
268
269     git)
270         pip install --quiet --upgrade git+https://gerrit.linuxfoundation.org/infra/releng/lftools.git@&quot;$BRANCH&quot;
271         ;;
272
273     release)
274         if [[ $LFTOOLS_VERSION =~ ^[0-9] ]]; then
275             LFTOOLS_VERSION=&quot;==$LFTOOLS_VERSION&quot;
276         fi
277
278         pip install --quiet --upgrade &quot;lftools${LFTOOLS_VERSION}&quot;
279         ;;
280 esac
281
282 lftools --version
283
284 # pipdeptree prints out a lot of information because lftools pulls in many
285 # dependencies. Let's only print it if we want to debug.
286 # echo &quot;----&gt; Pip Dependency Tree&quot;
287 # pip install --quiet --upgrade pipdeptree
288 # pipdeptree
289
290 #!/bin/bash
291 # SPDX-License-Identifier: EPL-1.0
292 ##############################################################################
293 # Copyright (c) 2017 The Linux Foundation and others.
294 #
295 # All rights reserved. This program and the accompanying materials
296 # are made available under the terms of the Eclipse Public License v1.0
297 # which accompanies this distribution, and is available at
298 # http://www.eclipse.org/legal/epl-v10.html
299 ##############################################################################
300
301 # This file contains a list of variables that are generally useful in many
302 # scripts. It is meant to be sourced in other scripts so that the variables can
303 # be called.
304
305 MAVEN_OPTIONS=&quot;$(echo --show-version \
306     --batch-mode \
307     -Djenkins \
308     -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn \
309     -Dmaven.repo.local=/tmp/r \
310     -Dorg.ops4j.pax.url.mvn.localRepository=/tmp/r)&quot;
311 echo &quot;$MAVEN_OPTIONS&quot;
312
313 #!/bin/bash
314 # SPDX-License-Identifier: EPL-1.0
315 ##############################################################################
316 # Copyright (c) 2017 The Linux Foundation and others.
317 #
318 # All rights reserved. This program and the accompanying materials
319 # are made available under the terms of the Eclipse Public License v1.0
320 # which accompanies this distribution, and is available at
321 # http://www.eclipse.org/legal/epl-v10.html
322 ##############################################################################
323
324 # This script builds a Maven project and deploys it into a staging repo which
325 # can be used to deploy elsewhere later eg. Nexus staging / snapshot repos.
326
327 # DO NOT enable -u because $MAVEN_PARAMS and $MAVEN_OPTIONS could be unbound.
328 # Ensure we fail the job if any steps fail.
329 set -e -o pipefail
330 set +u
331
332 export MAVEN_OPTS
333
334 # Disable SC2086 because we want to allow word splitting for $MAVEN_* parameters.
335 # shellcheck disable=SC2086
336 $MVN clean deploy \
337     --global-settings &quot;$GLOBAL_SETTINGS_FILE&quot; \
338     --settings &quot;$SETTINGS_FILE&quot; \
339     -DaltDeploymentRepository=staging::default::file:&quot;$WORKSPACE&quot;/m2repo \
340     $MAVEN_PARAMS $MAVEN_OPTIONS
341 </command>
342     </hudson.tasks.Shell>
343     <hudson.tasks.Shell>
344       <command>#!/bin/bash
345 set +e  # DO NOT cause build failure if any of the rm calls fail.
346
347 rm &quot;$GLOBAL_SETTINGS_FILE&quot; &quot;$SETTINGS_FILE&quot;
348
349 # In some cases we use the lf-provide-maven-settings macro to produce
350 # a &quot;$HOME/.netrc&quot; file containing credentials. Remove that file here
351 # too if it exists.
352 rm &quot;$HOME/.netrc&quot;
353
354 # DO NOT fail build if any of the above lines fail.
355 exit 0
356 </command>
357     </hudson.tasks.Shell>
358   </builders>
359   <publishers>
360     <hudson.plugins.findbugs.FindBugsPublisher plugin="findbugs">
361       <isRankActivated>false</isRankActivated>
362       <includePattern/>
363       <excludePattern/>
364       <healthy/>
365       <unHealthy/>
366       <thresholdLimit>low</thresholdLimit>
367       <pluginName>[FINDBUGS] </pluginName>
368       <defaultEncoding/>
369       <canRunOnFailed>false</canRunOnFailed>
370       <useStableBuildAsReference>false</useStableBuildAsReference>
371       <usePreviousBuildAsReference>false</usePreviousBuildAsReference>
372       <useDeltaValues>false</useDeltaValues>
373       <thresholds>
374         <unstableTotalAll/>
375         <unstableTotalHigh/>
376         <unstableTotalNormal/>
377         <unstableTotalLow/>
378         <failedTotalAll/>
379         <failedTotalHigh/>
380         <failedTotalNormal/>
381         <failedTotalLow/>
382       </thresholds>
383       <shouldDetectModules>false</shouldDetectModules>
384       <dontComputeNew>true</dontComputeNew>
385       <doNotResolveRelativePaths>false</doNotResolveRelativePaths>
386       <pattern/>
387     </hudson.plugins.findbugs.FindBugsPublisher>
388     <hudson.plugins.jacoco.JacocoPublisher>
389       <execPattern>**/**.exec</execPattern>
390       <classPattern>**/classes</classPattern>
391       <sourcePattern>**/src/main/java</sourcePattern>
392       <changeBuildStatus/>
393       <inclusionPattern/>
394       <exclusionPattern>**/gen/**,**/generated-sources/**,**/yang-gen**,**/pax/**</exclusionPattern>
395       <maximumBranchCoverage>10</maximumBranchCoverage>
396       <minimumBranchCoverage>20</minimumBranchCoverage>
397       <maximumMethodCoverage>50</maximumMethodCoverage>
398       <minimumMethodCoverage>40</minimumMethodCoverage>
399     </hudson.plugins.jacoco.JacocoPublisher>
400     <org.jenkinsci.plugins.postbuildscript.PostBuildScript>
401       <buildSteps>
402         <hudson.tasks.Shell>
403           <command>#!/bin/bash
404 # SPDX-License-Identifier: EPL-1.0
405 ##############################################################################
406 # Copyright (c) 2017 The Linux Foundation and others.
407 #
408 # All rights reserved. This program and the accompanying materials
409 # are made available under the terms of the Eclipse Public License v1.0
410 # which accompanies this distribution, and is available at
411 # http://www.eclipse.org/legal/epl-v10.html
412 ##############################################################################
413 echo &quot;---&gt; sysstat.sh&quot;
414 set +e  # DON'T fail build if script fails.
415
416 OS=$(facter operatingsystem)
417 case &quot;$OS&quot; in
418     Ubuntu)
419         SYSSTAT_PATH=&quot;/var/log/sysstat&quot;
420
421         # Dont run the script when systat is not enabled by default
422         if ! grep --quiet 'ENABLED=&quot;true&quot;' &quot;/etc/default/sysstat&quot;; then
423             exit 0
424         fi
425     ;;
426     CentOS|RedHat)
427         SYSSTAT_PATH=&quot;/var/log/sa&quot;
428     ;;
429     *)
430         # nothing to do
431         exit 0
432     ;;
433 esac
434
435 SAR_DIR=&quot;$WORKSPACE/archives/sar-reports&quot;
436 mkdir -p &quot;$SAR_DIR&quot;
437 cp &quot;$SYSSTAT_PATH/&quot;* &quot;$_&quot;
438 # convert sar data to ascii format
439 while IFS=&quot;&quot; read -r s
440 do
441     [ -f &quot;$s&quot; ] &amp;&amp; LC_TIME=POSIX sar -A -f &quot;$s&quot; &gt; &quot;$SAR_DIR/sar${s//[!0-9]/}&quot;
442 done &lt; &lt;(find &quot;$SYSSTAT_PATH&quot; -name &quot;sa[0-9]*&quot; || true)
443
444 # DON'T fail build if script fails.
445 exit 0
446 </command>
447         </hudson.tasks.Shell>
448         <org.jenkinsci.plugins.configfiles.builder.ConfigFileBuildStep plugin="config-file-provider">
449           <managedFiles>
450             <org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
451               <fileId>jenkins-log-archives-settings</fileId>
452               <targetLocation/>
453               <variable>SETTINGS_FILE</variable>
454             </org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
455           </managedFiles>
456         </org.jenkinsci.plugins.configfiles.builder.ConfigFileBuildStep>
457         <EnvInjectBuilder>
458           <info>
459             <propertiesContent>SERVER_ID=logs</propertiesContent>
460           </info>
461         </EnvInjectBuilder>
462         <hudson.tasks.Shell>
463           <command>#!/bin/bash
464 # SPDX-License-Identifier: EPL-1.0
465 ##############################################################################
466 # Copyright (c) 2017 The Linux Foundation and others.
467 #
468 # All rights reserved. This program and the accompanying materials
469 # are made available under the terms of the Eclipse Public License v1.0
470 # which accompanies this distribution, and is available at
471 # http://www.eclipse.org/legal/epl-v10.html
472 ##############################################################################
473 echo &quot;---&gt; create-netrc.sh&quot;
474
475 # Ensure we fail the job if any steps fail.
476 set -eu -o pipefail
477
478 NEXUS_URL=&quot;${NEXUSPROXY:-$NEXUS_URL}&quot;
479 CREDENTIAL=$(xmlstarlet sel -N &quot;x=http://maven.apache.org/SETTINGS/1.0.0&quot; \
480     -t -m &quot;/x:settings/x:servers/x:server[x:id='${SERVER_ID}']&quot; \
481     -v x:username -o &quot;:&quot; -v x:password \
482     &quot;$SETTINGS_FILE&quot;)
483
484 machine=$(echo &quot;$NEXUS_URL&quot; | awk -F/ '{print $3}')
485 user=$(echo &quot;$CREDENTIAL&quot; | cut -f1 -d:)
486 pass=$(echo &quot;$CREDENTIAL&quot; | cut -f2 -d:)
487
488 echo &quot;machine ${machine%:*} login $user password $pass&quot; &gt; ~/.netrc
489 </command>
490         </hudson.tasks.Shell>
491         <hudson.tasks.Shell>
492           <command>#!/bin/bash
493 # SPDX-License-Identifier: EPL-1.0
494 ##############################################################################
495 # Copyright (c) 2017 The Linux Foundation and others.
496 #
497 # All rights reserved. This program and the accompanying materials
498 # are made available under the terms of the Eclipse Public License v1.0
499 # which accompanies this distribution, and is available at
500 # http://www.eclipse.org/legal/epl-v10.html
501 ##############################################################################
502 echo &quot;---&gt; lftools-install.sh&quot;
503
504 # Script to install lftools via a version passed in via lf-infra-parameters
505 #
506 # Required parameters:
507 #
508 #     LFTOOLS_VERSION: Passed in via lf-infra-parameters configuration. Can be
509 #                      set to a strict version number like '1.2.3' or using
510 #                      PEP-440 definitions.
511 #
512 #                      Examples:
513 #                          &lt;1.0.0
514 #                          &gt;=1.0.0,&lt;2.0.0
515 #
516 # By default a released version of lftools should always be used.
517 # The purpose of the 2 variables below is so that lftools devs can test
518 # unreleased versions of lftools. There are 2 methods to install a dev version
519 # of lftools:
520 #
521 #     1) gerrit patch: Used to test a patch that has not yet been merged.
522 #                      To do this set something like this:
523 #                          LFTOOLS_MODE=gerrit
524 #                          LFTOOLS_REFSPEC=refs/changes/96/5296/7
525 #
526 #     2) git branch: Used to install an lftools version from a specific branch.
527 #                    To use this set the variables as follows:
528 #                          LFTOOLS_MODE=git
529 #                          LFTOOLS_REFSPEC=master
530 #
531 #     3) release : The intended use case and default setting.
532 #                  Set LFTOOLS_MODE=release, in this case LFTOOLS_REFSPEC is unused.
533
534 LFTOOLS_MODE=release  # release | git | gerrit
535 LFTOOLS_REFSPEC=master
536
537 # Ensure we fail the job if any steps fail.
538 # DO NOT set -u as virtualenv's activate script has unbound variables
539 set -e -o pipefail
540
541 virtualenv --quiet &quot;/tmp/v/lftools&quot;
542 # shellcheck source=/tmp/v/lftools/bin/activate disable=SC1091
543 source &quot;/tmp/v/lftools/bin/activate&quot;
544 pip install --quiet --upgrade pip
545
546 case $LFTOOLS_MODE in
547     gerrit)
548         git clone https://gerrit.linuxfoundation.org/infra/releng/lftools.git /tmp/lftools
549         pushd /tmp/lftools
550         git fetch origin &quot;$LFTOOLS_REFSPEC&quot;
551         git checkout FETCH_HEAD
552         pip install --quiet --upgrade -r requirements.txt
553         pip install --quiet --upgrade -e .
554         popd
555         ;;
556
557     git)
558         pip install --quiet --upgrade git+https://gerrit.linuxfoundation.org/infra/releng/lftools.git@&quot;$BRANCH&quot;
559         ;;
560
561     release)
562         if [[ $LFTOOLS_VERSION =~ ^[0-9] ]]; then
563             LFTOOLS_VERSION=&quot;==$LFTOOLS_VERSION&quot;
564         fi
565
566         pip install --quiet --upgrade &quot;lftools${LFTOOLS_VERSION}&quot;
567         ;;
568 esac
569
570 lftools --version
571
572 # pipdeptree prints out a lot of information because lftools pulls in many
573 # dependencies. Let's only print it if we want to debug.
574 # echo &quot;----&gt; Pip Dependency Tree&quot;
575 # pip install --quiet --upgrade pipdeptree
576 # pipdeptree
577
578 #!/bin/bash
579 # SPDX-License-Identifier: EPL-1.0
580 ##############################################################################
581 # Copyright (c) 2017 The Linux Foundation and others.
582 #
583 # All rights reserved. This program and the accompanying materials
584 # are made available under the terms of the Eclipse Public License v1.0
585 # which accompanies this distribution, and is available at
586 # http://www.eclipse.org/legal/epl-v10.html
587 ##############################################################################
588 echo &quot;---&gt; logs-deploy.sh&quot;
589
590 # Ensure we fail the job if any steps fail.
591 set -eu -o pipefail
592
593 set -x  # Trace commands for this script to make debugging easier.
594
595 ARCHIVE_ARTIFACTS=&quot;${ARCHIVE_ARTIFACTS:-}&quot;
596 LOGS_SERVER=&quot;${LOGS_SERVER:-None}&quot;
597
598 if [ &quot;${LOGS_SERVER}&quot; == 'None' ]
599 then
600     set +x # Disable trace since we no longer need it
601
602     echo &quot;WARNING: Logging server not set&quot;
603 else
604     NEXUS_URL=&quot;${NEXUSPROXY:-$NEXUS_URL}&quot;
605     NEXUS_PATH=&quot;${SILO}/${JENKINS_HOSTNAME}/${JOB_NAME}/${BUILD_NUMBER}&quot;
606     BUILD_URL=&quot;${BUILD_URL}&quot;
607
608     lftools deploy archives -p &quot;$ARCHIVE_ARTIFACTS&quot; &quot;$NEXUS_URL&quot; &quot;$NEXUS_PATH&quot; &quot;$WORKSPACE&quot;
609     lftools deploy logs &quot;$NEXUS_URL&quot; &quot;$NEXUS_PATH&quot; &quot;$BUILD_URL&quot;
610
611     set +x  # Disable trace since we no longer need it.
612
613     echo &quot;Build logs: &lt;a href=\&quot;$LOGS_SERVER/$NEXUS_PATH\&quot;&gt;$LOGS_SERVER/$NEXUS_PATH&lt;/a&gt;&quot;
614 fi
615 </command>
616         </hudson.tasks.Shell>
617         <hudson.tasks.Shell>
618           <command>#!/bin/bash
619 # SPDX-License-Identifier: EPL-1.0
620 ##############################################################################
621 # Copyright (c) 2017 The Linux Foundation and others.
622 #
623 # All rights reserved. This program and the accompanying materials
624 # are made available under the terms of the Eclipse Public License v1.0
625 # which accompanies this distribution, and is available at
626 # http://www.eclipse.org/legal/epl-v10.html
627 ##############################################################################
628
629 # Clear log credential files
630 rm &quot;$SETTINGS_FILE&quot;
631 rm ~/.netrc
632 </command>
633         </hudson.tasks.Shell>
634         <hudson.plugins.descriptionsetter.DescriptionSetterBuilder>
635           <regexp>^Build logs: .*</regexp>
636         </hudson.plugins.descriptionsetter.DescriptionSetterBuilder>
637       </buildSteps>
638       <scriptOnlyIfSuccess>false</scriptOnlyIfSuccess>
639       <scriptOnlyIfFailure>false</scriptOnlyIfFailure>
640       <markBuildUnstable>false</markBuildUnstable>
641     </org.jenkinsci.plugins.postbuildscript.PostBuildScript>
642     <hudson.plugins.ws__cleanup.WsCleanup plugin="ws-cleanup">
643       <patterns>
644         <hudson.plugins.ws__cleanup.Pattern>
645           <pattern>**/*.jenkins-trigger</pattern>
646           <type>EXCLUDE</type>
647         </hudson.plugins.ws__cleanup.Pattern>
648       </patterns>
649       <deleteDirs>false</deleteDirs>
650       <cleanupMatrixParent>false</cleanupMatrixParent>
651       <externalDelete/>
652       <cleanWhenSuccess>true</cleanWhenSuccess>
653       <cleanWhenUnstable>true</cleanWhenUnstable>
654       <cleanWhenFailure>true</cleanWhenFailure>
655       <cleanWhenNotBuilt>true</cleanWhenNotBuilt>
656       <cleanWhenAborted>true</cleanWhenAborted>
657       <notFailBuild>true</notFailBuild>
658     </hudson.plugins.ws__cleanup.WsCleanup>
659   </publishers>
660   <buildWrappers>
661     <com.michelin.cio.hudson.plugins.maskpasswords.MaskPasswordsBuildWrapper/>
662     <hudson.plugins.build__timeout.BuildTimeoutWrapper>
663       <timeoutMinutes>60</timeoutMinutes>
664       <timeoutEnvVar>BUILD_TIMEOUT</timeoutEnvVar>
665       <failBuild>true</failBuild>
666       <writingDescription>false</writingDescription>
667       <timeoutPercentage>0</timeoutPercentage>
668       <timeoutMinutesElasticDefault>3</timeoutMinutesElasticDefault>
669       <timeoutType>absolute</timeoutType>
670     </hudson.plugins.build__timeout.BuildTimeoutWrapper>
671     <hudson.plugins.timestamper.TimestamperBuildWrapper/>
672     <com.cloudbees.jenkins.plugins.sshagent.SSHAgentBuildWrapper>
673       <user>test-credential</user>
674     </com.cloudbees.jenkins.plugins.sshagent.SSHAgentBuildWrapper>
675     <jenkins.plugins.openstack.compute.JCloudsOneOffSlave/>
676     <org.jenkinsci.plugins.configfiles.buildwrapper.ConfigFileBuildWrapper plugin="config-file-provider">
677       <managedFiles>
678         <org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
679           <fileId>npmrc</fileId>
680           <targetLocation>$HOME/.npmrc</targetLocation>
681           <variable/>
682         </org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
683       </managedFiles>
684     </org.jenkinsci.plugins.configfiles.buildwrapper.ConfigFileBuildWrapper>
685   </buildWrappers>
686 </project>