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>true</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 </parameterDefinitions>
101 </hudson.model.ParametersDefinitionProperty>
103 <scm class="hudson.plugins.git.GitSCM">
104 <configVersion>2</configVersion>
106 <hudson.plugins.git.UserRemoteConfig>
108 <refspec>+refs/pull/*:refs/remotes/origin/pr/*</refspec>
109 <url>git@github.com:example-org/releng/ciman</url>
110 <credentialsId>test-credential</credentialsId>
111 </hudson.plugins.git.UserRemoteConfig>
114 <hudson.plugins.git.BranchSpec>
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 <org.jenkinsci.plugins.ghprb.GhprbTrigger>
150 <allowMembersOfWhitelistedOrgsAsAdmin>false</allowMembersOfWhitelistedOrgsAsAdmin>
154 <triggerPhrase>^recheck$</triggerPhrase>
155 <onlyTriggerPhrase>true</onlyTriggerPhrase>
156 <useGitHubHooks>true</useGitHubHooks>
157 <permitAll>true</permitAll>
158 <autoCloseFailedPullRequests>false</autoCloseFailedPullRequests>
160 <org.jenkinsci.plugins.ghprb.extensions.status.GhprbSimpleStatus>
161 <commitStatusContext>Maven Javadoc</commitStatusContext>
162 </org.jenkinsci.plugins.ghprb.extensions.status.GhprbSimpleStatus>
164 </org.jenkinsci.plugins.ghprb.GhprbTrigger>
168 <command>echo "quiet=on" > "$HOME/.wgetrc"</command>
169 </hudson.tasks.Shell>
171 <targets>--version</targets>
173 <mavenName>mvn33</mavenName>
174 <usePrivateRepository>false</usePrivateRepository>
175 <settings class="jenkins.mvn.DefaultSettingsProvider"/>
176 <globalSettings class="jenkins.mvn.DefaultGlobalSettingsProvider"/>
177 </hudson.tasks.Maven>
179 <command>rm "$HOME/.wgetrc"</command>
180 </hudson.tasks.Shell>
181 <org.jenkinsci.plugins.configfiles.builder.ConfigFileBuildStep plugin="config-file-provider">
183 <org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
184 <fileId>global-settings</fileId>
186 <variable>GLOBAL_SETTINGS_FILE</variable>
187 </org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
188 <org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
189 <fileId>aproject-settings</fileId>
191 <variable>SETTINGS_FILE</variable>
192 </org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
194 </org.jenkinsci.plugins.configfiles.builder.ConfigFileBuildStep>
197 # SPDX-License-Identifier: EPL-1.0
198 ##############################################################################
199 # Copyright (c) 2017 The Linux Foundation and others.
201 # All rights reserved. This program and the accompanying materials
202 # are made available under the terms of the Eclipse Public License v1.0
203 # which accompanies this distribution, and is available at
204 # http://www.eclipse.org/legal/epl-v10.html
205 ##############################################################################
207 # This file contains a list of variables that are generally useful in many
208 # scripts. It is meant to be sourced in other scripts so that the variables can
211 MAVEN_OPTIONS="$(echo --show-version \
214 -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn \
215 -Dmaven.repo.local=/tmp/r \
216 -Dorg.ops4j.pax.url.mvn.localRepository=/tmp/r)"
217 echo "$MAVEN_OPTIONS"
220 # SPDX-License-Identifier: EPL-1.0
221 ##############################################################################
222 # Copyright (c) 2017 The Linux Foundation and others.
224 # All rights reserved. This program and the accompanying materials
225 # are made available under the terms of the Eclipse Public License v1.0
226 # which accompanies this distribution, and is available at
227 # http://www.eclipse.org/legal/epl-v10.html
228 ##############################################################################
230 # Generates javadoc in a Maven project.
232 # DO NOT enable -u because $MAVEN_PARAMS and $MAVEN_OPTIONS could be unbound.
233 # Ensure we fail the job if any steps fail.
237 JAVADOC_DIR="$WORKSPACE/archives/javadoc"
238 mkdir -p "$WORKSPACE/archives"
242 # Disable SC2086 because we want to allow word splitting for $MAVEN_* parameters.
243 # shellcheck disable=SC2086
244 $MVN clean install javadoc:aggregate \
246 -Dcheckstyle.skip=true \
247 -Dfindbugs.skip=true \
248 --global-settings "$GLOBAL_SETTINGS_FILE" \
249 --settings "$SETTINGS_FILE" \
250 $MAVEN_PARAMS $MAVEN_OPTIONS
252 mv "$WORKSPACE/target/site/apidocs" "$JAVADOC_DIR"
254 </hudson.tasks.Shell>
257 set +e # DO NOT cause build failure if any of the rm calls fail.
259 rm "$GLOBAL_SETTINGS_FILE" "$SETTINGS_FILE"
261 # In some cases we use the lf-provide-maven-settings macro to produce
262 # a "$HOME/.netrc" file containing credentials. Remove that file here
264 rm "$HOME/.netrc"
266 # DO NOT fail build if any of the above lines fail.
269 </hudson.tasks.Shell>
272 <org.jenkinsci.plugins.postbuildscript.PostBuildScript>
276 # SPDX-License-Identifier: EPL-1.0
277 ##############################################################################
278 # Copyright (c) 2017 The Linux Foundation and others.
280 # All rights reserved. This program and the accompanying materials
281 # are made available under the terms of the Eclipse Public License v1.0
282 # which accompanies this distribution, and is available at
283 # http://www.eclipse.org/legal/epl-v10.html
284 ##############################################################################
285 echo "---> sysstat.sh"
286 set +e # DON'T fail build if script fails.
288 OS=$(facter operatingsystem)
289 case "$OS" in
291 SYSSTAT_PATH="/var/log/sysstat"
293 # Dont run the script when systat is not enabled by default
294 if ! grep --quiet 'ENABLED="true"' "/etc/default/sysstat"; then
299 SYSSTAT_PATH="/var/log/sa"
307 SAR_DIR="$WORKSPACE/archives/sar-reports"
308 mkdir -p "$SAR_DIR"
309 cp "$SYSSTAT_PATH/"* "$_"
310 # convert sar data to ascii format
311 while IFS="" read -r s
313 [ -f "$s" ] && LC_TIME=POSIX sar -A -f "$s" > "$SAR_DIR/sar${s//[!0-9]/}"
314 done < <(find "$SYSSTAT_PATH" -name "sa[0-9]*" || true)
316 # DON'T fail build if script fails.
319 </hudson.tasks.Shell>
320 <org.jenkinsci.plugins.configfiles.builder.ConfigFileBuildStep plugin="config-file-provider">
322 <org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
323 <fileId>jenkins-log-archives-settings</fileId>
325 <variable>SETTINGS_FILE</variable>
326 </org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
328 </org.jenkinsci.plugins.configfiles.builder.ConfigFileBuildStep>
331 <propertiesContent>SERVER_ID=logs</propertiesContent>
336 # SPDX-License-Identifier: EPL-1.0
337 ##############################################################################
338 # Copyright (c) 2017 The Linux Foundation and others.
340 # All rights reserved. This program and the accompanying materials
341 # are made available under the terms of the Eclipse Public License v1.0
342 # which accompanies this distribution, and is available at
343 # http://www.eclipse.org/legal/epl-v10.html
344 ##############################################################################
345 echo "---> create-netrc.sh"
347 # Ensure we fail the job if any steps fail.
350 NEXUS_URL="${NEXUSPROXY:-$NEXUS_URL}"
351 CREDENTIAL=$(xmlstarlet sel -N "x=http://maven.apache.org/SETTINGS/1.0.0" \
352 -t -m "/x:settings/x:servers/x:server[x:id='${SERVER_ID}']" \
353 -v x:username -o ":" -v x:password \
354 "$SETTINGS_FILE")
356 machine=$(echo "$NEXUS_URL" | awk -F/ '{print $3}')
357 user=$(echo "$CREDENTIAL" | cut -f1 -d:)
358 pass=$(echo "$CREDENTIAL" | cut -f2 -d:)
360 echo "machine ${machine%:*} login $user password $pass" > ~/.netrc
362 </hudson.tasks.Shell>
365 # SPDX-License-Identifier: EPL-1.0
366 ##############################################################################
367 # Copyright (c) 2017 The Linux Foundation and others.
369 # All rights reserved. This program and the accompanying materials
370 # are made available under the terms of the Eclipse Public License v1.0
371 # which accompanies this distribution, and is available at
372 # http://www.eclipse.org/legal/epl-v10.html
373 ##############################################################################
374 echo "---> lftools-install.sh"
376 # Script to install lftools via a version passed in via lf-infra-parameters
378 # Required parameters:
380 # LFTOOLS_VERSION: Passed in via lf-infra-parameters configuration. Can be
381 # set to a strict version number like '1.2.3' or using
382 # PEP-440 definitions.
386 # >=1.0.0,<2.0.0
388 # By default a released version of lftools should always be used.
389 # The purpose of the 2 variables below is so that lftools devs can test
390 # unreleased versions of lftools. There are 2 methods to install a dev version
393 # 1) gerrit patch: Used to test a patch that has not yet been merged.
394 # To do this set something like this:
395 # LFTOOLS_MODE=gerrit
396 # LFTOOLS_REFSPEC=refs/changes/96/5296/7
398 # 2) git branch: Used to install an lftools version from a specific branch.
399 # To use this set the variables as follows:
401 # LFTOOLS_REFSPEC=master
403 # 3) release : The intended use case and default setting.
404 # Set LFTOOLS_MODE=release, in this case LFTOOLS_REFSPEC is unused.
406 LFTOOLS_MODE=release # release | git | gerrit
407 LFTOOLS_REFSPEC=master
409 # Ensure we fail the job if any steps fail.
410 # DO NOT set -u as virtualenv's activate script has unbound variables
413 virtualenv --quiet "/tmp/v/lftools"
414 # shellcheck source=/tmp/v/lftools/bin/activate disable=SC1091
415 source "/tmp/v/lftools/bin/activate"
416 pip install --quiet --upgrade pip
418 case $LFTOOLS_MODE in
420 git clone https://gerrit.linuxfoundation.org/infra/releng/lftools.git /tmp/lftools
422 git fetch origin "$LFTOOLS_REFSPEC"
423 git checkout FETCH_HEAD
424 pip install --quiet --upgrade -r requirements.txt
425 pip install --quiet --upgrade -e .
430 pip install --quiet --upgrade git+https://gerrit.linuxfoundation.org/infra/releng/lftools.git@"$BRANCH"
434 if [[ $LFTOOLS_VERSION =~ ^[0-9] ]]; then
435 LFTOOLS_VERSION="==$LFTOOLS_VERSION"
438 pip install --quiet --upgrade "lftools${LFTOOLS_VERSION}"
444 # pipdeptree prints out a lot of information because lftools pulls in many
445 # dependencies. Let's only print it if we want to debug.
446 # echo "----> Pip Dependency Tree"
447 # pip install --quiet --upgrade pipdeptree
451 # SPDX-License-Identifier: EPL-1.0
452 ##############################################################################
453 # Copyright (c) 2017 The Linux Foundation and others.
455 # All rights reserved. This program and the accompanying materials
456 # are made available under the terms of the Eclipse Public License v1.0
457 # which accompanies this distribution, and is available at
458 # http://www.eclipse.org/legal/epl-v10.html
459 ##############################################################################
460 echo "---> logs-deploy.sh"
462 # Ensure we fail the job if any steps fail.
465 set -x # Trace commands for this script to make debugging easier.
467 ARCHIVE_ARTIFACTS="${ARCHIVE_ARTIFACTS:-}"
468 LOGS_SERVER="${LOGS_SERVER:-None}"
470 if [ "${LOGS_SERVER}" == 'None' ]
472 set +x # Disable trace since we no longer need it
474 echo "WARNING: Logging server not set"
476 NEXUS_URL="${NEXUSPROXY:-$NEXUS_URL}"
477 NEXUS_PATH="${SILO}/${JENKINS_HOSTNAME}/${JOB_NAME}/${BUILD_NUMBER}"
478 BUILD_URL="${BUILD_URL}"
480 lftools deploy archives -p "$ARCHIVE_ARTIFACTS" "$NEXUS_URL" "$NEXUS_PATH" "$WORKSPACE"
481 lftools deploy logs "$NEXUS_URL" "$NEXUS_PATH" "$BUILD_URL"
483 set +x # Disable trace since we no longer need it.
485 echo "Build logs: <a href=\"$LOGS_SERVER/$NEXUS_PATH\">$LOGS_SERVER/$NEXUS_PATH</a>"
488 </hudson.tasks.Shell>
491 # SPDX-License-Identifier: EPL-1.0
492 ##############################################################################
493 # Copyright (c) 2017 The Linux Foundation and others.
495 # All rights reserved. This program and the accompanying materials
496 # are made available under the terms of the Eclipse Public License v1.0
497 # which accompanies this distribution, and is available at
498 # http://www.eclipse.org/legal/epl-v10.html
499 ##############################################################################
501 # Clear log credential files
502 rm "$SETTINGS_FILE"
505 </hudson.tasks.Shell>
506 <hudson.plugins.descriptionsetter.DescriptionSetterBuilder>
507 <regexp>^Build logs: .*</regexp>
508 </hudson.plugins.descriptionsetter.DescriptionSetterBuilder>
510 <scriptOnlyIfSuccess>false</scriptOnlyIfSuccess>
511 <scriptOnlyIfFailure>false</scriptOnlyIfFailure>
512 <markBuildUnstable>false</markBuildUnstable>
513 </org.jenkinsci.plugins.postbuildscript.PostBuildScript>
514 <hudson.plugins.ws__cleanup.WsCleanup plugin="ws-cleanup">
516 <hudson.plugins.ws__cleanup.Pattern>
517 <pattern>**/*.jenkins-trigger</pattern>
519 </hudson.plugins.ws__cleanup.Pattern>
521 <deleteDirs>false</deleteDirs>
522 <cleanupMatrixParent>false</cleanupMatrixParent>
524 <cleanWhenSuccess>true</cleanWhenSuccess>
525 <cleanWhenUnstable>true</cleanWhenUnstable>
526 <cleanWhenFailure>true</cleanWhenFailure>
527 <cleanWhenNotBuilt>true</cleanWhenNotBuilt>
528 <cleanWhenAborted>true</cleanWhenAborted>
529 <notFailBuild>true</notFailBuild>
530 </hudson.plugins.ws__cleanup.WsCleanup>
533 <com.michelin.cio.hudson.plugins.maskpasswords.MaskPasswordsBuildWrapper/>
534 <hudson.plugins.build__timeout.BuildTimeoutWrapper>
535 <timeoutMinutes>30</timeoutMinutes>
536 <timeoutEnvVar>BUILD_TIMEOUT</timeoutEnvVar>
537 <failBuild>true</failBuild>
538 <writingDescription>false</writingDescription>
539 <timeoutPercentage>0</timeoutPercentage>
540 <timeoutMinutesElasticDefault>3</timeoutMinutesElasticDefault>
541 <timeoutType>absolute</timeoutType>
542 </hudson.plugins.build__timeout.BuildTimeoutWrapper>
543 <hudson.plugins.timestamper.TimestamperBuildWrapper/>
544 <com.cloudbees.jenkins.plugins.sshagent.SSHAgentBuildWrapper>
545 <user>test-credential</user>
546 </com.cloudbees.jenkins.plugins.sshagent.SSHAgentBuildWrapper>
547 <jenkins.plugins.openstack.compute.JCloudsOneOffSlave/>