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 <jenkins.model.BuildDiscarderProperty>
13 <strategy class="hudson.tasks.LogRotator">
14 <daysToKeep>7</daysToKeep>
15 <numToKeep>-1</numToKeep>
16 <artifactDaysToKeep>-1</artifactDaysToKeep>
17 <artifactNumToKeep>0</artifactNumToKeep>
19 </jenkins.model.BuildDiscarderProperty>
20 <hudson.model.ParametersDefinitionProperty>
21 <parameterDefinitions>
22 <hudson.model.StringParameterDefinition>
24 <description>Parameter to identify a Gerrit project. This is typically the
25 project repo path as exists in Gerrit.
26 For example: ofextensions/circuitsw
28 <defaultValue>releng/ciman</defaultValue>
29 </hudson.model.StringParameterDefinition>
30 <hudson.model.StringParameterDefinition>
32 <description>Stream is often set to the same name as 'branch' but can
33 sometimes be used as a name representing a project's release code
36 <defaultValue>master</defaultValue>
37 </hudson.model.StringParameterDefinition>
38 <hudson.model.StringParameterDefinition>
39 <name>GERRIT_PROJECT</name>
40 <description>Parameter to identify Gerrit project. This is typically the
41 project repo path as exists in Gerrit.
42 For example: ofextensions/circuitsw
44 Note that Gerrit will override this parameter automatically if a
45 job is triggered by Gerrit.
47 <defaultValue>releng/ciman</defaultValue>
48 </hudson.model.StringParameterDefinition>
49 <hudson.model.StringParameterDefinition>
50 <name>GERRIT_BRANCH</name>
51 <description>Parameter to identify a Gerrit branch.
53 Note that Gerrit will override this parameter automatically if a
54 job is triggered by Gerrit.
56 <defaultValue>master</defaultValue>
57 </hudson.model.StringParameterDefinition>
58 <hudson.model.StringParameterDefinition>
59 <name>GERRIT_REFSPEC</name>
60 <description>Parameter to identify a refspec when pulling from Gerrit.
62 Note that Gerrit will override this parameter automatically if a
63 job is triggered by Gerrit.
65 <defaultValue>refs/heads/master</defaultValue>
66 </hudson.model.StringParameterDefinition>
67 <hudson.model.StringParameterDefinition>
68 <name>LFTOOLS_VERSION</name>
69 <description>Version of lftools to install. Can be a specific version like
70 '0.6.0' or a PEP-440 definition.
71 https://www.python.org/dev/peps/pep-0440/
72 For example '<1.0.0' or '>=1.0.0,<2.0.0'.
74 <defaultValue><1.0.0</defaultValue>
75 </hudson.model.StringParameterDefinition>
76 <hudson.model.StringParameterDefinition>
78 <description>Path to directory containing tox.ini file.
81 </hudson.model.StringParameterDefinition>
82 <hudson.model.StringParameterDefinition>
84 <description>Tox environments to run build against.
88 </hudson.model.StringParameterDefinition>
89 </parameterDefinitions>
90 </hudson.model.ParametersDefinitionProperty>
92 <scm class="hudson.plugins.git.GitSCM">
93 <configVersion>2</configVersion>
95 <hudson.plugins.git.UserRemoteConfig>
97 <refspec>$GERRIT_REFSPEC</refspec>
98 <url>$GIT_URL/$GERRIT_PROJECT</url>
99 <credentialsId>test-credential</credentialsId>
100 </hudson.plugins.git.UserRemoteConfig>
103 <hudson.plugins.git.BranchSpec>
104 <name>refs/heads/$GERRIT_BRANCH</name>
105 </hudson.plugins.git.BranchSpec>
108 <buildChooser class="com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.GerritTriggerBuildChooser"/>
109 <doGenerateSubmoduleConfigurations>false</doGenerateSubmoduleConfigurations>
110 <authorOrCommitter>false</authorOrCommitter>
111 <wipeOutWorkspace>true</wipeOutWorkspace>
112 <pruneBranches>false</pruneBranches>
113 <remotePoll>false</remotePoll>
114 <gitTool>Default</gitTool>
115 <submoduleCfg class="list"/>
120 <skipTag>true</skipTag>
122 <useShallowClone>false</useShallowClone>
123 <ignoreNotifyCommit>false</ignoreNotifyCommit>
125 <hudson.plugins.git.extensions.impl.SubmoduleOption>
126 <disableSubmodules>false</disableSubmodules>
127 <recursiveSubmodules>true</recursiveSubmodules>
128 <trackingSubmodules>false</trackingSubmodules>
130 <timeout>10</timeout>
131 </hudson.plugins.git.extensions.impl.SubmoduleOption>
132 <hudson.plugins.git.extensions.impl.WipeWorkspace/>
135 <triggers class="vector">
136 <com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.GerritTrigger>
139 <com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.data.GerritProject>
140 <compareType>ANT</compareType>
141 <pattern>releng/ciman</pattern>
143 <com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.data.Branch>
144 <compareType>ANT</compareType>
145 <pattern>**/master</pattern>
146 </com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.data.Branch>
148 <disableStrictForbiddenFileVerification>false</disableStrictForbiddenFileVerification>
149 </com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.data.GerritProject>
152 <onSuccessful>false</onSuccessful>
153 <onFailed>false</onFailed>
154 <onUnstable>false</onUnstable>
155 <onNotBuilt>false</onNotBuilt>
157 <silentMode>false</silentMode>
158 <silentStartMode>false</silentStartMode>
159 <escapeQuotes>true</escapeQuotes>
160 <noNameAndEmailParameters>false</noNameAndEmailParameters>
161 <readableMessage>false</readableMessage>
162 <dependencyJobsNames/>
164 <dynamicTriggerConfiguration>False</dynamicTriggerConfiguration>
166 <allowTriggeringUnreviewedPatches>false</allowTriggeringUnreviewedPatches>
168 <com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.events.PluginPatchsetCreatedEvent>
169 <excludeDrafts>true</excludeDrafts>
170 <excludeTrivialRebase>false</excludeTrivialRebase>
171 <excludeNoCodeChange>false</excludeNoCodeChange>
172 </com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.events.PluginPatchsetCreatedEvent>
173 <com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.events.PluginDraftPublishedEvent/>
174 <com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.events.PluginCommentAddedContainsEvent>
175 <commentAddedCommentContains>recheck$</commentAddedCommentContains>
176 </com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.events.PluginCommentAddedContainsEvent>
179 <buildFailureMessage/>
180 <buildSuccessfulMessage/>
181 <buildUnstableMessage/>
182 <buildNotBuiltMessage/>
183 <buildUnsuccessfulFilepath/>
185 <serverName>test-server</serverName>
186 </com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.GerritTrigger>
191 # SPDX-License-Identifier: EPL-1.0
192 ##############################################################################
193 # Copyright (c) 2017 The Linux Foundation and others.
195 # All rights reserved. This program and the accompanying materials
196 # are made available under the terms of the Eclipse Public License v1.0
197 # which accompanies this distribution, and is available at
198 # http://www.eclipse.org/legal/epl-v10.html
199 ##############################################################################
200 echo "---> lftools-install.sh"
202 # Script to install lftools via a version passed in via lf-infra-parameters
204 # Required parameters:
206 # LFTOOLS_VERSION: Passed in via lf-infra-parameters configuration. Can be
207 # set to a strict version number like '1.2.3' or using
208 # PEP-440 definitions.
212 # >=1.0.0,<2.0.0
214 # By default a released version of lftools should always be used.
215 # The purpose of the 2 variables below is so that lftools devs can test
216 # unreleased versions of lftools. There are 2 methods to install a dev version
219 # 1) gerrit patch: Used to test a patch that has not yet been merged.
220 # To do this set something like this:
221 # LFTOOLS_MODE=gerrit
222 # LFTOOLS_REFSPEC=refs/changes/96/5296/7
224 # 2) git branch: Used to install an lftools version from a specific branch.
225 # To use this set the variables as follows:
227 # LFTOOLS_REFSPEC=master
229 # 3) release : The intended use case and default setting.
230 # Set LFTOOLS_MODE=release, in this case LFTOOLS_REFSPEC is unused.
232 LFTOOLS_MODE=release # release | git | gerrit
233 LFTOOLS_REFSPEC=master
235 # Ensure we fail the job if any steps fail.
236 # DO NOT set -u as virtualenv's activate script has unbound variables
239 virtualenv --quiet "/tmp/v/lftools"
240 # shellcheck source=/tmp/v/lftools/bin/activate disable=SC1091
241 source "/tmp/v/lftools/bin/activate"
242 pip install --quiet --upgrade pip
244 case $LFTOOLS_MODE in
246 git clone https://gerrit.linuxfoundation.org/infra/releng/lftools.git /tmp/lftools
248 git fetch origin "$LFTOOLS_REFSPEC"
249 git checkout FETCH_HEAD
250 pip install --quiet --upgrade -r requirements.txt
251 pip install --quiet --upgrade -e .
256 pip install --quiet --upgrade git+https://gerrit.linuxfoundation.org/infra/releng/lftools.git@"$BRANCH"
260 if [[ $LFTOOLS_VERSION =~ ^[0-9] ]]; then
261 LFTOOLS_VERSION="==$LFTOOLS_VERSION"
264 pip install --quiet --upgrade "lftools${LFTOOLS_VERSION}"
270 # pipdeptree prints out a lot of information because lftools pulls in many
271 # dependencies. Let's only print it if we want to debug.
272 # echo "----> Pip Dependency Tree"
273 # pip install --quiet --upgrade pipdeptree
276 </hudson.tasks.Shell>
279 # SPDX-License-Identifier: EPL-1.0
280 ##############################################################################
281 # Copyright (c) 2017 The Linux Foundation and others.
283 # All rights reserved. This program and the accompanying materials
284 # are made available under the terms of the Eclipse Public License v1.0
285 # which accompanies this distribution, and is available at
286 # http://www.eclipse.org/legal/epl-v10.html
287 ##############################################################################
288 echo "---> tox-install.sh"
290 # Ensure we fail the job if any steps fail.
291 # DO NOT set -u as virtualenv's activate script has unbound variables
294 virtualenv --quiet "/tmp/v/tox"
295 # shellcheck source=/tmp/v/tox/bin/activate disable=SC1091
296 source "/tmp/v/tox/bin/activate"
297 pip install --quiet --upgrade pip
298 pip install --quiet --upgrade pipdeptree
299 pip install --quiet --upgrade tox argparse
301 echo "----> Pip Dependency Tree"
305 # SPDX-License-Identifier: EPL-1.0
306 ##############################################################################
307 # Copyright (c) 2017 The Linux Foundation and others.
309 # All rights reserved. This program and the accompanying materials
310 # are made available under the terms of the Eclipse Public License v1.0
311 # which accompanies this distribution, and is available at
312 # http://www.eclipse.org/legal/epl-v10.html
313 ##############################################################################
314 echo "---> tox-run.sh"
316 # Ensure we fail the job if any steps fail.
317 # DO NOT set -u as virtualenv's activate script has unbound variables
320 ARCHIVE_TOX_DIR="$WORKSPACE/archives/tox"
321 mkdir -p "$ARCHIVE_TOX_DIR"
323 cd "$WORKSPACE/$TOX_DIR"
325 if [ -z "$TOX_ENVS" ]; then
326 TOX_ENVS=$(crudini --get tox.ini tox envlist)
330 local log_dir="$1"
331 local env="$2"
333 # Sleep a random 10 second interval to workaround tox sdist
334 # conflicts due to building in the same dist directory.
335 sleep $[ ( $RANDOM % 10 ) + 1 ]s
337 echo "-----> Running tox $env"
338 if ! tox -e $env > "$log_dir/tox-$env.log"; then
339 echo "$env" >> "$log_dir/failed-envs.log"
343 TOX_ENVS=(${TOX_ENVS//,/ })
344 if hash parallel 2>/dev/null; then
346 parallel --jobs 200% "run_tox $ARCHIVE_TOX_DIR {}" ::: ${TOX_ENVS[*]}
348 for env in "${TOX_ENVS[@]}"; do
349 run_tox "$ARCHIVE_TOX_DIR" "$env"
353 if [ -f "$ARCHIVE_TOX_DIR/failed-envs.log" ]; then
354 failed_envs=($(cat "$ARCHIVE_TOX_DIR/failed-envs.log"))
355 for e in "${failed_envs[@]}"; do
356 echo "cat $ARCHIVE_TOX_DIR/tox-$e.log"
357 cat "$ARCHIVE_TOX_DIR/tox-$e.log"
359 echo "ERROR: Failed the following builds: ${failed_envs[*]}"
363 echo "Completed tox runs."
365 </hudson.tasks.Shell>
368 <org.jenkinsci.plugins.postbuildscript.PostBuildScript>
372 # SPDX-License-Identifier: EPL-1.0
373 ##############################################################################
374 # Copyright (c) 2017 The Linux Foundation and others.
376 # All rights reserved. This program and the accompanying materials
377 # are made available under the terms of the Eclipse Public License v1.0
378 # which accompanies this distribution, and is available at
379 # http://www.eclipse.org/legal/epl-v10.html
380 ##############################################################################
381 echo "---> sysstat.sh"
382 set +e # DON'T fail build if script fails.
384 OS=$(facter operatingsystem)
385 case "$OS" in
387 SYSSTAT_PATH="/var/log/sysstat"
389 # Dont run the script when systat is not enabled by default
390 if ! grep --quiet 'ENABLED="true"' "/etc/default/sysstat"; then
395 SYSSTAT_PATH="/var/log/sa"
403 SAR_DIR="$WORKSPACE/archives/sar-reports"
404 mkdir -p "$SAR_DIR"
405 cp "$SYSSTAT_PATH/"* "$_"
406 # convert sar data to ascii format
407 while IFS="" read -r s
409 [ -f "$s" ] && LC_TIME=POSIX sar -A -f "$s" > "$SAR_DIR/sar${s//[!0-9]/}"
410 done < <(find "$SYSSTAT_PATH" -name "sa[0-9]*" || true)
412 # DON'T fail build if script fails.
415 </hudson.tasks.Shell>
416 <org.jenkinsci.plugins.configfiles.builder.ConfigFileBuildStep plugin="config-file-provider">
418 <org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
419 <fileId>jenkins-log-archives-settings</fileId>
421 <variable>SETTINGS_FILE</variable>
422 </org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
424 </org.jenkinsci.plugins.configfiles.builder.ConfigFileBuildStep>
427 <propertiesContent>SERVER_ID=logs</propertiesContent>
432 # SPDX-License-Identifier: EPL-1.0
433 ##############################################################################
434 # Copyright (c) 2017 The Linux Foundation and others.
436 # All rights reserved. This program and the accompanying materials
437 # are made available under the terms of the Eclipse Public License v1.0
438 # which accompanies this distribution, and is available at
439 # http://www.eclipse.org/legal/epl-v10.html
440 ##############################################################################
441 echo "---> create-netrc.sh"
443 # Ensure we fail the job if any steps fail.
446 NEXUS_URL="${NEXUSPROXY:-$NEXUS_URL}"
447 CREDENTIAL=$(xmlstarlet sel -N "x=http://maven.apache.org/SETTINGS/1.0.0" \
448 -t -m "/x:settings/x:servers/x:server[x:id='${SERVER_ID}']" \
449 -v x:username -o ":" -v x:password \
450 "$SETTINGS_FILE")
452 machine=$(echo "$NEXUS_URL" | awk -F/ '{print $3}')
453 user=$(echo "$CREDENTIAL" | cut -f1 -d:)
454 pass=$(echo "$CREDENTIAL" | cut -f2 -d:)
456 echo "machine ${machine%:*} login $user password $pass" > ~/.netrc
458 </hudson.tasks.Shell>
461 # SPDX-License-Identifier: EPL-1.0
462 ##############################################################################
463 # Copyright (c) 2017 The Linux Foundation and others.
465 # All rights reserved. This program and the accompanying materials
466 # are made available under the terms of the Eclipse Public License v1.0
467 # which accompanies this distribution, and is available at
468 # http://www.eclipse.org/legal/epl-v10.html
469 ##############################################################################
470 echo "---> lftools-install.sh"
472 # Script to install lftools via a version passed in via lf-infra-parameters
474 # Required parameters:
476 # LFTOOLS_VERSION: Passed in via lf-infra-parameters configuration. Can be
477 # set to a strict version number like '1.2.3' or using
478 # PEP-440 definitions.
482 # >=1.0.0,<2.0.0
484 # By default a released version of lftools should always be used.
485 # The purpose of the 2 variables below is so that lftools devs can test
486 # unreleased versions of lftools. There are 2 methods to install a dev version
489 # 1) gerrit patch: Used to test a patch that has not yet been merged.
490 # To do this set something like this:
491 # LFTOOLS_MODE=gerrit
492 # LFTOOLS_REFSPEC=refs/changes/96/5296/7
494 # 2) git branch: Used to install an lftools version from a specific branch.
495 # To use this set the variables as follows:
497 # LFTOOLS_REFSPEC=master
499 # 3) release : The intended use case and default setting.
500 # Set LFTOOLS_MODE=release, in this case LFTOOLS_REFSPEC is unused.
502 LFTOOLS_MODE=release # release | git | gerrit
503 LFTOOLS_REFSPEC=master
505 # Ensure we fail the job if any steps fail.
506 # DO NOT set -u as virtualenv's activate script has unbound variables
509 virtualenv --quiet "/tmp/v/lftools"
510 # shellcheck source=/tmp/v/lftools/bin/activate disable=SC1091
511 source "/tmp/v/lftools/bin/activate"
512 pip install --quiet --upgrade pip
514 case $LFTOOLS_MODE in
516 git clone https://gerrit.linuxfoundation.org/infra/releng/lftools.git /tmp/lftools
518 git fetch origin "$LFTOOLS_REFSPEC"
519 git checkout FETCH_HEAD
520 pip install --quiet --upgrade -r requirements.txt
521 pip install --quiet --upgrade -e .
526 pip install --quiet --upgrade git+https://gerrit.linuxfoundation.org/infra/releng/lftools.git@"$BRANCH"
530 if [[ $LFTOOLS_VERSION =~ ^[0-9] ]]; then
531 LFTOOLS_VERSION="==$LFTOOLS_VERSION"
534 pip install --quiet --upgrade "lftools${LFTOOLS_VERSION}"
540 # pipdeptree prints out a lot of information because lftools pulls in many
541 # dependencies. Let's only print it if we want to debug.
542 # echo "----> Pip Dependency Tree"
543 # pip install --quiet --upgrade pipdeptree
547 # SPDX-License-Identifier: EPL-1.0
548 ##############################################################################
549 # Copyright (c) 2017 The Linux Foundation and others.
551 # All rights reserved. This program and the accompanying materials
552 # are made available under the terms of the Eclipse Public License v1.0
553 # which accompanies this distribution, and is available at
554 # http://www.eclipse.org/legal/epl-v10.html
555 ##############################################################################
556 echo "---> logs-deploy.sh"
558 # Ensure we fail the job if any steps fail.
561 set -x # Trace commands for this script to make debugging easier.
563 ARCHIVE_ARTIFACTS="${ARCHIVE_ARTIFACTS:-}"
564 LOGS_SERVER="${LOGS_SERVER:-None}"
566 if [ "${LOGS_SERVER}" == 'None' ]
568 set +x # Disable trace since we no longer need it
570 echo "WARNING: Logging server not set"
572 NEXUS_URL="${NEXUSPROXY:-$NEXUS_URL}"
573 NEXUS_PATH="${SILO}/${JENKINS_HOSTNAME}/${JOB_NAME}/${BUILD_NUMBER}"
574 BUILD_URL="${BUILD_URL}"
576 lftools deploy archives -p "$ARCHIVE_ARTIFACTS" "$NEXUS_URL" "$NEXUS_PATH" "$WORKSPACE"
577 lftools deploy logs "$NEXUS_URL" "$NEXUS_PATH" "$BUILD_URL"
579 set +x # Disable trace since we no longer need it.
581 echo "Build logs: <a href=\"$LOGS_SERVER/$NEXUS_PATH\">$LOGS_SERVER/$NEXUS_PATH</a>"
584 </hudson.tasks.Shell>
587 # SPDX-License-Identifier: EPL-1.0
588 ##############################################################################
589 # Copyright (c) 2017 The Linux Foundation and others.
591 # All rights reserved. This program and the accompanying materials
592 # are made available under the terms of the Eclipse Public License v1.0
593 # which accompanies this distribution, and is available at
594 # http://www.eclipse.org/legal/epl-v10.html
595 ##############################################################################
597 # Clear log credential files
598 rm "$SETTINGS_FILE"
601 </hudson.tasks.Shell>
602 <hudson.plugins.descriptionsetter.DescriptionSetterBuilder>
603 <regexp>^Build logs: .*</regexp>
604 </hudson.plugins.descriptionsetter.DescriptionSetterBuilder>
606 <scriptOnlyIfSuccess>false</scriptOnlyIfSuccess>
607 <scriptOnlyIfFailure>false</scriptOnlyIfFailure>
608 <markBuildUnstable>false</markBuildUnstable>
609 </org.jenkinsci.plugins.postbuildscript.PostBuildScript>
610 <hudson.plugins.ws__cleanup.WsCleanup plugin="ws-cleanup">
612 <hudson.plugins.ws__cleanup.Pattern>
613 <pattern>**/*.jenkins-trigger</pattern>
615 </hudson.plugins.ws__cleanup.Pattern>
617 <deleteDirs>false</deleteDirs>
618 <cleanupMatrixParent>false</cleanupMatrixParent>
620 <cleanWhenSuccess>true</cleanWhenSuccess>
621 <cleanWhenUnstable>true</cleanWhenUnstable>
622 <cleanWhenFailure>true</cleanWhenFailure>
623 <cleanWhenNotBuilt>true</cleanWhenNotBuilt>
624 <cleanWhenAborted>true</cleanWhenAborted>
625 <notFailBuild>true</notFailBuild>
626 </hudson.plugins.ws__cleanup.WsCleanup>
629 <com.michelin.cio.hudson.plugins.maskpasswords.MaskPasswordsBuildWrapper/>
630 <hudson.plugins.build__timeout.BuildTimeoutWrapper>
631 <timeoutMinutes>10</timeoutMinutes>
632 <timeoutEnvVar>BUILD_TIMEOUT</timeoutEnvVar>
633 <failBuild>true</failBuild>
634 <writingDescription>false</writingDescription>
635 <timeoutPercentage>0</timeoutPercentage>
636 <timeoutMinutesElasticDefault>3</timeoutMinutesElasticDefault>
637 <timeoutType>absolute</timeoutType>
638 </hudson.plugins.build__timeout.BuildTimeoutWrapper>
639 <hudson.plugins.timestamper.TimestamperBuildWrapper/>
640 <com.cloudbees.jenkins.plugins.sshagent.SSHAgentBuildWrapper>
641 <user>test-credential</user>
642 </com.cloudbees.jenkins.plugins.sshagent.SSHAgentBuildWrapper>
643 <jenkins.plugins.openstack.compute.JCloudsOneOffSlave/>