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