1 <?xml version="1.0" encoding="utf-8"?>
5 <description><!-- Managed by Jenkins Job Builder --></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>
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>
20 </jenkins.model.BuildDiscarderProperty>
21 <hudson.model.ParametersDefinitionProperty>
22 <parameterDefinitions>
23 <hudson.model.StringParameterDefinition>
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
29 <defaultValue>releng/ciman</defaultValue>
30 </hudson.model.StringParameterDefinition>
31 <hudson.model.StringParameterDefinition>
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
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
45 Note that Gerrit will override this parameter automatically if a
46 job is triggered by Gerrit.
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.
54 Note that Gerrit will override this parameter automatically if a
55 job is triggered by Gerrit.
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.
63 Note that Gerrit will override this parameter automatically if a
64 job is triggered by Gerrit.
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 '<1.0.0' or '>=1.0.0,<2.0.0'.
75 <defaultValue><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
82 </hudson.model.StringParameterDefinition>
83 <hudson.model.StringParameterDefinition>
84 <name>MAVEN_PARAMS</name>
85 <description>Maven parameters to pass to the mvn command.
88 </hudson.model.StringParameterDefinition>
89 <hudson.model.StringParameterDefinition>
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.
98 <defaultValue>uuddlrlrba</defaultValue>
99 </hudson.model.StringParameterDefinition>
100 </parameterDefinitions>
101 </hudson.model.ParametersDefinitionProperty>
103 <scm class="hudson.plugins.git.GitSCM">
104 <configVersion>2</configVersion>
106 <hudson.plugins.git.UserRemoteConfig>
108 <refspec>$GERRIT_REFSPEC</refspec>
109 <url>$GIT_URL/$PROJECT</url>
110 <credentialsId>test-credential</credentialsId>
111 </hudson.plugins.git.UserRemoteConfig>
114 <hudson.plugins.git.BranchSpec>
115 <name>refs/heads/$GERRIT_BRANCH</name>
116 </hudson.plugins.git.BranchSpec>
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"/>
131 <skipTag>true</skipTag>
133 <useShallowClone>false</useShallowClone>
134 <ignoreNotifyCommit>false</ignoreNotifyCommit>
136 <hudson.plugins.git.extensions.impl.SubmoduleOption>
137 <disableSubmodules>false</disableSubmodules>
138 <recursiveSubmodules>true</recursiveSubmodules>
139 <trackingSubmodules>false</trackingSubmodules>
141 <timeout>10</timeout>
142 </hudson.plugins.git.extensions.impl.SubmoduleOption>
143 <hudson.plugins.git.extensions.impl.WipeWorkspace/>
146 <triggers class="vector">
147 <com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.GerritTrigger>
150 <com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.data.GerritProject>
151 <compareType>ANT</compareType>
152 <pattern>releng/ciman</pattern>
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>
159 <disableStrictForbiddenFileVerification>false</disableStrictForbiddenFileVerification>
160 </com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.data.GerritProject>
163 <onSuccessful>false</onSuccessful>
164 <onFailed>false</onFailed>
165 <onUnstable>false</onUnstable>
166 <onNotBuilt>false</onNotBuilt>
168 <silentMode>false</silentMode>
169 <silentStartMode>false</silentStartMode>
170 <escapeQuotes>true</escapeQuotes>
171 <noNameAndEmailParameters>false</noNameAndEmailParameters>
172 <readableMessage>false</readableMessage>
173 <dependencyJobsNames/>
175 <dynamicTriggerConfiguration>False</dynamicTriggerConfiguration>
177 <allowTriggeringUnreviewedPatches>false</allowTriggeringUnreviewedPatches>
179 <com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.events.PluginPatchsetCreatedEvent>
180 <excludeDrafts>true</excludeDrafts>
181 <excludeTrivialRebase>false</excludeTrivialRebase>
182 <excludeNoCodeChange>false</excludeNoCodeChange>
183 </com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.events.PluginPatchsetCreatedEvent>
184 <com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.events.PluginDraftPublishedEvent/>
185 <com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.events.PluginCommentAddedContainsEvent>
186 <commentAddedCommentContains>recheck$</commentAddedCommentContains>
187 </com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.events.PluginCommentAddedContainsEvent>
190 <buildFailureMessage/>
191 <buildSuccessfulMessage/>
192 <buildUnstableMessage/>
193 <buildNotBuiltMessage/>
194 <buildUnsuccessfulFilepath/>
196 <serverName>test-server</serverName>
197 </com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.GerritTrigger>
201 <command>echo "quiet=on" > "$HOME/.wgetrc"</command>
202 </hudson.tasks.Shell>
204 <targets>--version</targets>
206 <mavenName>mvn33</mavenName>
207 <usePrivateRepository>false</usePrivateRepository>
208 <settings class="jenkins.mvn.DefaultSettingsProvider"/>
209 <globalSettings class="jenkins.mvn.DefaultGlobalSettingsProvider"/>
210 </hudson.tasks.Maven>
212 <command>rm "$HOME/.wgetrc"</command>
213 </hudson.tasks.Shell>
214 <org.jenkinsci.plugins.configfiles.builder.ConfigFileBuildStep plugin="config-file-provider">
216 <org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
217 <fileId>global-settings</fileId>
219 <variable>GLOBAL_SETTINGS_FILE</variable>
220 </org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
221 <org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
222 <fileId>gerrit-maven-project-settings</fileId>
224 <variable>SETTINGS_FILE</variable>
225 </org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
227 </org.jenkinsci.plugins.configfiles.builder.ConfigFileBuildStep>
230 # SPDX-License-Identifier: EPL-1.0
231 ##############################################################################
232 # Copyright (c) 2017 The Linux Foundation and others.
234 # All rights reserved. This program and the accompanying materials
235 # are made available under the terms of the Eclipse Public License v1.0
236 # which accompanies this distribution, and is available at
237 # http://www.eclipse.org/legal/epl-v10.html
238 ##############################################################################
240 # This file contains a list of variables that are generally useful in many
241 # scripts. It is meant to be sourced in other scripts so that the variables can
244 MAVEN_OPTIONS="$(echo --show-version \
247 -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn \
248 -Dmaven.repo.local=/tmp/r \
249 -Dorg.ops4j.pax.url.mvn.localRepository=/tmp/r)"
250 echo "$MAVEN_OPTIONS"
253 # SPDX-License-Identifier: EPL-1.0
254 ##############################################################################
255 # Copyright (c) 2017 The Linux Foundation and others.
257 # All rights reserved. This program and the accompanying materials
258 # are made available under the terms of the Eclipse Public License v1.0
259 # which accompanies this distribution, and is available at
260 # http://www.eclipse.org/legal/epl-v10.html
261 ##############################################################################
263 # Generates javadoc in a Maven project.
265 # DO NOT enable -u because $MAVEN_PARAMS and $MAVEN_OPTIONS could be unbound.
266 # Ensure we fail the job if any steps fail.
270 JAVADOC_DIR="$WORKSPACE/archives/javadoc"
271 mkdir -p "$WORKSPACE/archives"
275 # Disable SC2086 because we want to allow word splitting for $MAVEN_* parameters.
276 # shellcheck disable=SC2086
277 $MVN clean javadoc:aggregate \
278 --global-settings "$GLOBAL_SETTINGS_FILE" \
279 --settings "$SETTINGS_FILE" \
280 $MAVEN_PARAMS $MAVEN_OPTIONS
282 mv "$WORKSPACE/target/site/apidocs" "$JAVADOC_DIR"
284 </hudson.tasks.Shell>
287 set +e # DO NOT cause build failure if any of the rm calls fail.
289 rm "$GLOBAL_SETTINGS_FILE" "$SETTINGS_FILE"
291 # In some cases we use the lf-provide-maven-settings macro to produce
292 # a "$HOME/.netrc" file containing credentials. Remove that file here
294 rm "$HOME/.netrc"
296 # DO NOT fail build if any of the above lines fail.
299 </hudson.tasks.Shell>
302 <org.jenkinsci.plugins.postbuildscript.PostBuildScript>
306 # SPDX-License-Identifier: EPL-1.0
307 ##############################################################################
308 # Copyright (c) 2017 The Linux Foundation and others.
310 # All rights reserved. This program and the accompanying materials
311 # are made available under the terms of the Eclipse Public License v1.0
312 # which accompanies this distribution, and is available at
313 # http://www.eclipse.org/legal/epl-v10.html
314 ##############################################################################
315 echo "---> sysstat.sh"
316 set +e # DON'T fail build if script fails.
318 OS=$(facter operatingsystem)
319 case "$OS" in
321 SYSSTAT_PATH="/var/log/sysstat"
323 # Dont run the script when systat is not enabled by default
324 if ! grep --quiet 'ENABLED="true"' "/etc/default/sysstat"; then
329 SYSSTAT_PATH="/var/log/sa"
337 SAR_DIR="$WORKSPACE/archives/sar-reports"
338 mkdir -p "$SAR_DIR"
339 cp "$SYSSTAT_PATH/"* "$_"
340 # convert sar data to ascii format
341 while IFS="" read -r s
343 [ -f "$s" ] && LC_TIME=POSIX sar -A -f "$s" > "$SAR_DIR/sar${s//[!0-9]/}"
344 done < <(find "$SYSSTAT_PATH" -name "sa[0-9]*" || true)
346 # DON'T fail build if script fails.
349 </hudson.tasks.Shell>
350 <org.jenkinsci.plugins.configfiles.builder.ConfigFileBuildStep plugin="config-file-provider">
352 <org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
353 <fileId>jenkins-log-archives-settings</fileId>
355 <variable>SETTINGS_FILE</variable>
356 </org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
358 </org.jenkinsci.plugins.configfiles.builder.ConfigFileBuildStep>
361 <propertiesContent>SERVER_ID=logs</propertiesContent>
366 # SPDX-License-Identifier: EPL-1.0
367 ##############################################################################
368 # Copyright (c) 2017 The Linux Foundation and others.
370 # All rights reserved. This program and the accompanying materials
371 # are made available under the terms of the Eclipse Public License v1.0
372 # which accompanies this distribution, and is available at
373 # http://www.eclipse.org/legal/epl-v10.html
374 ##############################################################################
375 echo "---> create-netrc.sh"
377 # Ensure we fail the job if any steps fail.
380 NEXUS_URL="${NEXUS_URL:-$NEXUSPROXY}"
381 CREDENTIAL=$(xmlstarlet sel -N "x=http://maven.apache.org/SETTINGS/1.0.0" \
382 -t -m "/x:settings/x:servers/x:server[x:id='${SERVER_ID}']" \
383 -v x:username -o ":" -v x:password \
384 "$SETTINGS_FILE")
386 machine=$(echo "$NEXUS_URL" | awk -F/ '{print $3}')
387 user=$(echo "$CREDENTIAL" | cut -f1 -d:)
388 pass=$(echo "$CREDENTIAL" | cut -f2 -d:)
390 echo "machine $machine login $user password $pass" > ~/.netrc
392 </hudson.tasks.Shell>
395 # SPDX-License-Identifier: EPL-1.0
396 ##############################################################################
397 # Copyright (c) 2017 The Linux Foundation and others.
399 # All rights reserved. This program and the accompanying materials
400 # are made available under the terms of the Eclipse Public License v1.0
401 # which accompanies this distribution, and is available at
402 # http://www.eclipse.org/legal/epl-v10.html
403 ##############################################################################
404 echo "---> lftools-install.sh"
406 # Script to install lftools via a version passed in via lf-infra-parameters
408 # Required parameters:
410 # LFTOOLS_VERSION: Passed in via lf-infra-parameters configuration. Can be
411 # set to a strict version number like '1.2.3' or using
412 # PEP-440 definitions.
416 # >=1.0.0,<2.0.0
418 # By default a released version of lftools should always be used.
419 # The purpose of the 2 variables below is so that lftools devs can test
420 # unreleased versions of lftools. There are 2 methods to install a dev version
423 # 1) gerrit patch: Used to test a patch that has not yet been merged.
424 # To do this set something like this:
425 # LFTOOLS_MODE=gerrit
426 # LFTOOLS_REFSPEC=refs/changes/96/5296/7
428 # 2) git branch: Used to install an lftools version from a specific branch.
429 # To use this set the variables as follows:
431 # LFTOOLS_REFSPEC=master
433 # 3) release : The intended use case and default setting.
434 # Set LFTOOLS_MODE=release, in this case LFTOOLS_REFSPEC is unused.
436 LFTOOLS_MODE=release # release | git | gerrit
437 LFTOOLS_REFSPEC=master
439 # Ensure we fail the job if any steps fail.
440 # DO NOT set -u as virtualenv's activate script has unbound variables
443 virtualenv --quiet "/tmp/v/lftools"
444 # shellcheck source=/tmp/v/lftools/bin/activate disable=SC1091
445 source "/tmp/v/lftools/bin/activate"
446 pip install --quiet --upgrade pip
448 case $LFTOOLS_MODE in
450 git clone https://gerrit.linuxfoundation.org/infra/releng/lftools.git /tmp/lftools
452 git fetch origin "$LFTOOLS_REFSPEC"
453 git checkout FETCH_HEAD
454 pip install --quiet --upgrade -r requirements.txt
455 pip install --quiet --upgrade -e .
460 pip install --quiet --upgrade git+https://gerrit.linuxfoundation.org/infra/releng/lftools.git@"$BRANCH"
464 if [[ $LFTOOLS_VERSION =~ ^[0-9] ]]; then
465 LFTOOLS_VERSION="==$LFTOOLS_VERSION"
468 pip install --quiet --upgrade "lftools${LFTOOLS_VERSION}"
474 # pipdeptree prints out a lot of information because lftools pulls in many
475 # dependencies. Let's only print it if we want to debug.
476 # echo "----> Pip Dependency Tree"
477 # pip install --quiet --upgrade pipdeptree
481 # SPDX-License-Identifier: EPL-1.0
482 ##############################################################################
483 # Copyright (c) 2017 The Linux Foundation and others.
485 # All rights reserved. This program and the accompanying materials
486 # are made available under the terms of the Eclipse Public License v1.0
487 # which accompanies this distribution, and is available at
488 # http://www.eclipse.org/legal/epl-v10.html
489 ##############################################################################
490 echo "---> logs-deploy.sh"
492 # Ensure we fail the job if any steps fail.
495 set -x # Trace commands for this script to make debugging easier.
497 ARCHIVE_ARTIFACTS="${ARCHIVE_ARTIFACTS:-}"
498 LOGS_SERVER="${LOGS_SERVER:-None}"
500 if [ "${LOGS_SERVER}" == 'None' ]
502 set +x # Disable trace since we no longer need it
504 echo "WARNING: Logging server not set"
506 NEXUS_URL="${NEXUS_URL:-$NEXUSPROXY}"
507 NEXUS_PATH="${SILO}/${JENKINS_HOSTNAME}/${JOB_NAME}/${BUILD_NUMBER}"
508 BUILD_URL="${BUILD_URL}"
510 lftools deploy archives -p "$ARCHIVE_ARTIFACTS" "$NEXUS_URL" "$NEXUS_PATH" "$WORKSPACE"
511 lftools deploy logs "$NEXUS_URL" "$NEXUS_PATH" "$BUILD_URL"
513 set +x # Disable trace since we no longer need it.
515 echo "Build logs: <a href=\"$LOGS_SERVER/$NEXUS_PATH\">$LOGS_SERVER/$NEXUS_PATH</a>"
518 </hudson.tasks.Shell>
521 # SPDX-License-Identifier: EPL-1.0
522 ##############################################################################
523 # Copyright (c) 2017 The Linux Foundation and others.
525 # All rights reserved. This program and the accompanying materials
526 # are made available under the terms of the Eclipse Public License v1.0
527 # which accompanies this distribution, and is available at
528 # http://www.eclipse.org/legal/epl-v10.html
529 ##############################################################################
531 # Clear log credential files
532 rm "$SETTINGS_FILE"
535 </hudson.tasks.Shell>
536 <hudson.plugins.descriptionsetter.DescriptionSetterBuilder>
537 <regexp>^Build logs: .*</regexp>
538 </hudson.plugins.descriptionsetter.DescriptionSetterBuilder>
540 <scriptOnlyIfSuccess>false</scriptOnlyIfSuccess>
541 <scriptOnlyIfFailure>false</scriptOnlyIfFailure>
542 <markBuildUnstable>false</markBuildUnstable>
543 </org.jenkinsci.plugins.postbuildscript.PostBuildScript>
544 <hudson.plugins.ws__cleanup.WsCleanup plugin="ws-cleanup">
546 <hudson.plugins.ws__cleanup.Pattern>
547 <pattern>**/*.jenkins-trigger</pattern>
549 </hudson.plugins.ws__cleanup.Pattern>
551 <deleteDirs>false</deleteDirs>
552 <cleanupMatrixParent>false</cleanupMatrixParent>
554 <cleanWhenSuccess>true</cleanWhenSuccess>
555 <cleanWhenUnstable>true</cleanWhenUnstable>
556 <cleanWhenFailure>true</cleanWhenFailure>
557 <cleanWhenNotBuilt>true</cleanWhenNotBuilt>
558 <cleanWhenAborted>true</cleanWhenAborted>
559 <notFailBuild>true</notFailBuild>
560 </hudson.plugins.ws__cleanup.WsCleanup>
563 <com.michelin.cio.hudson.plugins.maskpasswords.MaskPasswordsBuildWrapper/>
564 <hudson.plugins.build__timeout.BuildTimeoutWrapper>
565 <timeoutMinutes>30</timeoutMinutes>
566 <timeoutEnvVar>BUILD_TIMEOUT</timeoutEnvVar>
567 <failBuild>true</failBuild>
568 <writingDescription>false</writingDescription>
569 <timeoutPercentage>0</timeoutPercentage>
570 <timeoutMinutesElasticDefault>3</timeoutMinutesElasticDefault>
571 <timeoutType>absolute</timeoutType>
572 </hudson.plugins.build__timeout.BuildTimeoutWrapper>
573 <hudson.plugins.timestamper.TimestamperBuildWrapper/>
574 <com.cloudbees.jenkins.plugins.sshagent.SSHAgentBuildWrapper>
575 <user>test-credential</user>
576 </com.cloudbees.jenkins.plugins.sshagent.SSHAgentBuildWrapper>
577 <jenkins.plugins.openstack.compute.JCloudsOneOffSlave/>