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