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 plugin="github">
13 <projectUrl>$GIT_URL/$GERRIT_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>Path to directory containing tox.ini file.
77 </hudson.model.StringParameterDefinition>
78 <hudson.model.StringParameterDefinition>
80 <description>Tox environments to run build against.
84 </hudson.model.StringParameterDefinition>
85 </parameterDefinitions>
86 </hudson.model.ParametersDefinitionProperty>
88 <scm class="hudson.plugins.git.GitSCM">
89 <configVersion>2</configVersion>
91 <hudson.plugins.git.UserRemoteConfig>
93 <refspec>+refs/pull/*:refs/remotes/origin/pr/*</refspec>
94 <url>git@github.com:example-org/releng/ciman</url>
95 <credentialsId>test-credential</credentialsId>
96 </hudson.plugins.git.UserRemoteConfig>
99 <hudson.plugins.git.BranchSpec>
101 </hudson.plugins.git.BranchSpec>
103 <doGenerateSubmoduleConfigurations>false</doGenerateSubmoduleConfigurations>
104 <remotePoll>false</remotePoll>
105 <gitTool>Default</gitTool>
106 <submoduleCfg class="list"/>
111 <hudson.plugins.git.extensions.impl.BuildChooserSetting>
112 <buildChooser class="hudson.plugins.git.util.DefaultBuildChooser"/>
113 </hudson.plugins.git.extensions.impl.BuildChooserSetting>
114 <hudson.plugins.git.extensions.impl.SubmoduleOption>
115 <disableSubmodules>false</disableSubmodules>
116 <recursiveSubmodules>true</recursiveSubmodules>
117 <trackingSubmodules>false</trackingSubmodules>
118 <parentCredentials>false</parentCredentials>
120 <timeout>10</timeout>
121 </hudson.plugins.git.extensions.impl.SubmoduleOption>
122 <hudson.plugins.git.extensions.impl.WipeWorkspace/>
125 <triggers class="vector">
126 <org.jenkinsci.plugins.ghprb.GhprbTrigger>
129 <allowMembersOfWhitelistedOrgsAsAdmin>false</allowMembersOfWhitelistedOrgsAsAdmin>
135 <triggerPhrase>^recheck$</triggerPhrase>
137 <onlyTriggerPhrase>false</onlyTriggerPhrase>
138 <useGitHubHooks>true</useGitHubHooks>
139 <permitAll>true</permitAll>
140 <autoCloseFailedPullRequests>false</autoCloseFailedPullRequests>
142 <org.jenkinsci.plugins.ghprb.extensions.status.GhprbSimpleStatus>
143 <commitStatusContext>JJB Verify</commitStatusContext>
144 </org.jenkinsci.plugins.ghprb.extensions.status.GhprbSimpleStatus>
146 </org.jenkinsci.plugins.ghprb.GhprbTrigger>
151 # SPDX-License-Identifier: EPL-1.0
152 ##############################################################################
153 # Copyright (c) 2017 The Linux Foundation and others.
155 # All rights reserved. This program and the accompanying materials
156 # are made available under the terms of the Eclipse Public License v1.0
157 # which accompanies this distribution, and is available at
158 # http://www.eclipse.org/legal/epl-v10.html
159 ##############################################################################
160 echo "---> lftools-install.sh"
162 # Script to install lftools via a version passed in via lf-infra-parameters
164 # Required parameters:
166 # LFTOOLS_VERSION: Passed in via lf-infra-parameters configuration. Can be
167 # set to a strict version number like '1.2.3' or using
168 # PEP-440 definitions.
172 # >=1.0.0,<2.0.0
174 # By default a released version of lftools should always be used.
175 # The purpose of the 2 variables below is so that lftools devs can test
176 # unreleased versions of lftools. There are 2 methods to install a dev version
179 # 1) gerrit patch: Used to test a patch that has not yet been merged.
180 # To do this set something like this:
181 # LFTOOLS_MODE=gerrit
182 # LFTOOLS_REFSPEC=refs/changes/96/5296/7
184 # 2) git branch: Used to install an lftools version from a specific branch.
185 # To use this set the variables as follows:
187 # LFTOOLS_REFSPEC=master
189 # 3) release : The intended use case and default setting.
190 # Set LFTOOLS_MODE=release, in this case LFTOOLS_REFSPEC is unused.
192 LFTOOLS_MODE=release # release | git | gerrit
193 LFTOOLS_REFSPEC=master
195 # Ensure we fail the job if any steps fail.
196 # DO NOT set -u as virtualenv's activate script has unbound variables
199 virtualenv --quiet "/tmp/v/lftools"
200 # shellcheck source=/tmp/v/lftools/bin/activate disable=SC1091
201 source "/tmp/v/lftools/bin/activate"
202 pip install --quiet --upgrade pip
204 case $LFTOOLS_MODE in
206 git clone https://gerrit.linuxfoundation.org/infra/releng/lftools.git /tmp/lftools
208 git fetch origin "$LFTOOLS_REFSPEC"
209 git checkout FETCH_HEAD
210 pip install --quiet --upgrade -r requirements.txt
211 pip install --quiet --upgrade -e .
216 pip install --quiet --upgrade git+https://gerrit.linuxfoundation.org/infra/releng/lftools.git@"$BRANCH"
220 if [[ $LFTOOLS_VERSION =~ ^[0-9] ]]; then
221 LFTOOLS_VERSION="==$LFTOOLS_VERSION"
224 pip install --quiet --upgrade "lftools${LFTOOLS_VERSION}"
230 # pipdeptree prints out a lot of information because lftools pulls in many
231 # dependencies. Let's only print it if we want to debug.
232 # echo "----> Pip Dependency Tree"
233 # pip install --quiet --upgrade pipdeptree
236 </hudson.tasks.Shell>
239 <propertiesContent>PYTHON_VERSION=python3</propertiesContent>
244 # SPDX-License-Identifier: EPL-1.0
245 ##############################################################################
246 # Copyright (c) 2017 The Linux Foundation and others.
248 # All rights reserved. This program and the accompanying materials
249 # are made available under the terms of the Eclipse Public License v1.0
250 # which accompanies this distribution, and is available at
251 # http://www.eclipse.org/legal/epl-v10.html
252 ##############################################################################
253 echo "---> tox-install.sh"
255 # Ensure we fail the job if any steps fail.
256 # DO NOT set -u as virtualenv's activate script has unbound variables
259 virtualenv --quiet -p "$PYTHON_VERSION" "/tmp/v/tox"
260 # shellcheck source=/tmp/v/tox/bin/activate disable=SC1091
261 source "/tmp/v/tox/bin/activate"
262 pip install --quiet --upgrade pip
263 pip install --quiet --upgrade pipdeptree
264 pip install --quiet --upgrade argparse detox tox tox-pyenv
266 echo "----> Pip Dependency Tree"
269 </hudson.tasks.Shell>
272 # SPDX-License-Identifier: EPL-1.0
273 ##############################################################################
274 # Copyright (c) 2017 The Linux Foundation and others.
276 # All rights reserved. This program and the accompanying materials
277 # are made available under the terms of the Eclipse Public License v1.0
278 # which accompanies this distribution, and is available at
279 # http://www.eclipse.org/legal/epl-v10.html
280 ##############################################################################
281 echo "---> tox-run.sh"
283 # shellcheck source=/tmp/v/tox/bin/activate disable=SC1091
284 source "/tmp/v/tox/bin/activate"
286 # Ensure we fail the job if any steps fail.
287 # DO NOT set -u as virtualenv's activate script has unbound variables
290 ARCHIVE_TOX_DIR="$WORKSPACE/archives/tox"
291 mkdir -p "$ARCHIVE_TOX_DIR"
292 cd "$WORKSPACE/$TOX_DIR"
294 if [ -d "/opt/pyenv" ]; then
295 echo "---> Setting up pyenv"
296 export PYENV_ROOT="/opt/pyenv"
297 export PATH="$PYENV_ROOT/bin:$PATH"
300 set +e # Allow detox to fail so that we can collect the logs in the next step
301 if [ ! -z "$TOX_ENVS" ]; then
302 detox -e "$TOX_ENVS" | tee -a "$ARCHIVE_TOX_DIR/detox.log"
303 detox_status="${PIPESTATUS[0]}"
305 detox | tee -a "$ARCHIVE_TOX_DIR/detox.log"
306 detox_status="${PIPESTATUS[0]}"
309 # Disable SC2116 as we want to echo a space separated list of TOX_ENVS
310 # shellcheck disable=SC2116
311 for i in .tox/*/log; do
312 tox_env=$(echo $i | awk -F'/' '{print $2}')
313 cp -r "$i" "$ARCHIVE_TOX_DIR/$tox_env"
315 set -e # Logs collected so re-enable
317 echo "Completed tox runs."
319 test "$detox_status" -eq 0 || exit "$detox_status"
321 </hudson.tasks.Shell>
324 <org.jenkinsci.plugins.postbuildscript.PostBuildScript>
328 # SPDX-License-Identifier: EPL-1.0
329 ##############################################################################
330 # Copyright (c) 2017 The Linux Foundation and others.
332 # All rights reserved. This program and the accompanying materials
333 # are made available under the terms of the Eclipse Public License v1.0
334 # which accompanies this distribution, and is available at
335 # http://www.eclipse.org/legal/epl-v10.html
336 ##############################################################################
337 echo "---> sysstat.sh"
338 set +e # DON'T fail build if script fails.
340 OS=$(facter operatingsystem)
341 case "$OS" in
343 SYSSTAT_PATH="/var/log/sysstat"
345 # Dont run the script when systat is not enabled by default
346 if ! grep --quiet 'ENABLED="true"' "/etc/default/sysstat"; then
351 SYSSTAT_PATH="/var/log/sa"
359 SAR_DIR="$WORKSPACE/archives/sar-reports"
360 mkdir -p "$SAR_DIR"
361 cp "$SYSSTAT_PATH/"* "$_"
362 # convert sar data to ascii format
363 while IFS="" read -r sarfilenum
365 [ -f "$sarfilenum" ] && LC_TIME=POSIX sar -A -f "$sarfilenum" > "$SAR_DIR/sar${sarfilenum//[!0-9]/}"
366 done < <(find "$SYSSTAT_PATH" -name "sa[0-9]*" || true)
368 # DON'T fail build if script fails.
371 </hudson.tasks.Shell>
372 <org.jenkinsci.plugins.configfiles.builder.ConfigFileBuildStep plugin="config-file-provider">
374 <org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
375 <fileId>jenkins-log-archives-settings</fileId>
377 <variable>SETTINGS_FILE</variable>
378 </org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
380 </org.jenkinsci.plugins.configfiles.builder.ConfigFileBuildStep>
383 <propertiesContent>SERVER_ID=logs</propertiesContent>
388 # SPDX-License-Identifier: EPL-1.0
389 ##############################################################################
390 # Copyright (c) 2017 The Linux Foundation and others.
392 # All rights reserved. This program and the accompanying materials
393 # are made available under the terms of the Eclipse Public License v1.0
394 # which accompanies this distribution, and is available at
395 # http://www.eclipse.org/legal/epl-v10.html
396 ##############################################################################
397 echo "---> create-netrc.sh"
399 # Ensure we fail the job if any steps fail.
402 NEXUS_URL="${NEXUSPROXY:-$NEXUS_URL}"
403 CREDENTIAL=$(xmlstarlet sel -N "x=http://maven.apache.org/SETTINGS/1.0.0" \
404 -t -m "/x:settings/x:servers/x:server[x:id='${SERVER_ID}']" \
405 -v x:username -o ":" -v x:password \
406 "$SETTINGS_FILE")
408 machine=$(echo "$NEXUS_URL" | awk -F/ '{print $3}')
409 user=$(echo "$CREDENTIAL" | cut -f1 -d:)
410 pass=$(echo "$CREDENTIAL" | cut -f2 -d:)
412 echo "machine ${machine%:*} login $user password $pass" > ~/.netrc
414 </hudson.tasks.Shell>
417 # SPDX-License-Identifier: EPL-1.0
418 ##############################################################################
419 # Copyright (c) 2017 The Linux Foundation and others.
421 # All rights reserved. This program and the accompanying materials
422 # are made available under the terms of the Eclipse Public License v1.0
423 # which accompanies this distribution, and is available at
424 # http://www.eclipse.org/legal/epl-v10.html
425 ##############################################################################
426 echo "---> lftools-install.sh"
428 # Script to install lftools via a version passed in via lf-infra-parameters
430 # Required parameters:
432 # LFTOOLS_VERSION: Passed in via lf-infra-parameters configuration. Can be
433 # set to a strict version number like '1.2.3' or using
434 # PEP-440 definitions.
438 # >=1.0.0,<2.0.0
440 # By default a released version of lftools should always be used.
441 # The purpose of the 2 variables below is so that lftools devs can test
442 # unreleased versions of lftools. There are 2 methods to install a dev version
445 # 1) gerrit patch: Used to test a patch that has not yet been merged.
446 # To do this set something like this:
447 # LFTOOLS_MODE=gerrit
448 # LFTOOLS_REFSPEC=refs/changes/96/5296/7
450 # 2) git branch: Used to install an lftools version from a specific branch.
451 # To use this set the variables as follows:
453 # LFTOOLS_REFSPEC=master
455 # 3) release : The intended use case and default setting.
456 # Set LFTOOLS_MODE=release, in this case LFTOOLS_REFSPEC is unused.
458 LFTOOLS_MODE=release # release | git | gerrit
459 LFTOOLS_REFSPEC=master
461 # Ensure we fail the job if any steps fail.
462 # DO NOT set -u as virtualenv's activate script has unbound variables
465 virtualenv --quiet "/tmp/v/lftools"
466 # shellcheck source=/tmp/v/lftools/bin/activate disable=SC1091
467 source "/tmp/v/lftools/bin/activate"
468 pip install --quiet --upgrade pip
470 case $LFTOOLS_MODE in
472 git clone https://gerrit.linuxfoundation.org/infra/releng/lftools.git /tmp/lftools
474 git fetch origin "$LFTOOLS_REFSPEC"
475 git checkout FETCH_HEAD
476 pip install --quiet --upgrade -r requirements.txt
477 pip install --quiet --upgrade -e .
482 pip install --quiet --upgrade git+https://gerrit.linuxfoundation.org/infra/releng/lftools.git@"$BRANCH"
486 if [[ $LFTOOLS_VERSION =~ ^[0-9] ]]; then
487 LFTOOLS_VERSION="==$LFTOOLS_VERSION"
490 pip install --quiet --upgrade "lftools${LFTOOLS_VERSION}"
496 # pipdeptree prints out a lot of information because lftools pulls in many
497 # dependencies. Let's only print it if we want to debug.
498 # echo "----> Pip Dependency Tree"
499 # pip install --quiet --upgrade pipdeptree
503 # SPDX-License-Identifier: EPL-1.0
504 ##############################################################################
505 # Copyright (c) 2017 The Linux Foundation and others.
507 # All rights reserved. This program and the accompanying materials
508 # are made available under the terms of the Eclipse Public License v1.0
509 # which accompanies this distribution, and is available at
510 # http://www.eclipse.org/legal/epl-v10.html
511 ##############################################################################
512 echo "---> logs-deploy.sh"
514 # Ensure we fail the job if any steps fail.
517 set -x # Trace commands for this script to make debugging easier.
519 ARCHIVE_ARTIFACTS="${ARCHIVE_ARTIFACTS:-}"
520 LOGS_SERVER="${LOGS_SERVER:-None}"
522 if [ "${LOGS_SERVER}" == 'None' ]
524 set +x # Disable trace since we no longer need it
526 echo "WARNING: Logging server not set"
528 NEXUS_URL="${NEXUSPROXY:-$NEXUS_URL}"
529 NEXUS_PATH="${SILO}/${JENKINS_HOSTNAME}/${JOB_NAME}/${BUILD_NUMBER}"
530 BUILD_URL="${BUILD_URL}"
532 lftools deploy archives -p "$ARCHIVE_ARTIFACTS" "$NEXUS_URL" "$NEXUS_PATH" "$WORKSPACE"
533 lftools deploy logs "$NEXUS_URL" "$NEXUS_PATH" "$BUILD_URL"
535 set +x # Disable trace since we no longer need it.
537 echo "Build logs: <a href=\"$LOGS_SERVER/$NEXUS_PATH\">$LOGS_SERVER/$NEXUS_PATH</a>"
540 </hudson.tasks.Shell>
543 # SPDX-License-Identifier: EPL-1.0
544 ##############################################################################
545 # Copyright (c) 2017 The Linux Foundation and others.
547 # All rights reserved. This program and the accompanying materials
548 # are made available under the terms of the Eclipse Public License v1.0
549 # which accompanies this distribution, and is available at
550 # http://www.eclipse.org/legal/epl-v10.html
551 ##############################################################################
553 # Clear log credential files
554 rm "$SETTINGS_FILE"
557 </hudson.tasks.Shell>
558 <hudson.plugins.descriptionsetter.DescriptionSetterBuilder>
559 <regexp>^Build logs: .*</regexp>
560 </hudson.plugins.descriptionsetter.DescriptionSetterBuilder>
562 <scriptOnlyIfSuccess>false</scriptOnlyIfSuccess>
563 <scriptOnlyIfFailure>false</scriptOnlyIfFailure>
564 <markBuildUnstable>false</markBuildUnstable>
565 </org.jenkinsci.plugins.postbuildscript.PostBuildScript>
566 <hudson.plugins.ws__cleanup.WsCleanup plugin="ws-cleanup">
568 <hudson.plugins.ws__cleanup.Pattern>
569 <pattern>**/*.jenkins-trigger</pattern>
571 </hudson.plugins.ws__cleanup.Pattern>
573 <deleteDirs>false</deleteDirs>
574 <cleanupMatrixParent>false</cleanupMatrixParent>
576 <cleanWhenSuccess>true</cleanWhenSuccess>
577 <cleanWhenUnstable>true</cleanWhenUnstable>
578 <cleanWhenFailure>true</cleanWhenFailure>
579 <cleanWhenNotBuilt>true</cleanWhenNotBuilt>
580 <cleanWhenAborted>true</cleanWhenAborted>
581 <notFailBuild>true</notFailBuild>
582 </hudson.plugins.ws__cleanup.WsCleanup>
585 <com.michelin.cio.hudson.plugins.maskpasswords.MaskPasswordsBuildWrapper/>
586 <hudson.plugins.build__timeout.BuildTimeoutWrapper>
587 <timeoutMinutes>10</timeoutMinutes>
588 <timeoutEnvVar>BUILD_TIMEOUT</timeoutEnvVar>
589 <failBuild>true</failBuild>
590 <writingDescription>false</writingDescription>
591 <timeoutPercentage>0</timeoutPercentage>
592 <timeoutMinutesElasticDefault>3</timeoutMinutesElasticDefault>
593 <timeoutType>absolute</timeoutType>
594 </hudson.plugins.build__timeout.BuildTimeoutWrapper>
595 <hudson.plugins.timestamper.TimestamperBuildWrapper/>
596 <com.cloudbees.jenkins.plugins.sshagent.SSHAgentBuildWrapper>
597 <user>test-credential</user>
598 </com.cloudbees.jenkins.plugins.sshagent.SSHAgentBuildWrapper>
599 <jenkins.plugins.openstack.compute.JCloudsOneOffSlave/>
600 <org.jenkinsci.plugins.configfiles.buildwrapper.ConfigFileBuildWrapper plugin="config-file-provider">
602 <org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
603 <fileId>npmrc</fileId>
604 <targetLocation>$HOME/.npmrc</targetLocation>
606 </org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
608 </org.jenkinsci.plugins.configfiles.buildwrapper.ConfigFileBuildWrapper>