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