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