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>
79 <description>Maven selector to be used by shell scripts</description>
80 <defaultValue>/w/tools/hudson.tasks.Maven_MavenInstallation/mvn33</defaultValue>
81 </hudson.model.StringParameterDefinition>
82 <hudson.model.StringParameterDefinition>
83 <name>MAVEN_OPTS</name>
84 <description>Maven Java opts. Example: -Xmx1024m -XX:MaxPermSize=256m
87 </hudson.model.StringParameterDefinition>
88 <hudson.model.StringParameterDefinition>
89 <name>MAVEN_PARAMS</name>
90 <description>Maven parameters to pass to the mvn command.
93 </hudson.model.StringParameterDefinition>
94 <hudson.model.StringParameterDefinition>
96 <description>Maven selector to be used by shell scripts</description>
97 <defaultValue>/w/tools/hudson.tasks.Maven_MavenInstallation/mvn33/bin/mvn</defaultValue>
98 </hudson.model.StringParameterDefinition>
99 <hudson.model.StringParameterDefinition>
100 <name>STAGING_PROFILE_ID</name>
101 <description>Nexus staging profile ID.
103 <defaultValue>uuddlrlrba</defaultValue>
104 </hudson.model.StringParameterDefinition>
105 </parameterDefinitions>
106 </hudson.model.ParametersDefinitionProperty>
108 <scm class="hudson.plugins.git.GitSCM">
109 <configVersion>2</configVersion>
111 <hudson.plugins.git.UserRemoteConfig>
113 <refspec>$GERRIT_REFSPEC</refspec>
114 <url>$GIT_URL/$PROJECT</url>
115 <credentialsId>test-credential</credentialsId>
116 </hudson.plugins.git.UserRemoteConfig>
119 <hudson.plugins.git.BranchSpec>
120 <name>refs/heads/$GERRIT_BRANCH</name>
121 </hudson.plugins.git.BranchSpec>
124 <buildChooser class="com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.GerritTriggerBuildChooser"/>
125 <doGenerateSubmoduleConfigurations>false</doGenerateSubmoduleConfigurations>
126 <authorOrCommitter>false</authorOrCommitter>
127 <wipeOutWorkspace>true</wipeOutWorkspace>
128 <pruneBranches>false</pruneBranches>
129 <remotePoll>false</remotePoll>
130 <gitTool>Default</gitTool>
131 <submoduleCfg class="list"/>
136 <skipTag>true</skipTag>
138 <useShallowClone>false</useShallowClone>
139 <ignoreNotifyCommit>false</ignoreNotifyCommit>
141 <hudson.plugins.git.extensions.impl.SubmoduleOption>
142 <disableSubmodules>false</disableSubmodules>
143 <recursiveSubmodules>true</recursiveSubmodules>
144 <trackingSubmodules>false</trackingSubmodules>
146 <timeout>10</timeout>
147 </hudson.plugins.git.extensions.impl.SubmoduleOption>
148 <hudson.plugins.git.extensions.impl.WipeWorkspace/>
151 <triggers class="vector">
152 <com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.GerritTrigger>
155 <com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.data.GerritProject>
156 <compareType>ANT</compareType>
157 <pattern>releng/ciman</pattern>
159 <com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.data.Branch>
160 <compareType>ANT</compareType>
161 <pattern>**/master</pattern>
162 </com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.data.Branch>
164 <disableStrictForbiddenFileVerification>false</disableStrictForbiddenFileVerification>
165 </com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.data.GerritProject>
168 <onSuccessful>false</onSuccessful>
169 <onFailed>false</onFailed>
170 <onUnstable>false</onUnstable>
171 <onNotBuilt>false</onNotBuilt>
173 <silentMode>false</silentMode>
174 <silentStartMode>false</silentStartMode>
175 <escapeQuotes>true</escapeQuotes>
176 <noNameAndEmailParameters>false</noNameAndEmailParameters>
177 <readableMessage>false</readableMessage>
178 <dependencyJobsNames/>
180 <dynamicTriggerConfiguration>False</dynamicTriggerConfiguration>
182 <allowTriggeringUnreviewedPatches>false</allowTriggeringUnreviewedPatches>
184 <com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.events.PluginPatchsetCreatedEvent>
185 <excludeDrafts>true</excludeDrafts>
186 <excludeTrivialRebase>false</excludeTrivialRebase>
187 <excludeNoCodeChange>false</excludeNoCodeChange>
188 </com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.events.PluginPatchsetCreatedEvent>
189 <com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.events.PluginDraftPublishedEvent/>
190 <com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.events.PluginCommentAddedContainsEvent>
191 <commentAddedCommentContains>recheck$</commentAddedCommentContains>
192 </com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.events.PluginCommentAddedContainsEvent>
195 <buildFailureMessage/>
196 <buildSuccessfulMessage/>
197 <buildUnstableMessage/>
198 <buildNotBuiltMessage/>
199 <buildUnsuccessfulFilepath/>
201 <serverName>test-server</serverName>
202 </com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.GerritTrigger>
206 <command>echo "quiet=on" > "$HOME/.wgetrc"</command>
207 </hudson.tasks.Shell>
209 <targets>--version</targets>
211 <mavenName>mvn33</mavenName>
212 <usePrivateRepository>false</usePrivateRepository>
213 <settings class="jenkins.mvn.DefaultSettingsProvider"/>
214 <globalSettings class="jenkins.mvn.DefaultGlobalSettingsProvider"/>
215 </hudson.tasks.Maven>
217 <command>rm "$HOME/.wgetrc"</command>
218 </hudson.tasks.Shell>
219 <org.jenkinsci.plugins.configfiles.builder.ConfigFileBuildStep plugin="config-file-provider">
221 <org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
222 <fileId>global-settings</fileId>
224 <variable>GLOBAL_SETTINGS_FILE</variable>
225 </org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
226 <org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
227 <fileId>gerrit-maven-project-settings</fileId>
229 <variable>SETTINGS_FILE</variable>
230 </org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
232 </org.jenkinsci.plugins.configfiles.builder.ConfigFileBuildStep>
235 # SPDX-License-Identifier: EPL-1.0
236 ##############################################################################
237 # Copyright (c) 2017 The Linux Foundation and others.
239 # All rights reserved. This program and the accompanying materials
240 # are made available under the terms of the Eclipse Public License v1.0
241 # which accompanies this distribution, and is available at
242 # http://www.eclipse.org/legal/epl-v10.html
243 ##############################################################################
245 # This file contains a list of variables that are generally useful in many
246 # scripts. It is meant to be sourced in other scripts so that the variables can
249 MAVEN_OPTIONS="$(echo --show-version \
252 -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn \
253 -Dmaven.repo.local=/tmp/r \
254 -Dorg.ops4j.pax.url.mvn.localRepository=/tmp/r)"
255 echo "$MAVEN_OPTIONS"
258 # SPDX-License-Identifier: EPL-1.0
259 ##############################################################################
260 # Copyright (c) 2017 The Linux Foundation and others.
262 # All rights reserved. This program and the accompanying materials
263 # are made available under the terms of the Eclipse Public License v1.0
264 # which accompanies this distribution, and is available at
265 # http://www.eclipse.org/legal/epl-v10.html
266 ##############################################################################
268 # Generates javadoc in a Maven project.
270 # DO NOT enable -u because $MAVEN_PARAMS and $MAVEN_OPTIONS could be unbound.
271 # Ensure we fail the job if any steps fail.
275 JAVADOC_DIR="$WORKSPACE/archives/javadoc"
276 mkdir -p "$WORKSPACE/archives"
280 # Disable SC2086 because we want to allow word splitting for $MAVEN_* parameters.
281 # shellcheck disable=SC2086
282 $MVN clean javadoc:aggregate \
283 --global-settings "$GLOBAL_SETTINGS_FILE" \
284 --settings "$SETTINGS_FILE" \
285 $MAVEN_PARAMS $MAVEN_OPTIONS
287 mv "$WORKSPACE/target/site/apidocs" "$JAVADOC_DIR"
289 </hudson.tasks.Shell>
292 set +e # DO NOT cause build failure if any of the rm calls fail.
294 rm "$GLOBAL_SETTINGS_FILE" "$SETTINGS_FILE"
296 # In some cases we use the lf-provide-maven-settings macro to produce
297 # a "$HOME/.netrc" file containing credentials. Remove that file here
299 rm "$HOME/.netrc"
301 # DO NOT fail build if any of the above lines fail.
304 </hudson.tasks.Shell>
307 <org.jenkinsci.plugins.postbuildscript.PostBuildScript>
311 # SPDX-License-Identifier: EPL-1.0
312 ##############################################################################
313 # Copyright (c) 2017 The Linux Foundation and others.
315 # All rights reserved. This program and the accompanying materials
316 # are made available under the terms of the Eclipse Public License v1.0
317 # which accompanies this distribution, and is available at
318 # http://www.eclipse.org/legal/epl-v10.html
319 ##############################################################################
320 echo "---> sysstat.sh"
321 set +e # DON'T fail build if script fails.
323 OS=$(facter operatingsystem)
324 case "$OS" in
326 SYSSTAT_PATH="/var/log/sysstat"
328 # Dont run the script when systat is not enabled by default
329 if ! grep --quiet 'ENABLED="true"' "/etc/default/sysstat"; then
334 SYSSTAT_PATH="/var/log/sa"
342 SAR_DIR="$WORKSPACE/archives/sar-reports"
343 mkdir -p "$SAR_DIR"
344 cp "$SYSSTAT_PATH/"* "$_"
345 # convert sar data to ascii format
346 while IFS="" read -r s
348 [ -f "$s" ] && LC_TIME=POSIX sar -A -f "$s" > "$SAR_DIR/sar${s//[!0-9]/}"
349 done < <(find "$SYSSTAT_PATH" -name "sa[0-9]*" || true)
351 # DON'T fail build if script fails.
354 </hudson.tasks.Shell>
355 <org.jenkinsci.plugins.configfiles.builder.ConfigFileBuildStep plugin="config-file-provider">
357 <org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
358 <fileId>jenkins-log-archives-settings</fileId>
360 <variable>SETTINGS_FILE</variable>
361 </org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
363 </org.jenkinsci.plugins.configfiles.builder.ConfigFileBuildStep>
366 <propertiesContent>SERVER_ID=logs</propertiesContent>
371 # SPDX-License-Identifier: EPL-1.0
372 ##############################################################################
373 # Copyright (c) 2017 The Linux Foundation and others.
375 # All rights reserved. This program and the accompanying materials
376 # are made available under the terms of the Eclipse Public License v1.0
377 # which accompanies this distribution, and is available at
378 # http://www.eclipse.org/legal/epl-v10.html
379 ##############################################################################
380 echo "---> create-netrc.sh"
382 # Ensure we fail the job if any steps fail.
385 NEXUS_URL="${NEXUS_URL:-$NEXUSPROXY}"
386 CREDENTIAL=$(xmlstarlet sel -N "x=http://maven.apache.org/SETTINGS/1.0.0" \
387 -t -m "/x:settings/x:servers/x:server[x:id='${SERVER_ID}']" \
388 -v x:username -o ":" -v x:password \
389 "$SETTINGS_FILE")
391 machine=$(echo "$NEXUS_URL" | awk -F/ '{print $3}')
392 user=$(echo "$CREDENTIAL" | cut -f1 -d:)
393 pass=$(echo "$CREDENTIAL" | cut -f2 -d:)
395 echo "machine $machine login $user password $pass" > ~/.netrc
397 </hudson.tasks.Shell>
400 # SPDX-License-Identifier: EPL-1.0
401 ##############################################################################
402 # Copyright (c) 2017 The Linux Foundation and others.
404 # All rights reserved. This program and the accompanying materials
405 # are made available under the terms of the Eclipse Public License v1.0
406 # which accompanies this distribution, and is available at
407 # http://www.eclipse.org/legal/epl-v10.html
408 ##############################################################################
409 echo "---> lftools-install.sh"
411 # Script to install lftools via a version passed in via lf-infra-parameters
413 # Required parameters:
415 # LFTOOLS_VERSION: Passed in via lf-infra-parameters configuration. Can be
416 # set to a strict version number like '1.2.3' or using
417 # PEP-440 definitions.
421 # >=1.0.0,<2.0.0
423 # By default a released version of lftools should always be used.
424 # The purpose of the 2 variables below is so that lftools devs can test
425 # unreleased versions of lftools. There are 2 methods to install a dev version
428 # 1) gerrit patch: Used to test a patch that has not yet been merged.
429 # To do this set something like this:
430 # LFTOOLS_MODE=gerrit
431 # LFTOOLS_REFSPEC=refs/changes/96/5296/7
433 # 2) git branch: Used to install an lftools version from a specific branch.
434 # To use this set the variables as follows:
436 # LFTOOLS_REFSPEC=master
438 # 3) release : The intended use case and default setting.
439 # Set LFTOOLS_MODE=release, in this case LFTOOLS_REFSPEC is unused.
441 LFTOOLS_MODE=release # release | git | gerrit
442 LFTOOLS_REFSPEC=master
444 # Ensure we fail the job if any steps fail.
445 # DO NOT set -u as virtualenv's activate script has unbound variables
448 virtualenv --quiet "/tmp/v/lftools"
449 # shellcheck source=/tmp/v/lftools/bin/activate disable=SC1091
450 source "/tmp/v/lftools/bin/activate"
451 pip install --quiet --upgrade pip
453 case $LFTOOLS_MODE in
455 git clone https://gerrit.linuxfoundation.org/infra/releng/lftools.git /tmp/lftools
457 git fetch origin "$LFTOOLS_REFSPEC"
458 git checkout FETCH_HEAD
459 pip install --quiet --upgrade -r requirements.txt
460 pip install --quiet --upgrade -e .
465 pip install --quiet --upgrade git+https://gerrit.linuxfoundation.org/infra/releng/lftools.git@"$BRANCH"
469 if [[ $LFTOOLS_VERSION =~ ^[0-9] ]]; then
470 LFTOOLS_VERSION="==$LFTOOLS_VERSION"
473 pip install --quiet --upgrade "lftools${LFTOOLS_VERSION}"
479 # pipdeptree prints out a lot of information because lftools pulls in many
480 # dependencies. Let's only print it if we want to debug.
481 # echo "----> Pip Dependency Tree"
482 # pip install --quiet --upgrade pipdeptree
486 # SPDX-License-Identifier: EPL-1.0
487 ##############################################################################
488 # Copyright (c) 2017 The Linux Foundation and others.
490 # All rights reserved. This program and the accompanying materials
491 # are made available under the terms of the Eclipse Public License v1.0
492 # which accompanies this distribution, and is available at
493 # http://www.eclipse.org/legal/epl-v10.html
494 ##############################################################################
495 echo "---> logs-deploy.sh"
497 # Ensure we fail the job if any steps fail.
500 set -x # Trace commands for this script to make debugging easier.
502 ARCHIVE_ARTIFACTS="${ARCHIVE_ARTIFACTS:-}"
503 LOGS_SERVER="${LOGS_SERVER:-None}"
505 if [ "${LOGS_SERVER}" == 'None' ]
507 set +x # Disable trace since we no longer need it
509 echo "WARNING: Logging server not set"
511 NEXUS_URL="${NEXUS_URL:-$NEXUSPROXY}"
512 NEXUS_PATH="${SILO}/${JENKINS_HOSTNAME}/${JOB_NAME}/${BUILD_NUMBER}"
513 BUILD_URL="${BUILD_URL}"
515 lftools deploy archives -p "$ARCHIVE_ARTIFACTS" "$NEXUS_URL" "$NEXUS_PATH" "$WORKSPACE"
516 lftools deploy logs "$NEXUS_URL" "$NEXUS_PATH" "$BUILD_URL"
518 set +x # Disable trace since we no longer need it.
520 echo "Build logs: <a href=\"$LOGS_SERVER/$NEXUS_PATH\">$LOGS_SERVER/$NEXUS_PATH</a>"
523 </hudson.tasks.Shell>
526 # SPDX-License-Identifier: EPL-1.0
527 ##############################################################################
528 # Copyright (c) 2017 The Linux Foundation and others.
530 # All rights reserved. This program and the accompanying materials
531 # are made available under the terms of the Eclipse Public License v1.0
532 # which accompanies this distribution, and is available at
533 # http://www.eclipse.org/legal/epl-v10.html
534 ##############################################################################
536 # Clear log credential files
537 rm "$SETTINGS_FILE"
540 </hudson.tasks.Shell>
541 <hudson.plugins.descriptionsetter.DescriptionSetterBuilder>
542 <regexp>^Build logs: .*</regexp>
543 </hudson.plugins.descriptionsetter.DescriptionSetterBuilder>
545 <scriptOnlyIfSuccess>false</scriptOnlyIfSuccess>
546 <scriptOnlyIfFailure>false</scriptOnlyIfFailure>
547 <markBuildUnstable>false</markBuildUnstable>
548 </org.jenkinsci.plugins.postbuildscript.PostBuildScript>
549 <hudson.plugins.ws__cleanup.WsCleanup plugin="ws-cleanup">
551 <hudson.plugins.ws__cleanup.Pattern>
552 <pattern>**/*.jenkins-trigger</pattern>
554 </hudson.plugins.ws__cleanup.Pattern>
556 <deleteDirs>false</deleteDirs>
557 <cleanupMatrixParent>false</cleanupMatrixParent>
559 <cleanWhenSuccess>true</cleanWhenSuccess>
560 <cleanWhenUnstable>true</cleanWhenUnstable>
561 <cleanWhenFailure>true</cleanWhenFailure>
562 <cleanWhenNotBuilt>true</cleanWhenNotBuilt>
563 <cleanWhenAborted>true</cleanWhenAborted>
564 <notFailBuild>true</notFailBuild>
565 </hudson.plugins.ws__cleanup.WsCleanup>
568 <com.michelin.cio.hudson.plugins.maskpasswords.MaskPasswordsBuildWrapper/>
569 <hudson.plugins.build__timeout.BuildTimeoutWrapper>
570 <timeoutMinutes>30</timeoutMinutes>
571 <timeoutEnvVar>BUILD_TIMEOUT</timeoutEnvVar>
572 <failBuild>true</failBuild>
573 <writingDescription>false</writingDescription>
574 <timeoutPercentage>0</timeoutPercentage>
575 <timeoutMinutesElasticDefault>3</timeoutMinutesElasticDefault>
576 <timeoutType>absolute</timeoutType>
577 </hudson.plugins.build__timeout.BuildTimeoutWrapper>
578 <hudson.plugins.timestamper.TimestamperBuildWrapper/>
579 <com.cloudbees.jenkins.plugins.sshagent.SSHAgentBuildWrapper>
580 <user>test-credential</user>
581 </com.cloudbees.jenkins.plugins.sshagent.SSHAgentBuildWrapper>
582 <jenkins.plugins.openstack.compute.JCloudsOneOffSlave/>