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 plugin="github">
14 <projectUrl>$GIT_URL/$PROJECT/example-org/releng/ciman</projectUrl>
16 </com.coravy.hudson.plugins.github.GithubProjectProperty>
17 <hudson.model.ParametersDefinitionProperty>
18 <parameterDefinitions>
19 <hudson.model.StringParameterDefinition>
21 <description>Parameter to identify a Gerrit project. This is typically the
22 project repo path as exists in Gerrit.
23 For example: ofextensions/circuitsw
25 <defaultValue>releng/ciman</defaultValue>
26 </hudson.model.StringParameterDefinition>
27 <hudson.model.StringParameterDefinition>
29 <description>Stream is often set to the same name as 'branch' but can
30 sometimes be used as a name representing a project's release code
33 <defaultValue>master</defaultValue>
34 </hudson.model.StringParameterDefinition>
35 <hudson.model.StringParameterDefinition>
36 <name>GERRIT_PROJECT</name>
37 <description>Parameter to identify Gerrit project. This is typically the
38 project repo path as exists in Gerrit.
39 For example: ofextensions/circuitsw
41 Note that Gerrit will override this parameter automatically if a
42 job is triggered by Gerrit.
44 <defaultValue>releng/ciman</defaultValue>
45 </hudson.model.StringParameterDefinition>
46 <hudson.model.StringParameterDefinition>
47 <name>GERRIT_BRANCH</name>
48 <description>Parameter to identify a Gerrit branch.
50 Note that Gerrit will override this parameter automatically if a
51 job is triggered by Gerrit.
53 <defaultValue>master</defaultValue>
54 </hudson.model.StringParameterDefinition>
55 <hudson.model.StringParameterDefinition>
56 <name>GERRIT_REFSPEC</name>
57 <description>Parameter to identify a refspec when pulling from Gerrit.
59 Note that Gerrit will override this parameter automatically if a
60 job is triggered by Gerrit.
62 <defaultValue>refs/heads/master</defaultValue>
63 </hudson.model.StringParameterDefinition>
64 <hudson.model.StringParameterDefinition>
65 <name>LFTOOLS_VERSION</name>
66 <description>Version of lftools to install. Can be a specific version like
67 '0.6.0' or a PEP-440 definition.
68 https://www.python.org/dev/peps/pep-0440/
69 For example '<1.0.0' or '>=1.0.0,<2.0.0'.
71 <defaultValue><1.0.0</defaultValue>
72 </hudson.model.StringParameterDefinition>
73 <hudson.model.StringParameterDefinition>
75 <description>Maven selector to be used by shell scripts</description>
76 <defaultValue>/w/tools/hudson.tasks.Maven_MavenInstallation/mvn33</defaultValue>
77 </hudson.model.StringParameterDefinition>
78 <hudson.model.StringParameterDefinition>
79 <name>MAVEN_OPTS</name>
80 <description>Maven Java opts. Example: -Xmx1024m -XX:MaxPermSize=256m
83 </hudson.model.StringParameterDefinition>
84 <hudson.model.StringParameterDefinition>
85 <name>MAVEN_PARAMS</name>
86 <description>Maven parameters to pass to the mvn command.
89 </hudson.model.StringParameterDefinition>
90 <hudson.model.StringParameterDefinition>
92 <description>Maven selector to be used by shell scripts</description>
93 <defaultValue>/w/tools/hudson.tasks.Maven_MavenInstallation/mvn33/bin/mvn</defaultValue>
94 </hudson.model.StringParameterDefinition>
95 <hudson.model.StringParameterDefinition>
96 <name>STAGING_PROFILE_ID</name>
97 <description>Nexus staging profile ID.
99 <defaultValue>uuddlrlrba</defaultValue>
100 </hudson.model.StringParameterDefinition>
101 <hudson.model.StringParameterDefinition>
102 <name>ARCHIVE_ARTIFACTS</name>
103 <description>Artifacts to archive to the logs server.</description>
105 </hudson.model.StringParameterDefinition>
106 </parameterDefinitions>
107 </hudson.model.ParametersDefinitionProperty>
109 <scm class="hudson.plugins.git.GitSCM">
110 <configVersion>2</configVersion>
112 <hudson.plugins.git.UserRemoteConfig>
114 <refspec>+refs/pull/*:refs/remotes/origin/pr/*</refspec>
115 <url>git@github.com:example-org/releng/ciman</url>
116 <credentialsId>test-credential</credentialsId>
117 </hudson.plugins.git.UserRemoteConfig>
120 <hudson.plugins.git.BranchSpec>
122 </hudson.plugins.git.BranchSpec>
124 <doGenerateSubmoduleConfigurations>false</doGenerateSubmoduleConfigurations>
125 <remotePoll>false</remotePoll>
126 <gitTool>Default</gitTool>
127 <submoduleCfg class="list"/>
132 <hudson.plugins.git.extensions.impl.BuildChooserSetting>
133 <buildChooser class="hudson.plugins.git.util.DefaultBuildChooser"/>
134 </hudson.plugins.git.extensions.impl.BuildChooserSetting>
135 <hudson.plugins.git.extensions.impl.SubmoduleOption>
136 <disableSubmodules>false</disableSubmodules>
137 <recursiveSubmodules>true</recursiveSubmodules>
138 <trackingSubmodules>false</trackingSubmodules>
139 <parentCredentials>false</parentCredentials>
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>
156 <triggerPhrase>^recheck$</triggerPhrase>
158 <onlyTriggerPhrase>true</onlyTriggerPhrase>
159 <useGitHubHooks>true</useGitHubHooks>
160 <permitAll>true</permitAll>
161 <autoCloseFailedPullRequests>false</autoCloseFailedPullRequests>
163 <org.jenkinsci.plugins.ghprb.extensions.status.GhprbSimpleStatus>
164 <commitStatusContext>Maven Javadoc</commitStatusContext>
165 </org.jenkinsci.plugins.ghprb.extensions.status.GhprbSimpleStatus>
167 </org.jenkinsci.plugins.ghprb.GhprbTrigger>
171 <command>echo "quiet=on" > "$HOME/.wgetrc"</command>
172 </hudson.tasks.Shell>
174 <targets>--version</targets>
176 <mavenName>mvn33</mavenName>
177 <usePrivateRepository>false</usePrivateRepository>
178 <settings class="jenkins.mvn.DefaultSettingsProvider"/>
179 <globalSettings class="jenkins.mvn.DefaultGlobalSettingsProvider"/>
180 </hudson.tasks.Maven>
182 <command>rm "$HOME/.wgetrc"</command>
183 </hudson.tasks.Shell>
184 <org.jenkinsci.plugins.configfiles.builder.ConfigFileBuildStep plugin="config-file-provider">
186 <org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
187 <fileId>global-settings</fileId>
189 <variable>GLOBAL_SETTINGS_FILE</variable>
190 </org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
191 <org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
192 <fileId>aproject-settings</fileId>
194 <variable>SETTINGS_FILE</variable>
195 </org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
197 </org.jenkinsci.plugins.configfiles.builder.ConfigFileBuildStep>
200 # SPDX-License-Identifier: EPL-1.0
201 ##############################################################################
202 # Copyright (c) 2017 The Linux Foundation and others.
204 # All rights reserved. This program and the accompanying materials
205 # are made available under the terms of the Eclipse Public License v1.0
206 # which accompanies this distribution, and is available at
207 # http://www.eclipse.org/legal/epl-v10.html
208 ##############################################################################
210 # This file contains a list of variables that are generally useful in many
211 # scripts. It is meant to be sourced in other scripts so that the variables can
214 MAVEN_OPTIONS="$(echo --show-version \
217 -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn \
218 -Dmaven.repo.local=/tmp/r \
219 -Dorg.ops4j.pax.url.mvn.localRepository=/tmp/r)"
220 echo "$MAVEN_OPTIONS"
223 # SPDX-License-Identifier: EPL-1.0
224 ##############################################################################
225 # Copyright (c) 2017 The Linux Foundation and others.
227 # All rights reserved. This program and the accompanying materials
228 # are made available under the terms of the Eclipse Public License v1.0
229 # which accompanies this distribution, and is available at
230 # http://www.eclipse.org/legal/epl-v10.html
231 ##############################################################################
233 # Generates javadoc in a Maven project.
235 # DO NOT enable -u because $MAVEN_PARAMS and $MAVEN_OPTIONS could be unbound.
236 # Ensure we fail the job if any steps fail.
240 JAVADOC_DIR="$WORKSPACE/archives/javadoc"
241 mkdir -p "$WORKSPACE/archives"
245 # Disable SC2086 because we want to allow word splitting for $MAVEN_* parameters.
246 # shellcheck disable=SC2086
247 $MVN clean install javadoc:aggregate \
248 -Pq -Dmaven.javadoc.skip=false \
250 -Dcheckstyle.skip=true \
251 -Dfindbugs.skip=true \
252 --global-settings "$GLOBAL_SETTINGS_FILE" \
253 --settings "$SETTINGS_FILE" \
254 $MAVEN_OPTIONS $MAVEN_PARAMS
256 mv "$WORKSPACE/target/site/apidocs" "$JAVADOC_DIR"
258 </hudson.tasks.Shell>
261 set +e # DO NOT cause build failure if any of the rm calls fail.
263 rm "$GLOBAL_SETTINGS_FILE" "$SETTINGS_FILE"
265 # In some cases we use the lf-provide-maven-settings macro to produce
266 # a "$HOME/.netrc" file containing credentials. Remove that file here
268 rm "$HOME/.netrc"
270 # DO NOT fail build if any of the above lines fail.
273 </hudson.tasks.Shell>
276 <org.jenkinsci.plugins.postbuildscript.PostBuildScript>
280 # SPDX-License-Identifier: EPL-1.0
281 ##############################################################################
282 # Copyright (c) 2017 The Linux Foundation and others.
284 # All rights reserved. This program and the accompanying materials
285 # are made available under the terms of the Eclipse Public License v1.0
286 # which accompanies this distribution, and is available at
287 # http://www.eclipse.org/legal/epl-v10.html
288 ##############################################################################
289 echo "---> sysstat.sh"
290 set +e # DON'T fail build if script fails.
292 OS=$(facter operatingsystem)
293 case "$OS" in
295 SYSSTAT_PATH="/var/log/sysstat"
297 # Dont run the script when systat is not enabled by default
298 if ! grep --quiet 'ENABLED="true"' "/etc/default/sysstat"; then
303 SYSSTAT_PATH="/var/log/sa"
311 SAR_DIR="$WORKSPACE/archives/sar-reports"
312 mkdir -p "$SAR_DIR"
313 cp "$SYSSTAT_PATH/"* "$_"
314 # convert sar data to ascii format
315 while IFS="" read -r sarfilenum
317 [ -f "$sarfilenum" ] && LC_TIME=POSIX sar -A -f "$sarfilenum" > "$SAR_DIR/sar${sarfilenum//[!0-9]/}"
318 done < <(find "$SYSSTAT_PATH" -name "sa[0-9]*" || true)
320 # DON'T fail build if script fails.
323 </hudson.tasks.Shell>
324 <org.jenkinsci.plugins.configfiles.builder.ConfigFileBuildStep plugin="config-file-provider">
326 <org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
327 <fileId>jenkins-log-archives-settings</fileId>
329 <variable>SETTINGS_FILE</variable>
330 </org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
332 </org.jenkinsci.plugins.configfiles.builder.ConfigFileBuildStep>
335 <propertiesContent>SERVER_ID=logs</propertiesContent>
340 # SPDX-License-Identifier: EPL-1.0
341 ##############################################################################
342 # Copyright (c) 2017 The Linux Foundation and others.
344 # All rights reserved. This program and the accompanying materials
345 # are made available under the terms of the Eclipse Public License v1.0
346 # which accompanies this distribution, and is available at
347 # http://www.eclipse.org/legal/epl-v10.html
348 ##############################################################################
349 echo "---> create-netrc.sh"
351 # Ensure we fail the job if any steps fail.
354 NEXUS_URL="${NEXUSPROXY:-$NEXUS_URL}"
355 CREDENTIAL=$(xmlstarlet sel -N "x=http://maven.apache.org/SETTINGS/1.0.0" \
356 -t -m "/x:settings/x:servers/x:server[x:id='${SERVER_ID}']" \
357 -v x:username -o ":" -v x:password \
358 "$SETTINGS_FILE")
360 machine=$(echo "$NEXUS_URL" | awk -F/ '{print $3}')
361 user=$(echo "$CREDENTIAL" | cut -f1 -d:)
362 pass=$(echo "$CREDENTIAL" | cut -f2 -d:)
364 echo "machine ${machine%:*} login $user password $pass" > ~/.netrc
366 </hudson.tasks.Shell>
369 # SPDX-License-Identifier: EPL-1.0
370 ##############################################################################
371 # Copyright (c) 2017 The Linux Foundation and others.
373 # All rights reserved. This program and the accompanying materials
374 # are made available under the terms of the Eclipse Public License v1.0
375 # which accompanies this distribution, and is available at
376 # http://www.eclipse.org/legal/epl-v10.html
377 ##############################################################################
378 echo "---> lftools-install.sh"
380 # Script to install lftools via a version passed in via lf-infra-parameters
382 # Required parameters:
384 # LFTOOLS_VERSION: Passed in via lf-infra-parameters configuration. Can be
385 # set to a strict version number like '1.2.3' or using
386 # PEP-440 definitions.
390 # >=1.0.0,<2.0.0
392 # By default a released version of lftools should always be used.
393 # The purpose of the 2 variables below is so that lftools devs can test
394 # unreleased versions of lftools. There are 2 methods to install a dev version
397 # 1) gerrit patch: Used to test a patch that has not yet been merged.
398 # To do this set something like this:
399 # LFTOOLS_MODE=gerrit
400 # LFTOOLS_REFSPEC=refs/changes/96/5296/7
402 # 2) git branch: Used to install an lftools version from a specific branch.
403 # To use this set the variables as follows:
405 # LFTOOLS_REFSPEC=master
407 # 3) release : The intended use case and default setting.
408 # Set LFTOOLS_MODE=release, in this case LFTOOLS_REFSPEC is unused.
410 LFTOOLS_MODE=release # release | git | gerrit
411 LFTOOLS_REFSPEC=master
413 # Ensure we fail the job if any steps fail.
414 # DO NOT set -u as virtualenv's activate script has unbound variables
417 virtualenv --quiet "/tmp/v/lftools"
418 # shellcheck source=/tmp/v/lftools/bin/activate disable=SC1091
419 source "/tmp/v/lftools/bin/activate"
420 pip install --quiet --upgrade pip
422 case $LFTOOLS_MODE in
424 git clone https://gerrit.linuxfoundation.org/infra/releng/lftools.git /tmp/lftools
426 git fetch origin "$LFTOOLS_REFSPEC"
427 git checkout FETCH_HEAD
428 pip install --quiet --upgrade -r requirements.txt
429 pip install --quiet --upgrade -e .
434 pip install --quiet --upgrade git+https://gerrit.linuxfoundation.org/infra/releng/lftools.git@"$BRANCH"
438 if [[ $LFTOOLS_VERSION =~ ^[0-9] ]]; then
439 LFTOOLS_VERSION="==$LFTOOLS_VERSION"
442 pip install --quiet --upgrade "lftools${LFTOOLS_VERSION}"
448 # pipdeptree prints out a lot of information because lftools pulls in many
449 # dependencies. Let's only print it if we want to debug.
450 # echo "----> Pip Dependency Tree"
451 # pip install --quiet --upgrade pipdeptree
455 # SPDX-License-Identifier: EPL-1.0
456 ##############################################################################
457 # Copyright (c) 2017 The Linux Foundation and others.
459 # All rights reserved. This program and the accompanying materials
460 # are made available under the terms of the Eclipse Public License v1.0
461 # which accompanies this distribution, and is available at
462 # http://www.eclipse.org/legal/epl-v10.html
463 ##############################################################################
464 echo "---> logs-deploy.sh"
466 # Ensure we fail the job if any steps fail.
469 set -x # Trace commands for this script to make debugging easier.
471 ARCHIVE_ARTIFACTS="${ARCHIVE_ARTIFACTS:-}"
472 LOGS_SERVER="${LOGS_SERVER:-None}"
474 if [ "${LOGS_SERVER}" == 'None' ]
476 set +x # Disable trace since we no longer need it
478 echo "WARNING: Logging server not set"
480 NEXUS_URL="${NEXUSPROXY:-$NEXUS_URL}"
481 NEXUS_PATH="${SILO}/${JENKINS_HOSTNAME}/${JOB_NAME}/${BUILD_NUMBER}"
482 BUILD_URL="${BUILD_URL}"
484 lftools deploy archives -p "$ARCHIVE_ARTIFACTS" "$NEXUS_URL" "$NEXUS_PATH" "$WORKSPACE"
485 lftools deploy logs "$NEXUS_URL" "$NEXUS_PATH" "$BUILD_URL"
487 set +x # Disable trace since we no longer need it.
489 echo "Build logs: <a href=\"$LOGS_SERVER/$NEXUS_PATH\">$LOGS_SERVER/$NEXUS_PATH</a>"
492 </hudson.tasks.Shell>
495 # SPDX-License-Identifier: EPL-1.0
496 ##############################################################################
497 # Copyright (c) 2017 The Linux Foundation and others.
499 # All rights reserved. This program and the accompanying materials
500 # are made available under the terms of the Eclipse Public License v1.0
501 # which accompanies this distribution, and is available at
502 # http://www.eclipse.org/legal/epl-v10.html
503 ##############################################################################
505 # Clear log credential files
506 rm "$SETTINGS_FILE"
509 </hudson.tasks.Shell>
510 <hudson.plugins.descriptionsetter.DescriptionSetterBuilder>
511 <regexp>^Build logs: .*</regexp>
512 </hudson.plugins.descriptionsetter.DescriptionSetterBuilder>
514 <scriptOnlyIfSuccess>false</scriptOnlyIfSuccess>
515 <scriptOnlyIfFailure>false</scriptOnlyIfFailure>
516 <markBuildUnstable>false</markBuildUnstable>
517 </org.jenkinsci.plugins.postbuildscript.PostBuildScript>
518 <hudson.plugins.ws__cleanup.WsCleanup plugin="ws-cleanup">
520 <hudson.plugins.ws__cleanup.Pattern>
521 <pattern>**/*.jenkins-trigger</pattern>
523 </hudson.plugins.ws__cleanup.Pattern>
525 <deleteDirs>false</deleteDirs>
526 <cleanupMatrixParent>false</cleanupMatrixParent>
528 <cleanWhenSuccess>true</cleanWhenSuccess>
529 <cleanWhenUnstable>true</cleanWhenUnstable>
530 <cleanWhenFailure>true</cleanWhenFailure>
531 <cleanWhenNotBuilt>true</cleanWhenNotBuilt>
532 <cleanWhenAborted>true</cleanWhenAborted>
533 <notFailBuild>true</notFailBuild>
534 </hudson.plugins.ws__cleanup.WsCleanup>
537 <com.michelin.cio.hudson.plugins.maskpasswords.MaskPasswordsBuildWrapper/>
538 <hudson.plugins.build__timeout.BuildTimeoutWrapper>
539 <timeoutMinutes>30</timeoutMinutes>
540 <timeoutEnvVar>BUILD_TIMEOUT</timeoutEnvVar>
541 <failBuild>true</failBuild>
542 <writingDescription>false</writingDescription>
543 <timeoutPercentage>0</timeoutPercentage>
544 <timeoutMinutesElasticDefault>3</timeoutMinutesElasticDefault>
545 <timeoutType>absolute</timeoutType>
546 </hudson.plugins.build__timeout.BuildTimeoutWrapper>
547 <hudson.plugins.timestamper.TimestamperBuildWrapper/>
548 <com.cloudbees.jenkins.plugins.sshagent.SSHAgentBuildWrapper>
549 <user>test-credential</user>
550 </com.cloudbees.jenkins.plugins.sshagent.SSHAgentBuildWrapper>
551 <jenkins.plugins.openstack.compute.JCloudsOneOffSlave/>
552 <org.jenkinsci.plugins.configfiles.buildwrapper.ConfigFileBuildWrapper plugin="config-file-provider">
554 <org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
555 <fileId>npmrc</fileId>
556 <targetLocation>$HOME/.npmrc</targetLocation>
558 </org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
560 </org.jenkinsci.plugins.configfiles.buildwrapper.ConfigFileBuildWrapper>