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