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