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