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>
74 <description>Maven selector to be used by shell scripts</description>
75 <defaultValue>/w/tools/hudson.tasks.Maven_MavenInstallation/mvn33</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 <hudson.model.StringParameterDefinition>
101 <name>ARCHIVE_ARTIFACTS</name>
102 <description>Artifacts to archive to the logs server.</description>
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>+refs/pull/*:refs/remotes/origin/pr/*</refspec>
114 <url>git@github.com:example-org/releng/ciman</url>
115 <credentialsId>test-credential</credentialsId>
116 </hudson.plugins.git.UserRemoteConfig>
119 <hudson.plugins.git.BranchSpec>
121 </hudson.plugins.git.BranchSpec>
124 <buildChooser class="hudson.plugins.git.util.DefaultBuildChooser"/>
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 <org.jenkinsci.plugins.ghprb.GhprbTrigger>
155 <allowMembersOfWhitelistedOrgsAsAdmin>false</allowMembersOfWhitelistedOrgsAsAdmin>
159 <triggerPhrase>^recheck$</triggerPhrase>
160 <onlyTriggerPhrase>false</onlyTriggerPhrase>
161 <useGitHubHooks>true</useGitHubHooks>
162 <permitAll>true</permitAll>
163 <autoCloseFailedPullRequests>false</autoCloseFailedPullRequests>
165 <org.jenkinsci.plugins.ghprb.extensions.status.GhprbSimpleStatus>
166 <commitStatusContext>Maven Verify</commitStatusContext>
167 </org.jenkinsci.plugins.ghprb.extensions.status.GhprbSimpleStatus>
169 </org.jenkinsci.plugins.ghprb.GhprbTrigger>
173 <command>echo "quiet=on" > "$HOME/.wgetrc"</command>
174 </hudson.tasks.Shell>
176 <targets>--version</targets>
178 <mavenName>mvn33</mavenName>
179 <usePrivateRepository>false</usePrivateRepository>
180 <settings class="jenkins.mvn.DefaultSettingsProvider"/>
181 <globalSettings class="jenkins.mvn.DefaultGlobalSettingsProvider"/>
182 </hudson.tasks.Maven>
184 <command>rm "$HOME/.wgetrc"</command>
185 </hudson.tasks.Shell>
188 <propertiesContent>SONAR_HOST_URL=$SONAR_URL
189 SONAR_MAVEN_GOAL=sonar:sonar
193 <org.jenkinsci.plugins.configfiles.builder.ConfigFileBuildStep plugin="config-file-provider">
195 <org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
196 <fileId>global-settings</fileId>
198 <variable>GLOBAL_SETTINGS_FILE</variable>
199 </org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
200 <org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
201 <fileId>aproject-settings</fileId>
203 <variable>SETTINGS_FILE</variable>
204 </org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
206 </org.jenkinsci.plugins.configfiles.builder.ConfigFileBuildStep>
209 # SPDX-License-Identifier: EPL-1.0
210 ##############################################################################
211 # Copyright (c) 2017 The Linux Foundation and others.
213 # All rights reserved. This program and the accompanying materials
214 # are made available under the terms of the Eclipse Public License v1.0
215 # which accompanies this distribution, and is available at
216 # http://www.eclipse.org/legal/epl-v10.html
217 ##############################################################################
219 # This file contains a list of variables that are generally useful in many
220 # scripts. It is meant to be sourced in other scripts so that the variables can
223 MAVEN_OPTIONS="$(echo --show-version \
226 -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn \
227 -Dmaven.repo.local=/tmp/r \
228 -Dorg.ops4j.pax.url.mvn.localRepository=/tmp/r)"
229 echo "$MAVEN_OPTIONS"
232 # SPDX-License-Identifier: EPL-1.0
233 ##############################################################################
234 # Copyright (c) 2017 The Linux Foundation and others.
236 # All rights reserved. This program and the accompanying materials
237 # are made available under the terms of the Eclipse Public License v1.0
238 # which accompanies this distribution, and is available at
239 # http://www.eclipse.org/legal/epl-v10.html
240 ##############################################################################
242 # This script builds a Maven project and deploys it into a staging repo which
243 # can be used to deploy elsewhere later eg. Nexus staging / snapshot repos.
245 # DO NOT enable -u because $MAVEN_PARAMS and $MAVEN_OPTIONS could be unbound.
246 # Ensure we fail the job if any steps fail.
252 # Disable SC2086 because we want to allow word splitting for $MAVEN_* parameters.
253 # shellcheck disable=SC2086
256 --global-settings "$GLOBAL_SETTINGS_FILE" \
257 --settings "$SETTINGS_FILE" \
258 -DaltDeploymentRepository=staging::default::file:"$WORKSPACE"/m2repo \
259 $MAVEN_PARAMS $MAVEN_OPTIONS
261 # Disable SC2086 because we want to allow word splitting for $MAVEN_* parameters.
262 # shellcheck disable=SC2086
263 $MVN $SONAR_MAVEN_GOAL \
264 -Dsonar -Dsonar.host.url="$SONAR_HOST_URL" \
265 --global-settings "$GLOBAL_SETTINGS_FILE" \
266 --settings "$SETTINGS_FILE" \
267 -DaltDeploymentRepository=staging::default::file:"$WORKSPACE"/m2repo \
268 $MAVEN_PARAMS $MAVEN_OPTIONS
270 </hudson.tasks.Shell>
273 set +e # DO NOT cause build failure if any of the rm calls fail.
275 rm "$GLOBAL_SETTINGS_FILE" "$SETTINGS_FILE"
277 # In some cases we use the lf-provide-maven-settings macro to produce
278 # a "$HOME/.netrc" file containing credentials. Remove that file here
280 rm "$HOME/.netrc"
282 # DO NOT fail build if any of the above lines fail.
285 </hudson.tasks.Shell>
288 <hudson.plugins.jacoco.JacocoPublisher>
289 <execPattern>**/**.exec</execPattern>
290 <classPattern>**/classes</classPattern>
291 <sourcePattern>**/src/main/java</sourcePattern>
294 <exclusionPattern>**/gen/**,**/generated-sources/**,**/yang-gen**,**/pax/**</exclusionPattern>
295 <maximumBranchCoverage>10</maximumBranchCoverage>
296 <minimumBranchCoverage>20</minimumBranchCoverage>
297 <maximumMethodCoverage>50</maximumMethodCoverage>
298 <minimumMethodCoverage>40</minimumMethodCoverage>
299 </hudson.plugins.jacoco.JacocoPublisher>
300 <hudson.plugins.findbugs.FindBugsPublisher plugin="findbugs">
301 <isRankActivated>false</isRankActivated>
306 <thresholdLimit>low</thresholdLimit>
307 <pluginName>[FINDBUGS] </pluginName>
309 <canRunOnFailed>false</canRunOnFailed>
310 <useStableBuildAsReference>false</useStableBuildAsReference>
311 <usePreviousBuildAsReference>false</usePreviousBuildAsReference>
312 <useDeltaValues>false</useDeltaValues>
316 <unstableTotalNormal/>
323 <shouldDetectModules>false</shouldDetectModules>
324 <dontComputeNew>true</dontComputeNew>
325 <doNotResolveRelativePaths>false</doNotResolveRelativePaths>
327 </hudson.plugins.findbugs.FindBugsPublisher>
328 <org.jenkinsci.plugins.postbuildscript.PostBuildScript>
332 # SPDX-License-Identifier: EPL-1.0
333 ##############################################################################
334 # Copyright (c) 2017 The Linux Foundation and others.
336 # All rights reserved. This program and the accompanying materials
337 # are made available under the terms of the Eclipse Public License v1.0
338 # which accompanies this distribution, and is available at
339 # http://www.eclipse.org/legal/epl-v10.html
340 ##############################################################################
341 echo "---> sysstat.sh"
342 set +e # DON'T fail build if script fails.
344 OS=$(facter operatingsystem)
345 case "$OS" in
347 SYSSTAT_PATH="/var/log/sysstat"
349 # Dont run the script when systat is not enabled by default
350 if ! grep --quiet 'ENABLED="true"' "/etc/default/sysstat"; then
355 SYSSTAT_PATH="/var/log/sa"
363 SAR_DIR="$WORKSPACE/archives/sar-reports"
364 mkdir -p "$SAR_DIR"
365 cp "$SYSSTAT_PATH/"* "$_"
366 # convert sar data to ascii format
367 while IFS="" read -r s
369 [ -f "$s" ] && LC_TIME=POSIX sar -A -f "$s" > "$SAR_DIR/sar${s//[!0-9]/}"
370 done < <(find "$SYSSTAT_PATH" -name "sa[0-9]*" || true)
372 # DON'T fail build if script fails.
375 </hudson.tasks.Shell>
376 <org.jenkinsci.plugins.configfiles.builder.ConfigFileBuildStep plugin="config-file-provider">
378 <org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
379 <fileId>jenkins-log-archives-settings</fileId>
381 <variable>SETTINGS_FILE</variable>
382 </org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
384 </org.jenkinsci.plugins.configfiles.builder.ConfigFileBuildStep>
387 <propertiesContent>SERVER_ID=logs</propertiesContent>
392 # SPDX-License-Identifier: EPL-1.0
393 ##############################################################################
394 # Copyright (c) 2017 The Linux Foundation and others.
396 # All rights reserved. This program and the accompanying materials
397 # are made available under the terms of the Eclipse Public License v1.0
398 # which accompanies this distribution, and is available at
399 # http://www.eclipse.org/legal/epl-v10.html
400 ##############################################################################
401 echo "---> create-netrc.sh"
403 # Ensure we fail the job if any steps fail.
406 NEXUS_URL="${NEXUSPROXY:-$NEXUS_URL}"
407 CREDENTIAL=$(xmlstarlet sel -N "x=http://maven.apache.org/SETTINGS/1.0.0" \
408 -t -m "/x:settings/x:servers/x:server[x:id='${SERVER_ID}']" \
409 -v x:username -o ":" -v x:password \
410 "$SETTINGS_FILE")
412 machine=$(echo "$NEXUS_URL" | awk -F/ '{print $3}')
413 user=$(echo "$CREDENTIAL" | cut -f1 -d:)
414 pass=$(echo "$CREDENTIAL" | cut -f2 -d:)
416 echo "machine ${machine%:*} login $user password $pass" > ~/.netrc
418 </hudson.tasks.Shell>
421 # SPDX-License-Identifier: EPL-1.0
422 ##############################################################################
423 # Copyright (c) 2017 The Linux Foundation and others.
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 echo "---> lftools-install.sh"
432 # Script to install lftools via a version passed in via lf-infra-parameters
434 # Required parameters:
436 # LFTOOLS_VERSION: Passed in via lf-infra-parameters configuration. Can be
437 # set to a strict version number like '1.2.3' or using
438 # PEP-440 definitions.
442 # >=1.0.0,<2.0.0
444 # By default a released version of lftools should always be used.
445 # The purpose of the 2 variables below is so that lftools devs can test
446 # unreleased versions of lftools. There are 2 methods to install a dev version
449 # 1) gerrit patch: Used to test a patch that has not yet been merged.
450 # To do this set something like this:
451 # LFTOOLS_MODE=gerrit
452 # LFTOOLS_REFSPEC=refs/changes/96/5296/7
454 # 2) git branch: Used to install an lftools version from a specific branch.
455 # To use this set the variables as follows:
457 # LFTOOLS_REFSPEC=master
459 # 3) release : The intended use case and default setting.
460 # Set LFTOOLS_MODE=release, in this case LFTOOLS_REFSPEC is unused.
462 LFTOOLS_MODE=release # release | git | gerrit
463 LFTOOLS_REFSPEC=master
465 # Ensure we fail the job if any steps fail.
466 # DO NOT set -u as virtualenv's activate script has unbound variables
469 virtualenv --quiet "/tmp/v/lftools"
470 # shellcheck source=/tmp/v/lftools/bin/activate disable=SC1091
471 source "/tmp/v/lftools/bin/activate"
472 pip install --quiet --upgrade pip
474 case $LFTOOLS_MODE in
476 git clone https://gerrit.linuxfoundation.org/infra/releng/lftools.git /tmp/lftools
478 git fetch origin "$LFTOOLS_REFSPEC"
479 git checkout FETCH_HEAD
480 pip install --quiet --upgrade -r requirements.txt
481 pip install --quiet --upgrade -e .
486 pip install --quiet --upgrade git+https://gerrit.linuxfoundation.org/infra/releng/lftools.git@"$BRANCH"
490 if [[ $LFTOOLS_VERSION =~ ^[0-9] ]]; then
491 LFTOOLS_VERSION="==$LFTOOLS_VERSION"
494 pip install --quiet --upgrade "lftools${LFTOOLS_VERSION}"
500 # pipdeptree prints out a lot of information because lftools pulls in many
501 # dependencies. Let's only print it if we want to debug.
502 # echo "----> Pip Dependency Tree"
503 # pip install --quiet --upgrade pipdeptree
507 # SPDX-License-Identifier: EPL-1.0
508 ##############################################################################
509 # Copyright (c) 2017 The Linux Foundation and others.
511 # All rights reserved. This program and the accompanying materials
512 # are made available under the terms of the Eclipse Public License v1.0
513 # which accompanies this distribution, and is available at
514 # http://www.eclipse.org/legal/epl-v10.html
515 ##############################################################################
516 echo "---> logs-deploy.sh"
518 # Ensure we fail the job if any steps fail.
521 set -x # Trace commands for this script to make debugging easier.
523 ARCHIVE_ARTIFACTS="${ARCHIVE_ARTIFACTS:-}"
524 LOGS_SERVER="${LOGS_SERVER:-None}"
526 if [ "${LOGS_SERVER}" == 'None' ]
528 set +x # Disable trace since we no longer need it
530 echo "WARNING: Logging server not set"
532 NEXUS_URL="${NEXUSPROXY:-$NEXUS_URL}"
533 NEXUS_PATH="${SILO}/${JENKINS_HOSTNAME}/${JOB_NAME}/${BUILD_NUMBER}"
534 BUILD_URL="${BUILD_URL}"
536 lftools deploy archives -p "$ARCHIVE_ARTIFACTS" "$NEXUS_URL" "$NEXUS_PATH" "$WORKSPACE"
537 lftools deploy logs "$NEXUS_URL" "$NEXUS_PATH" "$BUILD_URL"
539 set +x # Disable trace since we no longer need it.
541 echo "Build logs: <a href=\"$LOGS_SERVER/$NEXUS_PATH\">$LOGS_SERVER/$NEXUS_PATH</a>"
544 </hudson.tasks.Shell>
547 # SPDX-License-Identifier: EPL-1.0
548 ##############################################################################
549 # Copyright (c) 2017 The Linux Foundation and others.
551 # All rights reserved. This program and the accompanying materials
552 # are made available under the terms of the Eclipse Public License v1.0
553 # which accompanies this distribution, and is available at
554 # http://www.eclipse.org/legal/epl-v10.html
555 ##############################################################################
557 # Clear log credential files
558 rm "$SETTINGS_FILE"
561 </hudson.tasks.Shell>
562 <hudson.plugins.descriptionsetter.DescriptionSetterBuilder>
563 <regexp>^Build logs: .*</regexp>
564 </hudson.plugins.descriptionsetter.DescriptionSetterBuilder>
566 <scriptOnlyIfSuccess>false</scriptOnlyIfSuccess>
567 <scriptOnlyIfFailure>false</scriptOnlyIfFailure>
568 <markBuildUnstable>false</markBuildUnstable>
569 </org.jenkinsci.plugins.postbuildscript.PostBuildScript>
570 <hudson.plugins.ws__cleanup.WsCleanup plugin="ws-cleanup">
572 <hudson.plugins.ws__cleanup.Pattern>
573 <pattern>**/*.jenkins-trigger</pattern>
575 </hudson.plugins.ws__cleanup.Pattern>
577 <deleteDirs>false</deleteDirs>
578 <cleanupMatrixParent>false</cleanupMatrixParent>
580 <cleanWhenSuccess>true</cleanWhenSuccess>
581 <cleanWhenUnstable>true</cleanWhenUnstable>
582 <cleanWhenFailure>true</cleanWhenFailure>
583 <cleanWhenNotBuilt>true</cleanWhenNotBuilt>
584 <cleanWhenAborted>true</cleanWhenAborted>
585 <notFailBuild>true</notFailBuild>
586 </hudson.plugins.ws__cleanup.WsCleanup>
589 <com.michelin.cio.hudson.plugins.maskpasswords.MaskPasswordsBuildWrapper/>
590 <hudson.plugins.build__timeout.BuildTimeoutWrapper>
591 <timeoutMinutes>30</timeoutMinutes>
592 <timeoutEnvVar>BUILD_TIMEOUT</timeoutEnvVar>
593 <failBuild>true</failBuild>
594 <writingDescription>false</writingDescription>
595 <timeoutPercentage>0</timeoutPercentage>
596 <timeoutMinutesElasticDefault>3</timeoutMinutesElasticDefault>
597 <timeoutType>absolute</timeoutType>
598 </hudson.plugins.build__timeout.BuildTimeoutWrapper>
599 <hudson.plugins.timestamper.TimestamperBuildWrapper/>
600 <com.cloudbees.jenkins.plugins.sshagent.SSHAgentBuildWrapper>
601 <user>test-credential</user>
602 </com.cloudbees.jenkins.plugins.sshagent.SSHAgentBuildWrapper>
603 <jenkins.plugins.openstack.compute.JCloudsOneOffSlave/>
604 <org.jenkinsci.plugins.configfiles.buildwrapper.ConfigFileBuildWrapper plugin="config-file-provider">
606 <org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
607 <fileId>npmrc</fileId>
608 <targetLocation>$HOME/.npmrc</targetLocation>
610 </org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
612 </org.jenkinsci.plugins.configfiles.buildwrapper.ConfigFileBuildWrapper>