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