Add Maven CLM tests
[releng/global-jjb.git] / jjb-test / expected-xml / github-maven-maven-clm-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     <com.coravy.hudson.plugins.github.GithubProjectProperty>
14       <projectUrl>$GIT_URL/$PROJECT/example-org/releng/ciman</projectUrl>
15     </com.coravy.hudson.plugins.github.GithubProjectProperty>
16     <hudson.model.ParametersDefinitionProperty>
17       <parameterDefinitions>
18         <hudson.model.StringParameterDefinition>
19           <name>PROJECT</name>
20           <description>Parameter to identify a Gerrit project. This is typically the
21 project repo path as exists in Gerrit.
22 For example: ofextensions/circuitsw
23 </description>
24           <defaultValue>releng/ciman</defaultValue>
25         </hudson.model.StringParameterDefinition>
26         <hudson.model.StringParameterDefinition>
27           <name>STREAM</name>
28           <description>Stream is often set to the same name as 'branch' but can
29 sometimes be used as a name representing a project's release code
30 name.
31 </description>
32           <defaultValue>master</defaultValue>
33         </hudson.model.StringParameterDefinition>
34         <hudson.model.StringParameterDefinition>
35           <name>GERRIT_PROJECT</name>
36           <description>Parameter to identify Gerrit project. This is typically the
37 project repo path as exists in Gerrit.
38 For example: ofextensions/circuitsw
39
40 Note that Gerrit will override this parameter automatically if a
41 job is triggered by Gerrit.
42 </description>
43           <defaultValue>releng/ciman</defaultValue>
44         </hudson.model.StringParameterDefinition>
45         <hudson.model.StringParameterDefinition>
46           <name>GERRIT_BRANCH</name>
47           <description>Parameter to identify a Gerrit branch.
48
49 Note that Gerrit will override this parameter automatically if a
50 job is triggered by Gerrit.
51 </description>
52           <defaultValue>master</defaultValue>
53         </hudson.model.StringParameterDefinition>
54         <hudson.model.StringParameterDefinition>
55           <name>GERRIT_REFSPEC</name>
56           <description>Parameter to identify a refspec when pulling from Gerrit.
57
58 Note that Gerrit will override this parameter automatically if a
59 job is triggered by Gerrit.
60 </description>
61           <defaultValue/>
62         </hudson.model.StringParameterDefinition>
63         <hudson.model.StringParameterDefinition>
64           <name>MAVEN_OPTS</name>
65           <description>Maven Java opts. Example: -Xmx1024m -XX:MaxPermSize=256m
66 </description>
67           <defaultValue/>
68         </hudson.model.StringParameterDefinition>
69         <hudson.model.StringParameterDefinition>
70           <name>MAVEN_PARAMS</name>
71           <description>Maven parameters to pass to the mvn command.
72 </description>
73           <defaultValue/>
74         </hudson.model.StringParameterDefinition>
75         <hudson.model.StringParameterDefinition>
76           <name>MVN</name>
77           <description>Maven selector to be used by shell scripts</description>
78           <defaultValue>/w/tools/hudson.tasks.Maven_MavenInstallation/mvn33/bin/mvn</defaultValue>
79         </hudson.model.StringParameterDefinition>
80         <hudson.model.StringParameterDefinition>
81           <name>STAGING_PROFILE_ID</name>
82           <description>Nexus staging profile ID.
83 </description>
84           <defaultValue>uuddlrlrba</defaultValue>
85         </hudson.model.StringParameterDefinition>
86       </parameterDefinitions>
87     </hudson.model.ParametersDefinitionProperty>
88   </properties>
89   <scm class="hudson.plugins.git.GitSCM">
90     <configVersion>2</configVersion>
91     <userRemoteConfigs>
92       <hudson.plugins.git.UserRemoteConfig>
93         <name>origin</name>
94         <refspec>+refs/pull/*:refs/remotes/origin/pr/*</refspec>
95         <url>git@github.com:example-org/releng/ciman</url>
96         <credentialsId>test-credential</credentialsId>
97       </hudson.plugins.git.UserRemoteConfig>
98     </userRemoteConfigs>
99     <branches>
100       <hudson.plugins.git.BranchSpec>
101         <name>**</name>
102       </hudson.plugins.git.BranchSpec>
103     </branches>
104     <excludedUsers/>
105     <buildChooser class="hudson.plugins.git.util.DefaultBuildChooser"/>
106     <doGenerateSubmoduleConfigurations>false</doGenerateSubmoduleConfigurations>
107     <authorOrCommitter>false</authorOrCommitter>
108     <wipeOutWorkspace>true</wipeOutWorkspace>
109     <pruneBranches>false</pruneBranches>
110     <remotePoll>false</remotePoll>
111     <gitTool>Default</gitTool>
112     <submoduleCfg class="list"/>
113     <relativeTargetDir/>
114     <reference/>
115     <gitConfigName/>
116     <gitConfigEmail/>
117     <skipTag>true</skipTag>
118     <scmName/>
119     <useShallowClone>false</useShallowClone>
120     <ignoreNotifyCommit>false</ignoreNotifyCommit>
121     <extensions>
122       <hudson.plugins.git.extensions.impl.SubmoduleOption>
123         <disableSubmodules>false</disableSubmodules>
124         <recursiveSubmodules>true</recursiveSubmodules>
125         <trackingSubmodules>false</trackingSubmodules>
126         <reference/>
127         <timeout>10</timeout>
128       </hudson.plugins.git.extensions.impl.SubmoduleOption>
129       <hudson.plugins.git.extensions.impl.WipeWorkspace/>
130     </extensions>
131   </scm>
132   <triggers class="vector">
133     <hudson.triggers.TimerTrigger>
134       <spec>H H * * 6</spec>
135     </hudson.triggers.TimerTrigger>
136   </triggers>
137   <builders>
138     <hudson.tasks.Shell>
139       <command>echo &quot;quiet=on&quot; &gt; &quot;$HOME/.wgetrc&quot;</command>
140     </hudson.tasks.Shell>
141     <hudson.tasks.Maven>
142       <targets>--version</targets>
143       <properties/>
144       <mavenName>mvn33</mavenName>
145       <usePrivateRepository>false</usePrivateRepository>
146       <settings class="jenkins.mvn.DefaultSettingsProvider"/>
147       <globalSettings class="jenkins.mvn.DefaultGlobalSettingsProvider"/>
148     </hudson.tasks.Maven>
149     <hudson.tasks.Shell>
150       <command>rm &quot;$HOME/.wgetrc&quot;</command>
151     </hudson.tasks.Shell>
152     <org.jenkinsci.plugins.configfiles.builder.ConfigFileBuildStep plugin="config-file-provider">
153       <managedFiles>
154         <org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
155           <fileId>global-settings</fileId>
156           <targetLocation/>
157           <variable>GLOBAL_SETTINGS_FILE</variable>
158         </org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
159         <org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
160           <fileId>aproject-settings</fileId>
161           <targetLocation/>
162           <variable>SETTINGS_FILE</variable>
163         </org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
164       </managedFiles>
165     </org.jenkinsci.plugins.configfiles.builder.ConfigFileBuildStep>
166     <hudson.tasks.Shell>
167       <command>#!/bin/bash
168 # SPDX-License-Identifier: EPL-1.0
169 ##############################################################################
170 # Copyright (c) 2017 The Linux Foundation and others.
171 #
172 # All rights reserved. This program and the accompanying materials
173 # are made available under the terms of the Eclipse Public License v1.0
174 # which accompanies this distribution, and is available at
175 # http://www.eclipse.org/legal/epl-v10.html
176 ##############################################################################
177
178 # This file contains a list of variables that are generally useful in many
179 # scripts. It is meant to be sourced in other scripts so that the variables can
180 # be called.
181
182 MAVEN_OPTIONS=&quot;$(echo --show-version \
183     --batch-mode \
184     -Djenkins \
185     -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn \
186     -Dmaven.repo.local=/tmp/r \
187     -Dorg.ops4j.pax.url.mvn.localRepository=/tmp/r)&quot;
188 echo &quot;$MAVEN_OPTIONS&quot;
189
190 #!/bin/bash
191 # SPDX-License-Identifier: EPL-1.0
192 ##############################################################################
193 # Copyright (c) 2017 The Linux Foundation and others.
194 #
195 # All rights reserved. This program and the accompanying materials
196 # are made available under the terms of the Eclipse Public License v1.0
197 # which accompanies this distribution, and is available at
198 # http://www.eclipse.org/legal/epl-v10.html
199 ##############################################################################
200
201 # This script builds a Maven project and deploys it into a staging repo which
202 # can be used to deploy elsewhere later eg. Nexus staging / snapshot repos.
203
204 # DO NOT enable -u because $MAVEN_PARAMS and $MAVEN_OPTIONS could be unbound.
205 # Ensure we fail the job if any steps fail.
206 set -e -o pipefail
207 set +u
208
209 export MAVEN_OPTS
210
211 # Disable SC2086 because we want to allow word splitting for $MAVEN_* parameters.
212 # shellcheck disable=SC2086
213 $MVN clean install dependency:tree com.sonatype.clm:clm-maven-plugin:index \
214     --global-settings &quot;$GLOBAL_SETTINGS_FILE&quot; \
215     --settings &quot;$SETTINGS_FILE&quot; \
216     -DaltDeploymentRepository=staging::default::file:&quot;$WORKSPACE&quot;/m2repo \
217     $MAVEN_PARAMS $MAVEN_OPTIONS
218 </command>
219     </hudson.tasks.Shell>
220     <hudson.tasks.Shell>
221       <command>#!/bin/bash
222 set +e  # DO NOT cause build failure if any of the rm calls fail.
223
224 rm &quot;$GLOBAL_SETTINGS_FILE&quot; &quot;$SETTINGS_FILE&quot;
225
226 # In some cases we use the lf-provide-maven-settings macro to produce
227 # a &quot;$HOME/.netrc&quot; file containing credentials. Remove that file here
228 # too if it exists.
229 rm &quot;$HOME/.netrc&quot;
230
231 # DO NOT fail build if any of the above lines fail.
232 exit 0
233 </command>
234     </hudson.tasks.Shell>
235     <hudson.tasks.Shell>
236       <command>find . -regex &quot;.*karaf/target&quot; | xargs rm -rf</command>
237     </hudson.tasks.Shell>
238     <com.sonatype.insight.ci.hudson.PreBuildScan plugin="sonatype-clm-ci">
239       <applicationSelectType>
240         <value>list</value>
241         <applicationId>github-maven</applicationId>
242       </applicationSelectType>
243       <pathConfig>
244         <scanTargets/>
245         <moduleExcludes/>
246         <scanProperties/>
247       </pathConfig>
248       <failOnClmServerFailures>false</failOnClmServerFailures>
249       <stageId>build</stageId>
250       <username/>
251       <password/>
252     </com.sonatype.insight.ci.hudson.PreBuildScan>
253   </builders>
254   <publishers>
255     <org.jenkinsci.plugins.postbuildscript.PostBuildScript>
256       <buildSteps>
257         <hudson.tasks.Shell>
258           <command>#!/bin/bash
259 # SPDX-License-Identifier: EPL-1.0
260 ##############################################################################
261 # Copyright (c) 2017 The Linux Foundation and others.
262 #
263 # All rights reserved. This program and the accompanying materials
264 # are made available under the terms of the Eclipse Public License v1.0
265 # which accompanies this distribution, and is available at
266 # http://www.eclipse.org/legal/epl-v10.html
267 ##############################################################################
268 echo &quot;---&gt; sysstat.sh&quot;
269 set +e  # DON'T fail build if script fails.
270
271 OS=$(facter operatingsystem)
272 case &quot;$OS&quot; in
273     Ubuntu)
274         SYSSTAT_PATH=&quot;/var/log/sysstat&quot;
275
276         # Dont run the script when systat is not enabled by default
277         if ! grep --quiet 'ENABLED=&quot;true&quot;' &quot;/etc/default/sysstat&quot;; then
278             exit 0
279         fi
280     ;;
281     CentOS|RedHat)
282         SYSSTAT_PATH=&quot;/var/log/sa&quot;
283     ;;
284     *)
285         # nothing to do
286         exit 0
287     ;;
288 esac
289
290 SAR_DIR=&quot;$WORKSPACE/archives/sar-reports&quot;
291 mkdir -p &quot;$SAR_DIR&quot;
292 cp &quot;$SYSSTAT_PATH/&quot;* &quot;$_&quot;
293 # convert sar data to ascii format
294 while IFS=&quot;&quot; read -r s
295 do
296     [ -f &quot;$s&quot; ] &amp;&amp; LC_TIME=POSIX sar -A -f &quot;$s&quot; &gt; &quot;$SAR_DIR/sar${s//[!0-9]/}&quot;
297 done &lt; &lt;(find &quot;$SYSSTAT_PATH&quot; -name &quot;sa[0-9]*&quot; || true)
298
299 # DON'T fail build if script fails.
300 exit 0
301 </command>
302         </hudson.tasks.Shell>
303         <org.jenkinsci.plugins.configfiles.builder.ConfigFileBuildStep plugin="config-file-provider">
304           <managedFiles>
305             <org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
306               <fileId>jenkins-log-archives-settings</fileId>
307               <targetLocation/>
308               <variable>SETTINGS_FILE</variable>
309             </org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
310           </managedFiles>
311         </org.jenkinsci.plugins.configfiles.builder.ConfigFileBuildStep>
312         <EnvInjectBuilder>
313           <info>
314             <propertiesContent>SERVER_ID=logs</propertiesContent>
315           </info>
316         </EnvInjectBuilder>
317         <hudson.tasks.Shell>
318           <command>#!/bin/bash
319 # SPDX-License-Identifier: EPL-1.0
320 ##############################################################################
321 # Copyright (c) 2017 The Linux Foundation and others.
322 #
323 # All rights reserved. This program and the accompanying materials
324 # are made available under the terms of the Eclipse Public License v1.0
325 # which accompanies this distribution, and is available at
326 # http://www.eclipse.org/legal/epl-v10.html
327 ##############################################################################
328 echo &quot;---&gt; create-netrc.sh&quot;
329
330 # Ensure we fail the job if any steps fail.
331 set -eu -o pipefail
332
333 NEXUS_URL=&quot;${NEXUS_URL:-$NEXUSPROXY}&quot;
334 CREDENTIAL=$(xmlstarlet sel -N &quot;x=http://maven.apache.org/SETTINGS/1.0.0&quot; \
335     -t -m &quot;/x:settings/x:servers/x:server[x:id='${SERVER_ID}']&quot; \
336     -v x:username -o &quot;:&quot; -v x:password \
337     &quot;$SETTINGS_FILE&quot;)
338
339 machine=$(echo &quot;$NEXUS_URL&quot; | awk -F/ '{print $3}')
340 user=$(echo &quot;$CREDENTIAL&quot; | cut -f1 -d:)
341 pass=$(echo &quot;$CREDENTIAL&quot; | cut -f2 -d:)
342
343 echo &quot;machine $machine login $user password $pass&quot; &gt; ~/.netrc
344 </command>
345         </hudson.tasks.Shell>
346         <hudson.tasks.Shell>
347           <command>#!/bin/bash
348 # SPDX-License-Identifier: EPL-1.0
349 ##############################################################################
350 # Copyright (c) 2017 The Linux Foundation and others.
351 #
352 # All rights reserved. This program and the accompanying materials
353 # are made available under the terms of the Eclipse Public License v1.0
354 # which accompanies this distribution, and is available at
355 # http://www.eclipse.org/legal/epl-v10.html
356 ##############################################################################
357 echo &quot;---&gt; lftools-install.sh&quot;
358
359 # Ensure we fail the job if any steps fail.
360 # DO NOT set -u as virtualenv's activate script has unbound variables
361 set -e -o pipefail
362
363 virtualenv --quiet &quot;/tmp/v/lftools&quot;
364 # shellcheck source=/tmp/v/lftools/bin/activate disable=SC1091
365 source &quot;/tmp/v/lftools/bin/activate&quot;
366 pip install --quiet --upgrade pip
367 pip install --quiet --upgrade &quot;lftools&lt;1.0.0&quot;
368
369 # pipdeptree prints out a lot of information because lftools pulls in many
370 # dependencies. Let's only print it if we want to debug.
371 # echo &quot;----&gt; Pip Dependency Tree&quot;
372 # pip install --quiet --upgrade pipdeptree
373 # pipdeptree
374
375 #!/bin/bash
376 # SPDX-License-Identifier: EPL-1.0
377 ##############################################################################
378 # Copyright (c) 2017 The Linux Foundation and others.
379 #
380 # All rights reserved. This program and the accompanying materials
381 # are made available under the terms of the Eclipse Public License v1.0
382 # which accompanies this distribution, and is available at
383 # http://www.eclipse.org/legal/epl-v10.html
384 ##############################################################################
385 echo &quot;---&gt; logs-deploy.sh&quot;
386
387 # Ensure we fail the job if any steps fail.
388 set -eu -o pipefail
389
390 set -x  # Trace commands for this script to make debugging easier.
391
392 ARCHIVE_ARTIFACTS=&quot;${ARCHIVE_ARTIFACTS:-}&quot;
393 LOGS_SERVER=&quot;${LOGS_SERVER:-None}&quot;
394
395 if [ &quot;${LOGS_SERVER}&quot; == 'None' ]
396 then
397     set +x # Disable trace since we no longer need it
398
399     echo &quot;WARNING: Logging server not set&quot;
400 else
401     NEXUS_URL=&quot;${NEXUS_URL:-$NEXUSPROXY}&quot;
402     NEXUS_PATH=&quot;${SILO}/${JENKINS_HOSTNAME}/${JOB_NAME}/${BUILD_NUMBER}&quot;
403     BUILD_URL=&quot;${BUILD_URL}&quot;
404
405     lftools deploy archives -p &quot;$ARCHIVE_ARTIFACTS&quot; &quot;$NEXUS_URL&quot; &quot;$NEXUS_PATH&quot; &quot;$WORKSPACE&quot;
406     lftools deploy logs &quot;$NEXUS_URL&quot; &quot;$NEXUS_PATH&quot; &quot;$BUILD_URL&quot;
407
408     set +x  # Disable trace since we no longer need it.
409
410     echo &quot;Build logs: &lt;a href=\&quot;$LOGS_SERVER/$NEXUS_PATH\&quot;&gt;$LOGS_SERVER/$NEXUS_PATH&lt;/a&gt;&quot;
411 fi
412 </command>
413         </hudson.tasks.Shell>
414         <hudson.tasks.Shell>
415           <command>#!/bin/bash
416 # SPDX-License-Identifier: EPL-1.0
417 ##############################################################################
418 # Copyright (c) 2017 The Linux Foundation and others.
419 #
420 # All rights reserved. This program and the accompanying materials
421 # are made available under the terms of the Eclipse Public License v1.0
422 # which accompanies this distribution, and is available at
423 # http://www.eclipse.org/legal/epl-v10.html
424 ##############################################################################
425
426 # Clear log credential files
427 rm &quot;$SETTINGS_FILE&quot;
428 rm ~/.netrc
429 </command>
430         </hudson.tasks.Shell>
431         <hudson.plugins.descriptionsetter.DescriptionSetterBuilder>
432           <regexp>^Build logs: .*</regexp>
433         </hudson.plugins.descriptionsetter.DescriptionSetterBuilder>
434       </buildSteps>
435       <scriptOnlyIfSuccess>false</scriptOnlyIfSuccess>
436       <scriptOnlyIfFailure>false</scriptOnlyIfFailure>
437       <markBuildUnstable>false</markBuildUnstable>
438     </org.jenkinsci.plugins.postbuildscript.PostBuildScript>
439     <hudson.plugins.ws__cleanup.WsCleanup plugin="ws-cleanup">
440       <patterns>
441         <hudson.plugins.ws__cleanup.Pattern>
442           <pattern>**/*.jenkins-trigger</pattern>
443           <type>EXCLUDE</type>
444         </hudson.plugins.ws__cleanup.Pattern>
445       </patterns>
446       <deleteDirs>false</deleteDirs>
447       <cleanupMatrixParent>false</cleanupMatrixParent>
448       <externalDelete/>
449       <cleanWhenSuccess>true</cleanWhenSuccess>
450       <cleanWhenUnstable>true</cleanWhenUnstable>
451       <cleanWhenFailure>true</cleanWhenFailure>
452       <cleanWhenNotBuilt>true</cleanWhenNotBuilt>
453       <cleanWhenAborted>true</cleanWhenAborted>
454       <notFailBuild>true</notFailBuild>
455     </hudson.plugins.ws__cleanup.WsCleanup>
456   </publishers>
457   <buildWrappers>
458     <com.michelin.cio.hudson.plugins.maskpasswords.MaskPasswordsBuildWrapper/>
459     <hudson.plugins.build__timeout.BuildTimeoutWrapper>
460       <timeoutMinutes>15</timeoutMinutes>
461       <timeoutEnvVar>BUILD_TIMEOUT</timeoutEnvVar>
462       <failBuild>true</failBuild>
463       <writingDescription>false</writingDescription>
464       <timeoutPercentage>0</timeoutPercentage>
465       <timeoutMinutesElasticDefault>3</timeoutMinutesElasticDefault>
466       <timeoutType>absolute</timeoutType>
467     </hudson.plugins.build__timeout.BuildTimeoutWrapper>
468     <hudson.plugins.timestamper.TimestamperBuildWrapper/>
469     <com.cloudbees.jenkins.plugins.sshagent.SSHAgentBuildWrapper>
470       <user>test-credential</user>
471     </com.cloudbees.jenkins.plugins.sshagent.SSHAgentBuildWrapper>
472     <jenkins.plugins.openstack.compute.JCloudsOneOffSlave/>
473   </buildWrappers>
474 </project>