1 <?xml version="1.0" encoding="utf-8"?>
4 <description><!-- Managed by Jenkins Job Builder --></description>
5 <keepDependencies>false</keepDependencies>
6 <blockBuildWhenDownstreamBuilding>false</blockBuildWhenDownstreamBuilding>
7 <blockBuildWhenUpstreamBuilding>false</blockBuildWhenUpstreamBuilding>
8 <concurrentBuild>true</concurrentBuild>
9 <assignedNode>build-vm</assignedNode>
10 <canRoam>false</canRoam>
12 <com.coravy.hudson.plugins.github.GithubProjectProperty>
13 <projectUrl>$GIT_URL/$GERRIT_PROJECT/example-org/releng/ciman</projectUrl>
14 </com.coravy.hudson.plugins.github.GithubProjectProperty>
15 <hudson.model.ParametersDefinitionProperty>
16 <parameterDefinitions>
17 <hudson.model.StringParameterDefinition>
19 <description>Parameter to identify a Gerrit project. This is typically the
20 project repo path as exists in Gerrit.
21 For example: ofextensions/circuitsw
23 <defaultValue>releng/ciman</defaultValue>
24 </hudson.model.StringParameterDefinition>
25 <hudson.model.StringParameterDefinition>
27 <description>Stream is often set to the same name as 'branch' but can
28 sometimes be used as a name representing a project's release code
31 <defaultValue>master</defaultValue>
32 </hudson.model.StringParameterDefinition>
33 <hudson.model.StringParameterDefinition>
34 <name>GERRIT_PROJECT</name>
35 <description>Parameter to identify Gerrit project. This is typically the
36 project repo path as exists in Gerrit.
37 For example: ofextensions/circuitsw
39 Note that Gerrit will override this parameter automatically if a
40 job is triggered by Gerrit.
42 <defaultValue>releng/ciman</defaultValue>
43 </hudson.model.StringParameterDefinition>
44 <hudson.model.StringParameterDefinition>
45 <name>GERRIT_BRANCH</name>
46 <description>Parameter to identify a Gerrit branch.
48 Note that Gerrit will override this parameter automatically if a
49 job is triggered by Gerrit.
51 <defaultValue>master</defaultValue>
52 </hudson.model.StringParameterDefinition>
53 <hudson.model.StringParameterDefinition>
54 <name>GERRIT_REFSPEC</name>
55 <description>Parameter to identify a refspec when pulling from Gerrit.
57 Note that Gerrit will override this parameter automatically if a
58 job is triggered by Gerrit.
60 <defaultValue>refs/heads/master</defaultValue>
61 </hudson.model.StringParameterDefinition>
62 <hudson.model.StringParameterDefinition>
63 <name>LFTOOLS_VERSION</name>
64 <description>Version of lftools to install. Can be a specific version like
65 '0.6.0' or a PEP-440 definition.
66 https://www.python.org/dev/peps/pep-0440/
67 For example '<1.0.0' or '>=1.0.0,<2.0.0'.
69 <defaultValue><1.0.0</defaultValue>
70 </hudson.model.StringParameterDefinition>
71 <hudson.model.StringParameterDefinition>
73 <description>Path to directory containing tox.ini file.
76 </hudson.model.StringParameterDefinition>
77 <hudson.model.StringParameterDefinition>
79 <description>Tox environments to run build against.
83 </hudson.model.StringParameterDefinition>
84 </parameterDefinitions>
85 </hudson.model.ParametersDefinitionProperty>
87 <scm class="hudson.plugins.git.GitSCM">
88 <configVersion>2</configVersion>
90 <hudson.plugins.git.UserRemoteConfig>
92 <refspec>+refs/pull/*:refs/remotes/origin/pr/*</refspec>
93 <url>git@github.com:example-org/releng/ciman</url>
94 <credentialsId>test-credential</credentialsId>
95 </hudson.plugins.git.UserRemoteConfig>
98 <hudson.plugins.git.BranchSpec>
100 </hudson.plugins.git.BranchSpec>
103 <buildChooser class="hudson.plugins.git.util.DefaultBuildChooser"/>
104 <doGenerateSubmoduleConfigurations>false</doGenerateSubmoduleConfigurations>
105 <authorOrCommitter>false</authorOrCommitter>
106 <wipeOutWorkspace>true</wipeOutWorkspace>
107 <pruneBranches>false</pruneBranches>
108 <remotePoll>false</remotePoll>
109 <gitTool>Default</gitTool>
110 <submoduleCfg class="list"/>
115 <skipTag>true</skipTag>
117 <useShallowClone>false</useShallowClone>
118 <ignoreNotifyCommit>false</ignoreNotifyCommit>
120 <hudson.plugins.git.extensions.impl.SubmoduleOption>
121 <disableSubmodules>false</disableSubmodules>
122 <recursiveSubmodules>true</recursiveSubmodules>
123 <trackingSubmodules>false</trackingSubmodules>
125 <timeout>10</timeout>
126 </hudson.plugins.git.extensions.impl.SubmoduleOption>
127 <hudson.plugins.git.extensions.impl.WipeWorkspace/>
130 <triggers class="vector">
131 <org.jenkinsci.plugins.ghprb.GhprbTrigger>
134 <allowMembersOfWhitelistedOrgsAsAdmin>false</allowMembersOfWhitelistedOrgsAsAdmin>
138 <triggerPhrase>^recheck$</triggerPhrase>
139 <onlyTriggerPhrase>false</onlyTriggerPhrase>
140 <useGitHubHooks>true</useGitHubHooks>
141 <permitAll>true</permitAll>
142 <autoCloseFailedPullRequests>false</autoCloseFailedPullRequests>
144 <org.jenkinsci.plugins.ghprb.extensions.status.GhprbSimpleStatus>
145 <commitStatusContext>JJB Verify</commitStatusContext>
146 </org.jenkinsci.plugins.ghprb.extensions.status.GhprbSimpleStatus>
148 </org.jenkinsci.plugins.ghprb.GhprbTrigger>
153 # SPDX-License-Identifier: EPL-1.0
154 ##############################################################################
155 # Copyright (c) 2017 The Linux Foundation and others.
157 # All rights reserved. This program and the accompanying materials
158 # are made available under the terms of the Eclipse Public License v1.0
159 # which accompanies this distribution, and is available at
160 # http://www.eclipse.org/legal/epl-v10.html
161 ##############################################################################
162 echo "---> lftools-install.sh"
164 # Script to install lftools via a version passed in via lf-infra-parameters
166 # Required parameters:
168 # LFTOOLS_VERSION: Passed in via lf-infra-parameters configuration. Can be
169 # set to a strict version number like '1.2.3' or using
170 # PEP-440 definitions.
174 # >=1.0.0,<2.0.0
176 # By default a released version of lftools should always be used.
177 # The purpose of the 2 variables below is so that lftools devs can test
178 # unreleased versions of lftools. There are 2 methods to install a dev version
181 # 1) gerrit patch: Used to test a patch that has not yet been merged.
182 # To do this set something like this:
183 # LFTOOLS_MODE=gerrit
184 # LFTOOLS_REFSPEC=refs/changes/96/5296/7
186 # 2) git branch: Used to install an lftools version from a specific branch.
187 # To use this set the variables as follows:
189 # LFTOOLS_REFSPEC=master
191 # 3) release : The intended use case and default setting.
192 # Set LFTOOLS_MODE=release, in this case LFTOOLS_REFSPEC is unused.
194 LFTOOLS_MODE=release # release | git | gerrit
195 LFTOOLS_REFSPEC=master
197 # Ensure we fail the job if any steps fail.
198 # DO NOT set -u as virtualenv's activate script has unbound variables
201 virtualenv --quiet "/tmp/v/lftools"
202 # shellcheck source=/tmp/v/lftools/bin/activate disable=SC1091
203 source "/tmp/v/lftools/bin/activate"
204 pip install --quiet --upgrade pip
206 case $LFTOOLS_MODE in
208 git clone https://gerrit.linuxfoundation.org/infra/releng/lftools.git /tmp/lftools
210 git fetch origin "$LFTOOLS_REFSPEC"
211 git checkout FETCH_HEAD
212 pip install --quiet --upgrade -r requirements.txt
213 pip install --quiet --upgrade -e .
218 pip install --quiet --upgrade git+https://gerrit.linuxfoundation.org/infra/releng/lftools.git@"$BRANCH"
222 if [[ $LFTOOLS_VERSION =~ ^[0-9] ]]; then
223 LFTOOLS_VERSION="==$LFTOOLS_VERSION"
226 pip install --quiet --upgrade "lftools${LFTOOLS_VERSION}"
232 # pipdeptree prints out a lot of information because lftools pulls in many
233 # dependencies. Let's only print it if we want to debug.
234 # echo "----> Pip Dependency Tree"
235 # pip install --quiet --upgrade pipdeptree
238 </hudson.tasks.Shell>
241 # SPDX-License-Identifier: EPL-1.0
242 ##############################################################################
243 # Copyright (c) 2017 The Linux Foundation and others.
245 # All rights reserved. This program and the accompanying materials
246 # are made available under the terms of the Eclipse Public License v1.0
247 # which accompanies this distribution, and is available at
248 # http://www.eclipse.org/legal/epl-v10.html
249 ##############################################################################
250 echo "---> tox-install.sh"
252 # Ensure we fail the job if any steps fail.
253 # DO NOT set -u as virtualenv's activate script has unbound variables
256 virtualenv --quiet "/tmp/v/tox"
257 # shellcheck source=/tmp/v/tox/bin/activate disable=SC1091
258 source "/tmp/v/tox/bin/activate"
259 pip install --quiet --upgrade pip
260 pip install --quiet --upgrade pipdeptree
261 pip install --quiet --upgrade tox argparse
263 echo "----> Pip Dependency Tree"
267 # SPDX-License-Identifier: EPL-1.0
268 ##############################################################################
269 # Copyright (c) 2017 The Linux Foundation and others.
271 # All rights reserved. This program and the accompanying materials
272 # are made available under the terms of the Eclipse Public License v1.0
273 # which accompanies this distribution, and is available at
274 # http://www.eclipse.org/legal/epl-v10.html
275 ##############################################################################
276 echo "---> tox-run.sh"
278 # Ensure we fail the job if any steps fail.
279 # DO NOT set -u as virtualenv's activate script has unbound variables
282 cd "$WORKSPACE/$TOX_DIR"
284 if [ -n "$TOX_ENVS" ];
286 tox -e "$TOX_ENVS"
291 </hudson.tasks.Shell>
294 <org.jenkinsci.plugins.postbuildscript.PostBuildScript>
298 # SPDX-License-Identifier: EPL-1.0
299 ##############################################################################
300 # Copyright (c) 2017 The Linux Foundation and others.
302 # All rights reserved. This program and the accompanying materials
303 # are made available under the terms of the Eclipse Public License v1.0
304 # which accompanies this distribution, and is available at
305 # http://www.eclipse.org/legal/epl-v10.html
306 ##############################################################################
307 echo "---> sysstat.sh"
308 set +e # DON'T fail build if script fails.
310 OS=$(facter operatingsystem)
311 case "$OS" in
313 SYSSTAT_PATH="/var/log/sysstat"
315 # Dont run the script when systat is not enabled by default
316 if ! grep --quiet 'ENABLED="true"' "/etc/default/sysstat"; then
321 SYSSTAT_PATH="/var/log/sa"
329 SAR_DIR="$WORKSPACE/archives/sar-reports"
330 mkdir -p "$SAR_DIR"
331 cp "$SYSSTAT_PATH/"* "$_"
332 # convert sar data to ascii format
333 while IFS="" read -r s
335 [ -f "$s" ] && LC_TIME=POSIX sar -A -f "$s" > "$SAR_DIR/sar${s//[!0-9]/}"
336 done < <(find "$SYSSTAT_PATH" -name "sa[0-9]*" || true)
338 # DON'T fail build if script fails.
341 </hudson.tasks.Shell>
342 <org.jenkinsci.plugins.configfiles.builder.ConfigFileBuildStep plugin="config-file-provider">
344 <org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
345 <fileId>jenkins-log-archives-settings</fileId>
347 <variable>SETTINGS_FILE</variable>
348 </org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
350 </org.jenkinsci.plugins.configfiles.builder.ConfigFileBuildStep>
353 <propertiesContent>SERVER_ID=logs</propertiesContent>
358 # SPDX-License-Identifier: EPL-1.0
359 ##############################################################################
360 # Copyright (c) 2017 The Linux Foundation and others.
362 # All rights reserved. This program and the accompanying materials
363 # are made available under the terms of the Eclipse Public License v1.0
364 # which accompanies this distribution, and is available at
365 # http://www.eclipse.org/legal/epl-v10.html
366 ##############################################################################
367 echo "---> create-netrc.sh"
369 # Ensure we fail the job if any steps fail.
372 NEXUS_URL="${NEXUS_URL:-$NEXUSPROXY}"
373 CREDENTIAL=$(xmlstarlet sel -N "x=http://maven.apache.org/SETTINGS/1.0.0" \
374 -t -m "/x:settings/x:servers/x:server[x:id='${SERVER_ID}']" \
375 -v x:username -o ":" -v x:password \
376 "$SETTINGS_FILE")
378 machine=$(echo "$NEXUS_URL" | awk -F/ '{print $3}')
379 user=$(echo "$CREDENTIAL" | cut -f1 -d:)
380 pass=$(echo "$CREDENTIAL" | cut -f2 -d:)
382 echo "machine $machine login $user password $pass" > ~/.netrc
384 </hudson.tasks.Shell>
387 # SPDX-License-Identifier: EPL-1.0
388 ##############################################################################
389 # Copyright (c) 2017 The Linux Foundation and others.
391 # All rights reserved. This program and the accompanying materials
392 # are made available under the terms of the Eclipse Public License v1.0
393 # which accompanies this distribution, and is available at
394 # http://www.eclipse.org/legal/epl-v10.html
395 ##############################################################################
396 echo "---> lftools-install.sh"
398 # Script to install lftools via a version passed in via lf-infra-parameters
400 # Required parameters:
402 # LFTOOLS_VERSION: Passed in via lf-infra-parameters configuration. Can be
403 # set to a strict version number like '1.2.3' or using
404 # PEP-440 definitions.
408 # >=1.0.0,<2.0.0
410 # By default a released version of lftools should always be used.
411 # The purpose of the 2 variables below is so that lftools devs can test
412 # unreleased versions of lftools. There are 2 methods to install a dev version
415 # 1) gerrit patch: Used to test a patch that has not yet been merged.
416 # To do this set something like this:
417 # LFTOOLS_MODE=gerrit
418 # LFTOOLS_REFSPEC=refs/changes/96/5296/7
420 # 2) git branch: Used to install an lftools version from a specific branch.
421 # To use this set the variables as follows:
423 # LFTOOLS_REFSPEC=master
425 # 3) release : The intended use case and default setting.
426 # Set LFTOOLS_MODE=release, in this case LFTOOLS_REFSPEC is unused.
428 LFTOOLS_MODE=release # release | git | gerrit
429 LFTOOLS_REFSPEC=master
431 # Ensure we fail the job if any steps fail.
432 # DO NOT set -u as virtualenv's activate script has unbound variables
435 virtualenv --quiet "/tmp/v/lftools"
436 # shellcheck source=/tmp/v/lftools/bin/activate disable=SC1091
437 source "/tmp/v/lftools/bin/activate"
438 pip install --quiet --upgrade pip
440 case $LFTOOLS_MODE in
442 git clone https://gerrit.linuxfoundation.org/infra/releng/lftools.git /tmp/lftools
444 git fetch origin "$LFTOOLS_REFSPEC"
445 git checkout FETCH_HEAD
446 pip install --quiet --upgrade -r requirements.txt
447 pip install --quiet --upgrade -e .
452 pip install --quiet --upgrade git+https://gerrit.linuxfoundation.org/infra/releng/lftools.git@"$BRANCH"
456 if [[ $LFTOOLS_VERSION =~ ^[0-9] ]]; then
457 LFTOOLS_VERSION="==$LFTOOLS_VERSION"
460 pip install --quiet --upgrade "lftools${LFTOOLS_VERSION}"
466 # pipdeptree prints out a lot of information because lftools pulls in many
467 # dependencies. Let's only print it if we want to debug.
468 # echo "----> Pip Dependency Tree"
469 # pip install --quiet --upgrade pipdeptree
473 # SPDX-License-Identifier: EPL-1.0
474 ##############################################################################
475 # Copyright (c) 2017 The Linux Foundation and others.
477 # All rights reserved. This program and the accompanying materials
478 # are made available under the terms of the Eclipse Public License v1.0
479 # which accompanies this distribution, and is available at
480 # http://www.eclipse.org/legal/epl-v10.html
481 ##############################################################################
482 echo "---> logs-deploy.sh"
484 # Ensure we fail the job if any steps fail.
487 set -x # Trace commands for this script to make debugging easier.
489 ARCHIVE_ARTIFACTS="${ARCHIVE_ARTIFACTS:-}"
490 LOGS_SERVER="${LOGS_SERVER:-None}"
492 if [ "${LOGS_SERVER}" == 'None' ]
494 set +x # Disable trace since we no longer need it
496 echo "WARNING: Logging server not set"
498 NEXUS_URL="${NEXUS_URL:-$NEXUSPROXY}"
499 NEXUS_PATH="${SILO}/${JENKINS_HOSTNAME}/${JOB_NAME}/${BUILD_NUMBER}"
500 BUILD_URL="${BUILD_URL}"
502 lftools deploy archives -p "$ARCHIVE_ARTIFACTS" "$NEXUS_URL" "$NEXUS_PATH" "$WORKSPACE"
503 lftools deploy logs "$NEXUS_URL" "$NEXUS_PATH" "$BUILD_URL"
505 set +x # Disable trace since we no longer need it.
507 echo "Build logs: <a href=\"$LOGS_SERVER/$NEXUS_PATH\">$LOGS_SERVER/$NEXUS_PATH</a>"
510 </hudson.tasks.Shell>
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 ##############################################################################
523 # Clear log credential files
524 rm "$SETTINGS_FILE"
527 </hudson.tasks.Shell>
528 <hudson.plugins.descriptionsetter.DescriptionSetterBuilder>
529 <regexp>^Build logs: .*</regexp>
530 </hudson.plugins.descriptionsetter.DescriptionSetterBuilder>
532 <scriptOnlyIfSuccess>false</scriptOnlyIfSuccess>
533 <scriptOnlyIfFailure>false</scriptOnlyIfFailure>
534 <markBuildUnstable>false</markBuildUnstable>
535 </org.jenkinsci.plugins.postbuildscript.PostBuildScript>
536 <hudson.plugins.ws__cleanup.WsCleanup plugin="ws-cleanup">
538 <hudson.plugins.ws__cleanup.Pattern>
539 <pattern>**/*.jenkins-trigger</pattern>
541 </hudson.plugins.ws__cleanup.Pattern>
543 <deleteDirs>false</deleteDirs>
544 <cleanupMatrixParent>false</cleanupMatrixParent>
546 <cleanWhenSuccess>true</cleanWhenSuccess>
547 <cleanWhenUnstable>true</cleanWhenUnstable>
548 <cleanWhenFailure>true</cleanWhenFailure>
549 <cleanWhenNotBuilt>true</cleanWhenNotBuilt>
550 <cleanWhenAborted>true</cleanWhenAborted>
551 <notFailBuild>true</notFailBuild>
552 </hudson.plugins.ws__cleanup.WsCleanup>
555 <com.michelin.cio.hudson.plugins.maskpasswords.MaskPasswordsBuildWrapper/>
556 <hudson.plugins.build__timeout.BuildTimeoutWrapper>
557 <timeoutMinutes>10</timeoutMinutes>
558 <timeoutEnvVar>BUILD_TIMEOUT</timeoutEnvVar>
559 <failBuild>true</failBuild>
560 <writingDescription>false</writingDescription>
561 <timeoutPercentage>0</timeoutPercentage>
562 <timeoutMinutesElasticDefault>3</timeoutMinutesElasticDefault>
563 <timeoutType>absolute</timeoutType>
564 </hudson.plugins.build__timeout.BuildTimeoutWrapper>
565 <hudson.plugins.timestamper.TimestamperBuildWrapper/>
566 <com.cloudbees.jenkins.plugins.sshagent.SSHAgentBuildWrapper>
567 <user>test-credential</user>
568 </com.cloudbees.jenkins.plugins.sshagent.SSHAgentBuildWrapper>
569 <jenkins.plugins.openstack.compute.JCloudsOneOffSlave/>