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