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