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