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 <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>
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
24 <defaultValue>releng/ciman</defaultValue>
25 </hudson.model.StringParameterDefinition>
26 <hudson.model.StringParameterDefinition>
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
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
40 Note that Gerrit will override this parameter automatically if a
41 job is triggered by Gerrit.
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.
49 Note that Gerrit will override this parameter automatically if a
50 job is triggered by Gerrit.
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.
58 Note that Gerrit will override this parameter automatically if a
59 job is triggered by Gerrit.
61 <defaultValue>refs/heads/master</defaultValue>
62 </hudson.model.StringParameterDefinition>
63 <hudson.model.StringParameterDefinition>
64 <name>LFTOOLS_VERSION</name>
65 <description>Version of lftools to install. Can be a specific version like
66 '0.6.0' or a PEP-440 definition.
67 https://www.python.org/dev/peps/pep-0440/
68 For example '<1.0.0' or '>=1.0.0,<2.0.0'.
70 <defaultValue><1.0.0</defaultValue>
71 </hudson.model.StringParameterDefinition>
72 <hudson.model.StringParameterDefinition>
73 <name>MAVEN_OPTS</name>
74 <description>Maven Java opts. Example: -Xmx1024m -XX:MaxPermSize=256m
77 </hudson.model.StringParameterDefinition>
78 <hudson.model.StringParameterDefinition>
79 <name>MAVEN_PARAMS</name>
80 <description>Maven parameters to pass to the mvn command.
83 </hudson.model.StringParameterDefinition>
84 <hudson.model.StringParameterDefinition>
86 <description>Maven selector to be used by shell scripts</description>
87 <defaultValue>/w/tools/hudson.tasks.Maven_MavenInstallation/mvn33/bin/mvn</defaultValue>
88 </hudson.model.StringParameterDefinition>
89 <hudson.model.StringParameterDefinition>
90 <name>STAGING_PROFILE_ID</name>
91 <description>Nexus staging profile ID.
93 <defaultValue>uuddlrlrba</defaultValue>
94 </hudson.model.StringParameterDefinition>
95 </parameterDefinitions>
96 </hudson.model.ParametersDefinitionProperty>
98 <scm class="hudson.plugins.git.GitSCM">
99 <configVersion>2</configVersion>
101 <hudson.plugins.git.UserRemoteConfig>
103 <refspec>+refs/pull/*:refs/remotes/origin/pr/*</refspec>
104 <url>git@github.com:example-org/releng/ciman</url>
105 <credentialsId>test-credential</credentialsId>
106 </hudson.plugins.git.UserRemoteConfig>
109 <hudson.plugins.git.BranchSpec>
111 </hudson.plugins.git.BranchSpec>
114 <buildChooser class="hudson.plugins.git.util.DefaultBuildChooser"/>
115 <doGenerateSubmoduleConfigurations>false</doGenerateSubmoduleConfigurations>
116 <authorOrCommitter>false</authorOrCommitter>
117 <wipeOutWorkspace>true</wipeOutWorkspace>
118 <pruneBranches>false</pruneBranches>
119 <remotePoll>false</remotePoll>
120 <gitTool>Default</gitTool>
121 <submoduleCfg class="list"/>
126 <skipTag>true</skipTag>
128 <useShallowClone>false</useShallowClone>
129 <ignoreNotifyCommit>false</ignoreNotifyCommit>
131 <hudson.plugins.git.extensions.impl.SubmoduleOption>
132 <disableSubmodules>false</disableSubmodules>
133 <recursiveSubmodules>true</recursiveSubmodules>
134 <trackingSubmodules>false</trackingSubmodules>
136 <timeout>10</timeout>
137 </hudson.plugins.git.extensions.impl.SubmoduleOption>
138 <hudson.plugins.git.extensions.impl.WipeWorkspace/>
141 <triggers class="vector">
142 <org.jenkinsci.plugins.ghprb.GhprbTrigger>
145 <allowMembersOfWhitelistedOrgsAsAdmin>false</allowMembersOfWhitelistedOrgsAsAdmin>
149 <triggerPhrase>^recheck$</triggerPhrase>
150 <onlyTriggerPhrase>false</onlyTriggerPhrase>
151 <useGitHubHooks>true</useGitHubHooks>
152 <permitAll>true</permitAll>
153 <autoCloseFailedPullRequests>false</autoCloseFailedPullRequests>
155 <org.jenkinsci.plugins.ghprb.extensions.status.GhprbSimpleStatus>
156 <commitStatusContext>Maven Verify</commitStatusContext>
157 </org.jenkinsci.plugins.ghprb.extensions.status.GhprbSimpleStatus>
159 </org.jenkinsci.plugins.ghprb.GhprbTrigger>
163 <command>echo "quiet=on" > "$HOME/.wgetrc"</command>
164 </hudson.tasks.Shell>
166 <targets>--version</targets>
168 <mavenName>mvn33</mavenName>
169 <usePrivateRepository>false</usePrivateRepository>
170 <settings class="jenkins.mvn.DefaultSettingsProvider"/>
171 <globalSettings class="jenkins.mvn.DefaultGlobalSettingsProvider"/>
172 </hudson.tasks.Maven>
174 <command>rm "$HOME/.wgetrc"</command>
175 </hudson.tasks.Shell>
178 <propertiesContent>SONAR_HOST_URL=$SONAR_URL
179 SONAR_MAVEN_GOAL=sonar:sonar
183 <org.jenkinsci.plugins.configfiles.builder.ConfigFileBuildStep plugin="config-file-provider">
185 <org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
186 <fileId>global-settings</fileId>
188 <variable>GLOBAL_SETTINGS_FILE</variable>
189 </org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
190 <org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
191 <fileId>aproject-settings</fileId>
193 <variable>SETTINGS_FILE</variable>
194 </org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
196 </org.jenkinsci.plugins.configfiles.builder.ConfigFileBuildStep>
199 # SPDX-License-Identifier: EPL-1.0
200 ##############################################################################
201 # Copyright (c) 2017 The Linux Foundation and others.
203 # All rights reserved. This program and the accompanying materials
204 # are made available under the terms of the Eclipse Public License v1.0
205 # which accompanies this distribution, and is available at
206 # http://www.eclipse.org/legal/epl-v10.html
207 ##############################################################################
209 # This file contains a list of variables that are generally useful in many
210 # scripts. It is meant to be sourced in other scripts so that the variables can
213 MAVEN_OPTIONS="$(echo --show-version \
216 -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn \
217 -Dmaven.repo.local=/tmp/r \
218 -Dorg.ops4j.pax.url.mvn.localRepository=/tmp/r)"
219 echo "$MAVEN_OPTIONS"
222 # SPDX-License-Identifier: EPL-1.0
223 ##############################################################################
224 # Copyright (c) 2017 The Linux Foundation and others.
226 # All rights reserved. This program and the accompanying materials
227 # are made available under the terms of the Eclipse Public License v1.0
228 # which accompanies this distribution, and is available at
229 # http://www.eclipse.org/legal/epl-v10.html
230 ##############################################################################
232 # This script builds a Maven project and deploys it into a staging repo which
233 # can be used to deploy elsewhere later eg. Nexus staging / snapshot repos.
235 # DO NOT enable -u because $MAVEN_PARAMS and $MAVEN_OPTIONS could be unbound.
236 # Ensure we fail the job if any steps fail.
242 # Disable SC2086 because we want to allow word splitting for $MAVEN_* parameters.
243 # shellcheck disable=SC2086
246 --global-settings "$GLOBAL_SETTINGS_FILE" \
247 --settings "$SETTINGS_FILE" \
248 -DaltDeploymentRepository=staging::default::file:"$WORKSPACE"/m2repo \
249 $MAVEN_PARAMS $MAVEN_OPTIONS
251 # Disable SC2086 because we want to allow word splitting for $MAVEN_* parameters.
252 # shellcheck disable=SC2086
253 $MVN $SONAR_MAVEN_GOAL \
254 -Dsonar -Dsonar.host.url="$SONAR_HOST_URL" \
255 --global-settings "$GLOBAL_SETTINGS_FILE" \
256 --settings "$SETTINGS_FILE" \
257 -DaltDeploymentRepository=staging::default::file:"$WORKSPACE"/m2repo \
258 $MAVEN_PARAMS $MAVEN_OPTIONS
260 </hudson.tasks.Shell>
263 set +e # DO NOT cause build failure if any of the rm calls fail.
265 rm "$GLOBAL_SETTINGS_FILE" "$SETTINGS_FILE"
267 # In some cases we use the lf-provide-maven-settings macro to produce
268 # a "$HOME/.netrc" file containing credentials. Remove that file here
270 rm "$HOME/.netrc"
272 # DO NOT fail build if any of the above lines fail.
275 </hudson.tasks.Shell>
278 <hudson.plugins.jacoco.JacocoPublisher>
279 <execPattern>**/**.exec</execPattern>
280 <classPattern>**/classes</classPattern>
281 <sourcePattern>**/src/main/java</sourcePattern>
284 <exclusionPattern>**/gen/**,**/generated-sources/**,**/yang-gen**,**/pax/**</exclusionPattern>
285 <maximumBranchCoverage>10</maximumBranchCoverage>
286 <minimumBranchCoverage>20</minimumBranchCoverage>
287 <maximumMethodCoverage>50</maximumMethodCoverage>
288 <minimumMethodCoverage>40</minimumMethodCoverage>
289 </hudson.plugins.jacoco.JacocoPublisher>
290 <hudson.plugins.findbugs.FindBugsPublisher plugin="findbugs">
291 <isRankActivated>false</isRankActivated>
296 <thresholdLimit>low</thresholdLimit>
297 <pluginName>[FINDBUGS] </pluginName>
299 <canRunOnFailed>false</canRunOnFailed>
300 <useStableBuildAsReference>false</useStableBuildAsReference>
301 <usePreviousBuildAsReference>false</usePreviousBuildAsReference>
302 <useDeltaValues>false</useDeltaValues>
306 <unstableTotalNormal/>
313 <shouldDetectModules>false</shouldDetectModules>
314 <dontComputeNew>true</dontComputeNew>
315 <doNotResolveRelativePaths>false</doNotResolveRelativePaths>
317 </hudson.plugins.findbugs.FindBugsPublisher>
318 <org.jenkinsci.plugins.postbuildscript.PostBuildScript>
322 # SPDX-License-Identifier: EPL-1.0
323 ##############################################################################
324 # Copyright (c) 2017 The Linux Foundation and others.
326 # All rights reserved. This program and the accompanying materials
327 # are made available under the terms of the Eclipse Public License v1.0
328 # which accompanies this distribution, and is available at
329 # http://www.eclipse.org/legal/epl-v10.html
330 ##############################################################################
331 echo "---> sysstat.sh"
332 set +e # DON'T fail build if script fails.
334 OS=$(facter operatingsystem)
335 case "$OS" in
337 SYSSTAT_PATH="/var/log/sysstat"
339 # Dont run the script when systat is not enabled by default
340 if ! grep --quiet 'ENABLED="true"' "/etc/default/sysstat"; then
345 SYSSTAT_PATH="/var/log/sa"
353 SAR_DIR="$WORKSPACE/archives/sar-reports"
354 mkdir -p "$SAR_DIR"
355 cp "$SYSSTAT_PATH/"* "$_"
356 # convert sar data to ascii format
357 while IFS="" read -r s
359 [ -f "$s" ] && LC_TIME=POSIX sar -A -f "$s" > "$SAR_DIR/sar${s//[!0-9]/}"
360 done < <(find "$SYSSTAT_PATH" -name "sa[0-9]*" || true)
362 # DON'T fail build if script fails.
365 </hudson.tasks.Shell>
366 <org.jenkinsci.plugins.configfiles.builder.ConfigFileBuildStep plugin="config-file-provider">
368 <org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
369 <fileId>jenkins-log-archives-settings</fileId>
371 <variable>SETTINGS_FILE</variable>
372 </org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
374 </org.jenkinsci.plugins.configfiles.builder.ConfigFileBuildStep>
377 <propertiesContent>SERVER_ID=logs</propertiesContent>
382 # SPDX-License-Identifier: EPL-1.0
383 ##############################################################################
384 # Copyright (c) 2017 The Linux Foundation and others.
386 # All rights reserved. This program and the accompanying materials
387 # are made available under the terms of the Eclipse Public License v1.0
388 # which accompanies this distribution, and is available at
389 # http://www.eclipse.org/legal/epl-v10.html
390 ##############################################################################
391 echo "---> create-netrc.sh"
393 # Ensure we fail the job if any steps fail.
396 NEXUS_URL="${NEXUS_URL:-$NEXUSPROXY}"
397 CREDENTIAL=$(xmlstarlet sel -N "x=http://maven.apache.org/SETTINGS/1.0.0" \
398 -t -m "/x:settings/x:servers/x:server[x:id='${SERVER_ID}']" \
399 -v x:username -o ":" -v x:password \
400 "$SETTINGS_FILE")
402 machine=$(echo "$NEXUS_URL" | awk -F/ '{print $3}')
403 user=$(echo "$CREDENTIAL" | cut -f1 -d:)
404 pass=$(echo "$CREDENTIAL" | cut -f2 -d:)
406 echo "machine ${machine%:*} login $user password $pass" > ~/.netrc
408 </hudson.tasks.Shell>
411 # SPDX-License-Identifier: EPL-1.0
412 ##############################################################################
413 # Copyright (c) 2017 The Linux Foundation and others.
415 # All rights reserved. This program and the accompanying materials
416 # are made available under the terms of the Eclipse Public License v1.0
417 # which accompanies this distribution, and is available at
418 # http://www.eclipse.org/legal/epl-v10.html
419 ##############################################################################
420 echo "---> lftools-install.sh"
422 # Script to install lftools via a version passed in via lf-infra-parameters
424 # Required parameters:
426 # LFTOOLS_VERSION: Passed in via lf-infra-parameters configuration. Can be
427 # set to a strict version number like '1.2.3' or using
428 # PEP-440 definitions.
432 # >=1.0.0,<2.0.0
434 # By default a released version of lftools should always be used.
435 # The purpose of the 2 variables below is so that lftools devs can test
436 # unreleased versions of lftools. There are 2 methods to install a dev version
439 # 1) gerrit patch: Used to test a patch that has not yet been merged.
440 # To do this set something like this:
441 # LFTOOLS_MODE=gerrit
442 # LFTOOLS_REFSPEC=refs/changes/96/5296/7
444 # 2) git branch: Used to install an lftools version from a specific branch.
445 # To use this set the variables as follows:
447 # LFTOOLS_REFSPEC=master
449 # 3) release : The intended use case and default setting.
450 # Set LFTOOLS_MODE=release, in this case LFTOOLS_REFSPEC is unused.
452 LFTOOLS_MODE=release # release | git | gerrit
453 LFTOOLS_REFSPEC=master
455 # Ensure we fail the job if any steps fail.
456 # DO NOT set -u as virtualenv's activate script has unbound variables
459 virtualenv --quiet "/tmp/v/lftools"
460 # shellcheck source=/tmp/v/lftools/bin/activate disable=SC1091
461 source "/tmp/v/lftools/bin/activate"
462 pip install --quiet --upgrade pip
464 case $LFTOOLS_MODE in
466 git clone https://gerrit.linuxfoundation.org/infra/releng/lftools.git /tmp/lftools
468 git fetch origin "$LFTOOLS_REFSPEC"
469 git checkout FETCH_HEAD
470 pip install --quiet --upgrade -r requirements.txt
471 pip install --quiet --upgrade -e .
476 pip install --quiet --upgrade git+https://gerrit.linuxfoundation.org/infra/releng/lftools.git@"$BRANCH"
480 if [[ $LFTOOLS_VERSION =~ ^[0-9] ]]; then
481 LFTOOLS_VERSION="==$LFTOOLS_VERSION"
484 pip install --quiet --upgrade "lftools${LFTOOLS_VERSION}"
490 # pipdeptree prints out a lot of information because lftools pulls in many
491 # dependencies. Let's only print it if we want to debug.
492 # echo "----> Pip Dependency Tree"
493 # pip install --quiet --upgrade pipdeptree
497 # SPDX-License-Identifier: EPL-1.0
498 ##############################################################################
499 # Copyright (c) 2017 The Linux Foundation and others.
501 # All rights reserved. This program and the accompanying materials
502 # are made available under the terms of the Eclipse Public License v1.0
503 # which accompanies this distribution, and is available at
504 # http://www.eclipse.org/legal/epl-v10.html
505 ##############################################################################
506 echo "---> logs-deploy.sh"
508 # Ensure we fail the job if any steps fail.
511 set -x # Trace commands for this script to make debugging easier.
513 ARCHIVE_ARTIFACTS="${ARCHIVE_ARTIFACTS:-}"
514 LOGS_SERVER="${LOGS_SERVER:-None}"
516 if [ "${LOGS_SERVER}" == 'None' ]
518 set +x # Disable trace since we no longer need it
520 echo "WARNING: Logging server not set"
522 NEXUS_URL="${NEXUS_URL:-$NEXUSPROXY}"
523 NEXUS_PATH="${SILO}/${JENKINS_HOSTNAME}/${JOB_NAME}/${BUILD_NUMBER}"
524 BUILD_URL="${BUILD_URL}"
526 lftools deploy archives -p "$ARCHIVE_ARTIFACTS" "$NEXUS_URL" "$NEXUS_PATH" "$WORKSPACE"
527 lftools deploy logs "$NEXUS_URL" "$NEXUS_PATH" "$BUILD_URL"
529 set +x # Disable trace since we no longer need it.
531 echo "Build logs: <a href=\"$LOGS_SERVER/$NEXUS_PATH\">$LOGS_SERVER/$NEXUS_PATH</a>"
534 </hudson.tasks.Shell>
537 # SPDX-License-Identifier: EPL-1.0
538 ##############################################################################
539 # Copyright (c) 2017 The Linux Foundation and others.
541 # All rights reserved. This program and the accompanying materials
542 # are made available under the terms of the Eclipse Public License v1.0
543 # which accompanies this distribution, and is available at
544 # http://www.eclipse.org/legal/epl-v10.html
545 ##############################################################################
547 # Clear log credential files
548 rm "$SETTINGS_FILE"
551 </hudson.tasks.Shell>
552 <hudson.plugins.descriptionsetter.DescriptionSetterBuilder>
553 <regexp>^Build logs: .*</regexp>
554 </hudson.plugins.descriptionsetter.DescriptionSetterBuilder>
556 <scriptOnlyIfSuccess>false</scriptOnlyIfSuccess>
557 <scriptOnlyIfFailure>false</scriptOnlyIfFailure>
558 <markBuildUnstable>false</markBuildUnstable>
559 </org.jenkinsci.plugins.postbuildscript.PostBuildScript>
560 <hudson.plugins.ws__cleanup.WsCleanup plugin="ws-cleanup">
562 <hudson.plugins.ws__cleanup.Pattern>
563 <pattern>**/*.jenkins-trigger</pattern>
565 </hudson.plugins.ws__cleanup.Pattern>
567 <deleteDirs>false</deleteDirs>
568 <cleanupMatrixParent>false</cleanupMatrixParent>
570 <cleanWhenSuccess>true</cleanWhenSuccess>
571 <cleanWhenUnstable>true</cleanWhenUnstable>
572 <cleanWhenFailure>true</cleanWhenFailure>
573 <cleanWhenNotBuilt>true</cleanWhenNotBuilt>
574 <cleanWhenAborted>true</cleanWhenAborted>
575 <notFailBuild>true</notFailBuild>
576 </hudson.plugins.ws__cleanup.WsCleanup>
579 <com.michelin.cio.hudson.plugins.maskpasswords.MaskPasswordsBuildWrapper/>
580 <hudson.plugins.build__timeout.BuildTimeoutWrapper>
581 <timeoutMinutes>30</timeoutMinutes>
582 <timeoutEnvVar>BUILD_TIMEOUT</timeoutEnvVar>
583 <failBuild>true</failBuild>
584 <writingDescription>false</writingDescription>
585 <timeoutPercentage>0</timeoutPercentage>
586 <timeoutMinutesElasticDefault>3</timeoutMinutesElasticDefault>
587 <timeoutType>absolute</timeoutType>
588 </hudson.plugins.build__timeout.BuildTimeoutWrapper>
589 <hudson.plugins.timestamper.TimestamperBuildWrapper/>
590 <com.cloudbees.jenkins.plugins.sshagent.SSHAgentBuildWrapper>
591 <user>test-credential</user>
592 </com.cloudbees.jenkins.plugins.sshagent.SSHAgentBuildWrapper>
593 <jenkins.plugins.openstack.compute.JCloudsOneOffSlave/>