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.
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 <hudson.model.StringParameterDefinition>
106 <name>SONAR_MAVEN_GOAL</name>
107 <description>Maven goals to pass to the Sonar call. Typically sonar:sonar
108 however to use a specific version of the sonar-maven-plugin we
109 can call "org.codehaus.mojo:sonar-maven-plugin:3.3.0.603:sonar".
111 <defaultValue>sonar:sonar</defaultValue>
112 </hudson.model.StringParameterDefinition>
113 </parameterDefinitions>
114 </hudson.model.ParametersDefinitionProperty>
116 <scm class="hudson.plugins.git.GitSCM">
117 <configVersion>2</configVersion>
119 <hudson.plugins.git.UserRemoteConfig>
121 <refspec>+refs/pull/*:refs/remotes/origin/pr/*</refspec>
122 <url>git@github.com:example-org/releng/ciman</url>
123 <credentialsId>test-credential</credentialsId>
124 </hudson.plugins.git.UserRemoteConfig>
127 <hudson.plugins.git.BranchSpec>
129 </hudson.plugins.git.BranchSpec>
132 <buildChooser class="hudson.plugins.git.util.DefaultBuildChooser"/>
133 <doGenerateSubmoduleConfigurations>false</doGenerateSubmoduleConfigurations>
134 <authorOrCommitter>false</authorOrCommitter>
135 <wipeOutWorkspace>true</wipeOutWorkspace>
136 <pruneBranches>false</pruneBranches>
137 <remotePoll>false</remotePoll>
138 <gitTool>Default</gitTool>
139 <submoduleCfg class="list"/>
144 <skipTag>true</skipTag>
146 <useShallowClone>false</useShallowClone>
147 <ignoreNotifyCommit>false</ignoreNotifyCommit>
149 <hudson.plugins.git.extensions.impl.SubmoduleOption>
150 <disableSubmodules>false</disableSubmodules>
151 <recursiveSubmodules>true</recursiveSubmodules>
152 <trackingSubmodules>false</trackingSubmodules>
154 <timeout>10</timeout>
155 </hudson.plugins.git.extensions.impl.SubmoduleOption>
156 <hudson.plugins.git.extensions.impl.WipeWorkspace/>
159 <triggers class="vector">
160 <org.jenkinsci.plugins.ghprb.GhprbTrigger>
163 <allowMembersOfWhitelistedOrgsAsAdmin>false</allowMembersOfWhitelistedOrgsAsAdmin>
167 <triggerPhrase>^recheck$</triggerPhrase>
168 <onlyTriggerPhrase>false</onlyTriggerPhrase>
169 <useGitHubHooks>true</useGitHubHooks>
170 <permitAll>true</permitAll>
171 <autoCloseFailedPullRequests>false</autoCloseFailedPullRequests>
173 <org.jenkinsci.plugins.ghprb.extensions.status.GhprbSimpleStatus>
174 <commitStatusContext>Maven Verify</commitStatusContext>
175 </org.jenkinsci.plugins.ghprb.extensions.status.GhprbSimpleStatus>
177 </org.jenkinsci.plugins.ghprb.GhprbTrigger>
181 <command>echo "quiet=on" > "$HOME/.wgetrc"</command>
182 </hudson.tasks.Shell>
184 <targets>--version</targets>
186 <mavenName>mvn33</mavenName>
187 <usePrivateRepository>false</usePrivateRepository>
188 <settings class="jenkins.mvn.DefaultSettingsProvider"/>
189 <globalSettings class="jenkins.mvn.DefaultGlobalSettingsProvider"/>
190 </hudson.tasks.Maven>
192 <command>rm "$HOME/.wgetrc"</command>
193 </hudson.tasks.Shell>
196 <propertiesContent>SONAR_HOST_URL=$SONAR_URL</propertiesContent>
199 <org.jenkinsci.plugins.configfiles.builder.ConfigFileBuildStep plugin="config-file-provider">
201 <org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
202 <fileId>global-settings</fileId>
204 <variable>GLOBAL_SETTINGS_FILE</variable>
205 </org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
206 <org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
207 <fileId>aproject-settings</fileId>
209 <variable>SETTINGS_FILE</variable>
210 </org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
212 </org.jenkinsci.plugins.configfiles.builder.ConfigFileBuildStep>
215 # SPDX-License-Identifier: EPL-1.0
216 ##############################################################################
217 # Copyright (c) 2017 The Linux Foundation and others.
219 # All rights reserved. This program and the accompanying materials
220 # are made available under the terms of the Eclipse Public License v1.0
221 # which accompanies this distribution, and is available at
222 # http://www.eclipse.org/legal/epl-v10.html
223 ##############################################################################
225 # This file contains a list of variables that are generally useful in many
226 # scripts. It is meant to be sourced in other scripts so that the variables can
229 MAVEN_OPTIONS="$(echo --show-version \
232 -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn \
233 -Dmaven.repo.local=/tmp/r \
234 -Dorg.ops4j.pax.url.mvn.localRepository=/tmp/r)"
235 echo "$MAVEN_OPTIONS"
238 # SPDX-License-Identifier: EPL-1.0
239 ##############################################################################
240 # Copyright (c) 2017 The Linux Foundation and others.
242 # All rights reserved. This program and the accompanying materials
243 # are made available under the terms of the Eclipse Public License v1.0
244 # which accompanies this distribution, and is available at
245 # http://www.eclipse.org/legal/epl-v10.html
246 ##############################################################################
248 # This script builds a Maven project and deploys it into a staging repo which
249 # can be used to deploy elsewhere later eg. Nexus staging / snapshot repos.
251 # DO NOT enable -u because $MAVEN_PARAMS and $MAVEN_OPTIONS could be unbound.
252 # Ensure we fail the job if any steps fail.
258 # Disable SC2086 because we want to allow word splitting for $MAVEN_* parameters.
259 # shellcheck disable=SC2086
262 --global-settings "$GLOBAL_SETTINGS_FILE" \
263 --settings "$SETTINGS_FILE" \
264 -DaltDeploymentRepository=staging::default::file:"$WORKSPACE"/m2repo \
265 $MAVEN_OPTIONS $MAVEN_PARAMS
267 # Disable SC2086 because we want to allow word splitting for $MAVEN_* parameters.
268 # shellcheck disable=SC2086
269 $MVN $SONAR_MAVEN_GOAL \
270 -Dsonar -Dsonar.host.url="$SONAR_HOST_URL" \
271 --global-settings "$GLOBAL_SETTINGS_FILE" \
272 --settings "$SETTINGS_FILE" \
273 -DaltDeploymentRepository=staging::default::file:"$WORKSPACE"/m2repo \
274 $MAVEN_OPTIONS $MAVEN_PARAMS
276 </hudson.tasks.Shell>
279 set +e # DO NOT cause build failure if any of the rm calls fail.
281 rm "$GLOBAL_SETTINGS_FILE" "$SETTINGS_FILE"
283 # In some cases we use the lf-provide-maven-settings macro to produce
284 # a "$HOME/.netrc" file containing credentials. Remove that file here
286 rm "$HOME/.netrc"
288 # DO NOT fail build if any of the above lines fail.
291 </hudson.tasks.Shell>
294 <hudson.plugins.jacoco.JacocoPublisher>
295 <execPattern>**/**.exec</execPattern>
296 <classPattern>**/classes</classPattern>
297 <sourcePattern>**/src/main/java</sourcePattern>
300 <exclusionPattern>**/gen/**,**/generated-sources/**,**/yang-gen**,**/pax/**</exclusionPattern>
301 <maximumBranchCoverage>10</maximumBranchCoverage>
302 <minimumBranchCoverage>20</minimumBranchCoverage>
303 <maximumMethodCoverage>50</maximumMethodCoverage>
304 <minimumMethodCoverage>40</minimumMethodCoverage>
305 </hudson.plugins.jacoco.JacocoPublisher>
306 <hudson.plugins.findbugs.FindBugsPublisher plugin="findbugs">
307 <isRankActivated>false</isRankActivated>
312 <thresholdLimit>low</thresholdLimit>
313 <pluginName>[FINDBUGS] </pluginName>
315 <canRunOnFailed>false</canRunOnFailed>
316 <useStableBuildAsReference>false</useStableBuildAsReference>
317 <usePreviousBuildAsReference>false</usePreviousBuildAsReference>
318 <useDeltaValues>false</useDeltaValues>
322 <unstableTotalNormal/>
329 <shouldDetectModules>false</shouldDetectModules>
330 <dontComputeNew>true</dontComputeNew>
331 <doNotResolveRelativePaths>false</doNotResolveRelativePaths>
333 </hudson.plugins.findbugs.FindBugsPublisher>
334 <org.jenkinsci.plugins.postbuildscript.PostBuildScript>
338 # SPDX-License-Identifier: EPL-1.0
339 ##############################################################################
340 # Copyright (c) 2017 The Linux Foundation and others.
342 # All rights reserved. This program and the accompanying materials
343 # are made available under the terms of the Eclipse Public License v1.0
344 # which accompanies this distribution, and is available at
345 # http://www.eclipse.org/legal/epl-v10.html
346 ##############################################################################
347 echo "---> sysstat.sh"
348 set +e # DON'T fail build if script fails.
350 OS=$(facter operatingsystem)
351 case "$OS" in
353 SYSSTAT_PATH="/var/log/sysstat"
355 # Dont run the script when systat is not enabled by default
356 if ! grep --quiet 'ENABLED="true"' "/etc/default/sysstat"; then
361 SYSSTAT_PATH="/var/log/sa"
369 SAR_DIR="$WORKSPACE/archives/sar-reports"
370 mkdir -p "$SAR_DIR"
371 cp "$SYSSTAT_PATH/"* "$_"
372 # convert sar data to ascii format
373 while IFS="" read -r sarfilenum
375 [ -f "$sarfilenum" ] && LC_TIME=POSIX sar -A -f "$sarfilenum" > "$SAR_DIR/sar${sarfilenum//[!0-9]/}"
376 done < <(find "$SYSSTAT_PATH" -name "sa[0-9]*" || true)
378 # DON'T fail build if script fails.
381 </hudson.tasks.Shell>
382 <org.jenkinsci.plugins.configfiles.builder.ConfigFileBuildStep plugin="config-file-provider">
384 <org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
385 <fileId>jenkins-log-archives-settings</fileId>
387 <variable>SETTINGS_FILE</variable>
388 </org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
390 </org.jenkinsci.plugins.configfiles.builder.ConfigFileBuildStep>
393 <propertiesContent>SERVER_ID=logs</propertiesContent>
398 # SPDX-License-Identifier: EPL-1.0
399 ##############################################################################
400 # Copyright (c) 2017 The Linux Foundation and others.
402 # All rights reserved. This program and the accompanying materials
403 # are made available under the terms of the Eclipse Public License v1.0
404 # which accompanies this distribution, and is available at
405 # http://www.eclipse.org/legal/epl-v10.html
406 ##############################################################################
407 echo "---> create-netrc.sh"
409 # Ensure we fail the job if any steps fail.
412 NEXUS_URL="${NEXUSPROXY:-$NEXUS_URL}"
413 CREDENTIAL=$(xmlstarlet sel -N "x=http://maven.apache.org/SETTINGS/1.0.0" \
414 -t -m "/x:settings/x:servers/x:server[x:id='${SERVER_ID}']" \
415 -v x:username -o ":" -v x:password \
416 "$SETTINGS_FILE")
418 machine=$(echo "$NEXUS_URL" | awk -F/ '{print $3}')
419 user=$(echo "$CREDENTIAL" | cut -f1 -d:)
420 pass=$(echo "$CREDENTIAL" | cut -f2 -d:)
422 echo "machine ${machine%:*} login $user password $pass" > ~/.netrc
424 </hudson.tasks.Shell>
427 # SPDX-License-Identifier: EPL-1.0
428 ##############################################################################
429 # Copyright (c) 2017 The Linux Foundation and others.
431 # All rights reserved. This program and the accompanying materials
432 # are made available under the terms of the Eclipse Public License v1.0
433 # which accompanies this distribution, and is available at
434 # http://www.eclipse.org/legal/epl-v10.html
435 ##############################################################################
436 echo "---> lftools-install.sh"
438 # Script to install lftools via a version passed in via lf-infra-parameters
440 # Required parameters:
442 # LFTOOLS_VERSION: Passed in via lf-infra-parameters configuration. Can be
443 # set to a strict version number like '1.2.3' or using
444 # PEP-440 definitions.
448 # >=1.0.0,<2.0.0
450 # By default a released version of lftools should always be used.
451 # The purpose of the 2 variables below is so that lftools devs can test
452 # unreleased versions of lftools. There are 2 methods to install a dev version
455 # 1) gerrit patch: Used to test a patch that has not yet been merged.
456 # To do this set something like this:
457 # LFTOOLS_MODE=gerrit
458 # LFTOOLS_REFSPEC=refs/changes/96/5296/7
460 # 2) git branch: Used to install an lftools version from a specific branch.
461 # To use this set the variables as follows:
463 # LFTOOLS_REFSPEC=master
465 # 3) release : The intended use case and default setting.
466 # Set LFTOOLS_MODE=release, in this case LFTOOLS_REFSPEC is unused.
468 LFTOOLS_MODE=release # release | git | gerrit
469 LFTOOLS_REFSPEC=master
471 # Ensure we fail the job if any steps fail.
472 # DO NOT set -u as virtualenv's activate script has unbound variables
475 virtualenv --quiet "/tmp/v/lftools"
476 # shellcheck source=/tmp/v/lftools/bin/activate disable=SC1091
477 source "/tmp/v/lftools/bin/activate"
478 pip install --quiet --upgrade pip
480 case $LFTOOLS_MODE in
482 git clone https://gerrit.linuxfoundation.org/infra/releng/lftools.git /tmp/lftools
484 git fetch origin "$LFTOOLS_REFSPEC"
485 git checkout FETCH_HEAD
486 pip install --quiet --upgrade -r requirements.txt
487 pip install --quiet --upgrade -e .
492 pip install --quiet --upgrade git+https://gerrit.linuxfoundation.org/infra/releng/lftools.git@"$BRANCH"
496 if [[ $LFTOOLS_VERSION =~ ^[0-9] ]]; then
497 LFTOOLS_VERSION="==$LFTOOLS_VERSION"
500 pip install --quiet --upgrade "lftools${LFTOOLS_VERSION}"
506 # pipdeptree prints out a lot of information because lftools pulls in many
507 # dependencies. Let's only print it if we want to debug.
508 # echo "----> Pip Dependency Tree"
509 # pip install --quiet --upgrade pipdeptree
513 # SPDX-License-Identifier: EPL-1.0
514 ##############################################################################
515 # Copyright (c) 2017 The Linux Foundation and others.
517 # All rights reserved. This program and the accompanying materials
518 # are made available under the terms of the Eclipse Public License v1.0
519 # which accompanies this distribution, and is available at
520 # http://www.eclipse.org/legal/epl-v10.html
521 ##############################################################################
522 echo "---> logs-deploy.sh"
524 # Ensure we fail the job if any steps fail.
527 set -x # Trace commands for this script to make debugging easier.
529 ARCHIVE_ARTIFACTS="${ARCHIVE_ARTIFACTS:-}"
530 LOGS_SERVER="${LOGS_SERVER:-None}"
532 if [ "${LOGS_SERVER}" == 'None' ]
534 set +x # Disable trace since we no longer need it
536 echo "WARNING: Logging server not set"
538 NEXUS_URL="${NEXUSPROXY:-$NEXUS_URL}"
539 NEXUS_PATH="${SILO}/${JENKINS_HOSTNAME}/${JOB_NAME}/${BUILD_NUMBER}"
540 BUILD_URL="${BUILD_URL}"
542 lftools deploy archives -p "$ARCHIVE_ARTIFACTS" "$NEXUS_URL" "$NEXUS_PATH" "$WORKSPACE"
543 lftools deploy logs "$NEXUS_URL" "$NEXUS_PATH" "$BUILD_URL"
545 set +x # Disable trace since we no longer need it.
547 echo "Build logs: <a href=\"$LOGS_SERVER/$NEXUS_PATH\">$LOGS_SERVER/$NEXUS_PATH</a>"
550 </hudson.tasks.Shell>
553 # SPDX-License-Identifier: EPL-1.0
554 ##############################################################################
555 # Copyright (c) 2017 The Linux Foundation and others.
557 # All rights reserved. This program and the accompanying materials
558 # are made available under the terms of the Eclipse Public License v1.0
559 # which accompanies this distribution, and is available at
560 # http://www.eclipse.org/legal/epl-v10.html
561 ##############################################################################
563 # Clear log credential files
564 rm "$SETTINGS_FILE"
567 </hudson.tasks.Shell>
568 <hudson.plugins.descriptionsetter.DescriptionSetterBuilder>
569 <regexp>^Build logs: .*</regexp>
570 </hudson.plugins.descriptionsetter.DescriptionSetterBuilder>
572 <scriptOnlyIfSuccess>false</scriptOnlyIfSuccess>
573 <scriptOnlyIfFailure>false</scriptOnlyIfFailure>
574 <markBuildUnstable>false</markBuildUnstable>
575 </org.jenkinsci.plugins.postbuildscript.PostBuildScript>
576 <hudson.plugins.ws__cleanup.WsCleanup plugin="ws-cleanup">
578 <hudson.plugins.ws__cleanup.Pattern>
579 <pattern>**/*.jenkins-trigger</pattern>
581 </hudson.plugins.ws__cleanup.Pattern>
583 <deleteDirs>false</deleteDirs>
584 <cleanupMatrixParent>false</cleanupMatrixParent>
586 <cleanWhenSuccess>true</cleanWhenSuccess>
587 <cleanWhenUnstable>true</cleanWhenUnstable>
588 <cleanWhenFailure>true</cleanWhenFailure>
589 <cleanWhenNotBuilt>true</cleanWhenNotBuilt>
590 <cleanWhenAborted>true</cleanWhenAborted>
591 <notFailBuild>true</notFailBuild>
592 </hudson.plugins.ws__cleanup.WsCleanup>
595 <com.michelin.cio.hudson.plugins.maskpasswords.MaskPasswordsBuildWrapper/>
596 <hudson.plugins.build__timeout.BuildTimeoutWrapper>
597 <timeoutMinutes>30</timeoutMinutes>
598 <timeoutEnvVar>BUILD_TIMEOUT</timeoutEnvVar>
599 <failBuild>true</failBuild>
600 <writingDescription>false</writingDescription>
601 <timeoutPercentage>0</timeoutPercentage>
602 <timeoutMinutesElasticDefault>3</timeoutMinutesElasticDefault>
603 <timeoutType>absolute</timeoutType>
604 </hudson.plugins.build__timeout.BuildTimeoutWrapper>
605 <hudson.plugins.timestamper.TimestamperBuildWrapper/>
606 <com.cloudbees.jenkins.plugins.sshagent.SSHAgentBuildWrapper>
607 <user>test-credential</user>
608 </com.cloudbees.jenkins.plugins.sshagent.SSHAgentBuildWrapper>
609 <jenkins.plugins.openstack.compute.JCloudsOneOffSlave/>
610 <org.jenkinsci.plugins.configfiles.buildwrapper.ConfigFileBuildWrapper plugin="config-file-provider">
612 <org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
613 <fileId>npmrc</fileId>
614 <targetLocation>$HOME/.npmrc</targetLocation>
616 </org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
618 </org.jenkinsci.plugins.configfiles.buildwrapper.ConfigFileBuildWrapper>