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>7</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="hudson.plugins.git.util.DefaultBuildChooser"/>
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 <hudson.triggers.TimerTrigger>
148 <spec>H H * * 6</spec>
149 </hudson.triggers.TimerTrigger>
150 <com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.GerritTrigger>
153 <com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.data.GerritProject>
154 <compareType>ANT</compareType>
155 <pattern>releng/ciman</pattern>
157 <com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.data.Branch>
158 <compareType>ANT</compareType>
159 <pattern>**/master</pattern>
160 </com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.data.Branch>
162 <disableStrictForbiddenFileVerification>false</disableStrictForbiddenFileVerification>
163 </com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.data.GerritProject>
166 <onSuccessful>true</onSuccessful>
167 <onFailed>true</onFailed>
168 <onUnstable>true</onUnstable>
169 <onNotBuilt>true</onNotBuilt>
171 <silentMode>false</silentMode>
172 <silentStartMode>false</silentStartMode>
173 <escapeQuotes>true</escapeQuotes>
174 <noNameAndEmailParameters>false</noNameAndEmailParameters>
175 <readableMessage>false</readableMessage>
176 <dependencyJobsNames/>
178 <dynamicTriggerConfiguration>False</dynamicTriggerConfiguration>
180 <allowTriggeringUnreviewedPatches>false</allowTriggeringUnreviewedPatches>
182 <com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.events.PluginCommentAddedContainsEvent>
183 <commentAddedCommentContains>run-sonar$</commentAddedCommentContains>
184 </com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.events.PluginCommentAddedContainsEvent>
187 <buildFailureMessage/>
188 <buildSuccessfulMessage/>
189 <buildUnstableMessage/>
190 <buildNotBuiltMessage/>
191 <buildUnsuccessfulFilepath/>
193 <serverName>test-server</serverName>
194 </com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.GerritTrigger>
198 <command>echo "quiet=on" > "$HOME/.wgetrc"</command>
199 </hudson.tasks.Shell>
201 <targets>--version</targets>
203 <mavenName>mvn33</mavenName>
204 <usePrivateRepository>false</usePrivateRepository>
205 <settings class="jenkins.mvn.DefaultSettingsProvider"/>
206 <globalSettings class="jenkins.mvn.DefaultGlobalSettingsProvider"/>
207 </hudson.tasks.Maven>
209 <command>rm "$HOME/.wgetrc"</command>
210 </hudson.tasks.Shell>
213 <propertiesContent>SONAR_HOST_URL=$SONAR_URL
214 SONAR_MAVEN_GOAL=sonar:sonar
218 <org.jenkinsci.plugins.configfiles.builder.ConfigFileBuildStep plugin="config-file-provider">
220 <org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
221 <fileId>global-settings</fileId>
223 <variable>GLOBAL_SETTINGS_FILE</variable>
224 </org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
225 <org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
226 <fileId>gerrit-maven-project-settings</fileId>
228 <variable>SETTINGS_FILE</variable>
229 </org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
231 </org.jenkinsci.plugins.configfiles.builder.ConfigFileBuildStep>
234 # SPDX-License-Identifier: EPL-1.0
235 ##############################################################################
236 # Copyright (c) 2017 The Linux Foundation and others.
238 # All rights reserved. This program and the accompanying materials
239 # are made available under the terms of the Eclipse Public License v1.0
240 # which accompanies this distribution, and is available at
241 # http://www.eclipse.org/legal/epl-v10.html
242 ##############################################################################
244 # This file contains a list of variables that are generally useful in many
245 # scripts. It is meant to be sourced in other scripts so that the variables can
248 MAVEN_OPTIONS="$(echo --show-version \
251 -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn \
252 -Dmaven.repo.local=/tmp/r \
253 -Dorg.ops4j.pax.url.mvn.localRepository=/tmp/r)"
254 echo "$MAVEN_OPTIONS"
257 # SPDX-License-Identifier: EPL-1.0
258 ##############################################################################
259 # Copyright (c) 2017 The Linux Foundation and others.
261 # All rights reserved. This program and the accompanying materials
262 # are made available under the terms of the Eclipse Public License v1.0
263 # which accompanies this distribution, and is available at
264 # http://www.eclipse.org/legal/epl-v10.html
265 ##############################################################################
267 # This script builds a Maven project and deploys it into a staging repo which
268 # can be used to deploy elsewhere later eg. Nexus staging / snapshot repos.
270 # DO NOT enable -u because $MAVEN_PARAMS and $MAVEN_OPTIONS could be unbound.
271 # Ensure we fail the job if any steps fail.
277 # Disable SC2086 because we want to allow word splitting for $MAVEN_* parameters.
278 # shellcheck disable=SC2086
281 --global-settings "$GLOBAL_SETTINGS_FILE" \
282 --settings "$SETTINGS_FILE" \
283 -DaltDeploymentRepository=staging::default::file:"$WORKSPACE"/m2repo \
284 $MAVEN_PARAMS $MAVEN_OPTIONS
286 # Disable SC2086 because we want to allow word splitting for $MAVEN_* parameters.
287 # shellcheck disable=SC2086
288 $MVN $SONAR_MAVEN_GOAL \
289 -Dsonar -Dsonar.host.url="$SONAR_HOST_URL" \
290 --global-settings "$GLOBAL_SETTINGS_FILE" \
291 --settings "$SETTINGS_FILE" \
292 -DaltDeploymentRepository=staging::default::file:"$WORKSPACE"/m2repo \
293 $MAVEN_PARAMS $MAVEN_OPTIONS
295 </hudson.tasks.Shell>
298 set +e # DO NOT cause build failure if any of the rm calls fail.
300 rm "$GLOBAL_SETTINGS_FILE" "$SETTINGS_FILE"
302 # In some cases we use the lf-provide-maven-settings macro to produce
303 # a "$HOME/.netrc" file containing credentials. Remove that file here
305 rm "$HOME/.netrc"
307 # DO NOT fail build if any of the above lines fail.
310 </hudson.tasks.Shell>
313 <hudson.plugins.jacoco.JacocoPublisher>
314 <execPattern>**/**.exec</execPattern>
315 <classPattern>**/classes</classPattern>
316 <sourcePattern>**/src/main/java</sourcePattern>
319 <exclusionPattern>**/gen/**,**/generated-sources/**,**/yang-gen**,**/pax/**</exclusionPattern>
320 <maximumBranchCoverage>10</maximumBranchCoverage>
321 <minimumBranchCoverage>20</minimumBranchCoverage>
322 <maximumMethodCoverage>50</maximumMethodCoverage>
323 <minimumMethodCoverage>40</minimumMethodCoverage>
324 </hudson.plugins.jacoco.JacocoPublisher>
325 <hudson.plugins.findbugs.FindBugsPublisher plugin="findbugs">
326 <isRankActivated>false</isRankActivated>
331 <thresholdLimit>low</thresholdLimit>
332 <pluginName>[FINDBUGS] </pluginName>
334 <canRunOnFailed>false</canRunOnFailed>
335 <useStableBuildAsReference>false</useStableBuildAsReference>
336 <usePreviousBuildAsReference>false</usePreviousBuildAsReference>
337 <useDeltaValues>false</useDeltaValues>
341 <unstableTotalNormal/>
348 <shouldDetectModules>false</shouldDetectModules>
349 <dontComputeNew>true</dontComputeNew>
350 <doNotResolveRelativePaths>false</doNotResolveRelativePaths>
352 </hudson.plugins.findbugs.FindBugsPublisher>
353 <org.jenkinsci.plugins.postbuildscript.PostBuildScript>
357 # SPDX-License-Identifier: EPL-1.0
358 ##############################################################################
359 # Copyright (c) 2017 The Linux Foundation and others.
361 # All rights reserved. This program and the accompanying materials
362 # are made available under the terms of the Eclipse Public License v1.0
363 # which accompanies this distribution, and is available at
364 # http://www.eclipse.org/legal/epl-v10.html
365 ##############################################################################
366 echo "---> sysstat.sh"
367 set +e # DON'T fail build if script fails.
369 OS=$(facter operatingsystem)
370 case "$OS" in
372 SYSSTAT_PATH="/var/log/sysstat"
374 # Dont run the script when systat is not enabled by default
375 if ! grep --quiet 'ENABLED="true"' "/etc/default/sysstat"; then
380 SYSSTAT_PATH="/var/log/sa"
388 SAR_DIR="$WORKSPACE/archives/sar-reports"
389 mkdir -p "$SAR_DIR"
390 cp "$SYSSTAT_PATH/"* "$_"
391 # convert sar data to ascii format
392 while IFS="" read -r s
394 [ -f "$s" ] && LC_TIME=POSIX sar -A -f "$s" > "$SAR_DIR/sar${s//[!0-9]/}"
395 done < <(find "$SYSSTAT_PATH" -name "sa[0-9]*" || true)
397 # DON'T fail build if script fails.
400 </hudson.tasks.Shell>
401 <org.jenkinsci.plugins.configfiles.builder.ConfigFileBuildStep plugin="config-file-provider">
403 <org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
404 <fileId>jenkins-log-archives-settings</fileId>
406 <variable>SETTINGS_FILE</variable>
407 </org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
409 </org.jenkinsci.plugins.configfiles.builder.ConfigFileBuildStep>
412 <propertiesContent>SERVER_ID=logs</propertiesContent>
417 # SPDX-License-Identifier: EPL-1.0
418 ##############################################################################
419 # Copyright (c) 2017 The Linux Foundation and others.
421 # All rights reserved. This program and the accompanying materials
422 # are made available under the terms of the Eclipse Public License v1.0
423 # which accompanies this distribution, and is available at
424 # http://www.eclipse.org/legal/epl-v10.html
425 ##############################################################################
426 echo "---> create-netrc.sh"
428 # Ensure we fail the job if any steps fail.
431 NEXUS_URL="${NEXUS_URL:-$NEXUSPROXY}"
432 CREDENTIAL=$(xmlstarlet sel -N "x=http://maven.apache.org/SETTINGS/1.0.0" \
433 -t -m "/x:settings/x:servers/x:server[x:id='${SERVER_ID}']" \
434 -v x:username -o ":" -v x:password \
435 "$SETTINGS_FILE")
437 machine=$(echo "$NEXUS_URL" | awk -F/ '{print $3}')
438 user=$(echo "$CREDENTIAL" | cut -f1 -d:)
439 pass=$(echo "$CREDENTIAL" | cut -f2 -d:)
441 echo "machine $machine login $user password $pass" > ~/.netrc
443 </hudson.tasks.Shell>
446 # SPDX-License-Identifier: EPL-1.0
447 ##############################################################################
448 # Copyright (c) 2017 The Linux Foundation and others.
450 # All rights reserved. This program and the accompanying materials
451 # are made available under the terms of the Eclipse Public License v1.0
452 # which accompanies this distribution, and is available at
453 # http://www.eclipse.org/legal/epl-v10.html
454 ##############################################################################
455 echo "---> lftools-install.sh"
457 # Script to install lftools via a version passed in via lf-infra-parameters
459 # Required parameters:
461 # LFTOOLS_VERSION: Passed in via lf-infra-parameters configuration. Can be
462 # set to a strict version number like '1.2.3' or using
463 # PEP-440 definitions.
467 # >=1.0.0,<2.0.0
469 # By default a released version of lftools should always be used.
470 # The purpose of the 2 variables below is so that lftools devs can test
471 # unreleased versions of lftools. There are 2 methods to install a dev version
474 # 1) gerrit patch: Used to test a patch that has not yet been merged.
475 # To do this set something like this:
476 # LFTOOLS_MODE=gerrit
477 # LFTOOLS_REFSPEC=refs/changes/96/5296/7
479 # 2) git branch: Used to install an lftools version from a specific branch.
480 # To use this set the variables as follows:
482 # LFTOOLS_REFSPEC=master
484 # 3) release : The intended use case and default setting.
485 # Set LFTOOLS_MODE=release, in this case LFTOOLS_REFSPEC is unused.
487 LFTOOLS_MODE=release # release | git | gerrit
488 LFTOOLS_REFSPEC=master
490 # Ensure we fail the job if any steps fail.
491 # DO NOT set -u as virtualenv's activate script has unbound variables
494 virtualenv --quiet "/tmp/v/lftools"
495 # shellcheck source=/tmp/v/lftools/bin/activate disable=SC1091
496 source "/tmp/v/lftools/bin/activate"
497 pip install --quiet --upgrade pip
499 case $LFTOOLS_MODE in
501 git clone https://gerrit.linuxfoundation.org/infra/releng/lftools.git /tmp/lftools
503 git fetch origin "$LFTOOLS_REFSPEC"
504 git checkout FETCH_HEAD
505 pip install --quiet --upgrade -r requirements.txt
506 pip install --quiet --upgrade -e .
511 pip install --quiet --upgrade git+https://gerrit.linuxfoundation.org/infra/releng/lftools.git@"$BRANCH"
515 if [[ $LFTOOLS_VERSION =~ ^[0-9] ]]; then
516 LFTOOLS_VERSION="==$LFTOOLS_VERSION"
519 pip install --quiet --upgrade "lftools${LFTOOLS_VERSION}"
525 # pipdeptree prints out a lot of information because lftools pulls in many
526 # dependencies. Let's only print it if we want to debug.
527 # echo "----> Pip Dependency Tree"
528 # pip install --quiet --upgrade pipdeptree
532 # SPDX-License-Identifier: EPL-1.0
533 ##############################################################################
534 # Copyright (c) 2017 The Linux Foundation and others.
536 # All rights reserved. This program and the accompanying materials
537 # are made available under the terms of the Eclipse Public License v1.0
538 # which accompanies this distribution, and is available at
539 # http://www.eclipse.org/legal/epl-v10.html
540 ##############################################################################
541 echo "---> logs-deploy.sh"
543 # Ensure we fail the job if any steps fail.
546 set -x # Trace commands for this script to make debugging easier.
548 ARCHIVE_ARTIFACTS="${ARCHIVE_ARTIFACTS:-}"
549 LOGS_SERVER="${LOGS_SERVER:-None}"
551 if [ "${LOGS_SERVER}" == 'None' ]
553 set +x # Disable trace since we no longer need it
555 echo "WARNING: Logging server not set"
557 NEXUS_URL="${NEXUS_URL:-$NEXUSPROXY}"
558 NEXUS_PATH="${SILO}/${JENKINS_HOSTNAME}/${JOB_NAME}/${BUILD_NUMBER}"
559 BUILD_URL="${BUILD_URL}"
561 lftools deploy archives -p "$ARCHIVE_ARTIFACTS" "$NEXUS_URL" "$NEXUS_PATH" "$WORKSPACE"
562 lftools deploy logs "$NEXUS_URL" "$NEXUS_PATH" "$BUILD_URL"
564 set +x # Disable trace since we no longer need it.
566 echo "Build logs: <a href=\"$LOGS_SERVER/$NEXUS_PATH\">$LOGS_SERVER/$NEXUS_PATH</a>"
569 </hudson.tasks.Shell>
572 # SPDX-License-Identifier: EPL-1.0
573 ##############################################################################
574 # Copyright (c) 2017 The Linux Foundation and others.
576 # All rights reserved. This program and the accompanying materials
577 # are made available under the terms of the Eclipse Public License v1.0
578 # which accompanies this distribution, and is available at
579 # http://www.eclipse.org/legal/epl-v10.html
580 ##############################################################################
582 # Clear log credential files
583 rm "$SETTINGS_FILE"
586 </hudson.tasks.Shell>
587 <hudson.plugins.descriptionsetter.DescriptionSetterBuilder>
588 <regexp>^Build logs: .*</regexp>
589 </hudson.plugins.descriptionsetter.DescriptionSetterBuilder>
591 <scriptOnlyIfSuccess>false</scriptOnlyIfSuccess>
592 <scriptOnlyIfFailure>false</scriptOnlyIfFailure>
593 <markBuildUnstable>false</markBuildUnstable>
594 </org.jenkinsci.plugins.postbuildscript.PostBuildScript>
595 <hudson.plugins.ws__cleanup.WsCleanup plugin="ws-cleanup">
597 <hudson.plugins.ws__cleanup.Pattern>
598 <pattern>**/*.jenkins-trigger</pattern>
600 </hudson.plugins.ws__cleanup.Pattern>
602 <deleteDirs>false</deleteDirs>
603 <cleanupMatrixParent>false</cleanupMatrixParent>
605 <cleanWhenSuccess>true</cleanWhenSuccess>
606 <cleanWhenUnstable>true</cleanWhenUnstable>
607 <cleanWhenFailure>true</cleanWhenFailure>
608 <cleanWhenNotBuilt>true</cleanWhenNotBuilt>
609 <cleanWhenAborted>true</cleanWhenAborted>
610 <notFailBuild>true</notFailBuild>
611 </hudson.plugins.ws__cleanup.WsCleanup>
614 <com.michelin.cio.hudson.plugins.maskpasswords.MaskPasswordsBuildWrapper/>
615 <hudson.plugins.build__timeout.BuildTimeoutWrapper>
616 <timeoutMinutes>30</timeoutMinutes>
617 <timeoutEnvVar>BUILD_TIMEOUT</timeoutEnvVar>
618 <failBuild>true</failBuild>
619 <writingDescription>false</writingDescription>
620 <timeoutPercentage>0</timeoutPercentage>
621 <timeoutMinutesElasticDefault>3</timeoutMinutesElasticDefault>
622 <timeoutType>absolute</timeoutType>
623 </hudson.plugins.build__timeout.BuildTimeoutWrapper>
624 <hudson.plugins.timestamper.TimestamperBuildWrapper/>
625 <com.cloudbees.jenkins.plugins.sshagent.SSHAgentBuildWrapper>
626 <user>test-credential</user>
627 </com.cloudbees.jenkins.plugins.sshagent.SSHAgentBuildWrapper>
628 <jenkins.plugins.openstack.compute.JCloudsOneOffSlave/>