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 <propertiesContent>PYTHON_VERSION=python3</propertiesContent>
284 # SPDX-License-Identifier: EPL-1.0
285 ##############################################################################
286 # Copyright (c) 2017 The Linux Foundation and others.
288 # All rights reserved. This program and the accompanying materials
289 # are made available under the terms of the Eclipse Public License v1.0
290 # which accompanies this distribution, and is available at
291 # http://www.eclipse.org/legal/epl-v10.html
292 ##############################################################################
293 echo "---> tox-install.sh"
295 # Ensure we fail the job if any steps fail.
296 # DO NOT set -u as virtualenv's activate script has unbound variables
299 virtualenv --quiet -p "$PYTHON_VERSION" "/tmp/v/tox"
300 # shellcheck source=/tmp/v/tox/bin/activate disable=SC1091
301 source "/tmp/v/tox/bin/activate"
302 pip install --quiet --upgrade pip
303 pip install --quiet --upgrade pipdeptree
304 pip install --quiet --upgrade argparse detox tox tox-pyenv
306 echo "----> Pip Dependency Tree"
309 </hudson.tasks.Shell>
312 # SPDX-License-Identifier: EPL-1.0
313 ##############################################################################
314 # Copyright (c) 2017 The Linux Foundation and others.
316 # All rights reserved. This program and the accompanying materials
317 # are made available under the terms of the Eclipse Public License v1.0
318 # which accompanies this distribution, and is available at
319 # http://www.eclipse.org/legal/epl-v10.html
320 ##############################################################################
321 echo "---> tox-run.sh"
323 # shellcheck source=/tmp/v/tox/bin/activate disable=SC1091
324 source "/tmp/v/tox/bin/activate"
326 # Ensure we fail the job if any steps fail.
327 # DO NOT set -u as virtualenv's activate script has unbound variables
330 ARCHIVE_TOX_DIR="$WORKSPACE/archives/tox"
331 mkdir -p "$ARCHIVE_TOX_DIR"
332 cd "$WORKSPACE/$TOX_DIR"
334 if [ -d "/opt/pyenv" ]; then
335 echo "---> Setting up pyenv"
336 export PYENV_ROOT="/opt/pyenv"
337 export PATH="$PYENV_ROOT/bin:$PATH"
340 if [ ! -z "$TOX_ENVS" ]; then
341 detox -e "$TOX_ENVS" | tee -a "$ARCHIVE_TOX_DIR/detox.log"
343 detox | tee -a "$ARCHIVE_TOX_DIR/detox.log"
346 # Disable SC2116 as we want to echo a space separated list of TOX_ENVS
347 # shellcheck disable=SC2116
348 for i in $(echo "${TOX_ENVS//,/ }"); do
349 cp -r ".tox/$i/log" "$ARCHIVE_TOX_DIR/$i"
352 echo "Completed tox runs."
354 </hudson.tasks.Shell>
357 <org.jenkinsci.plugins.postbuildscript.PostBuildScript>
361 # SPDX-License-Identifier: EPL-1.0
362 ##############################################################################
363 # Copyright (c) 2017 The Linux Foundation and others.
365 # All rights reserved. This program and the accompanying materials
366 # are made available under the terms of the Eclipse Public License v1.0
367 # which accompanies this distribution, and is available at
368 # http://www.eclipse.org/legal/epl-v10.html
369 ##############################################################################
370 echo "---> sysstat.sh"
371 set +e # DON'T fail build if script fails.
373 OS=$(facter operatingsystem)
374 case "$OS" in
376 SYSSTAT_PATH="/var/log/sysstat"
378 # Dont run the script when systat is not enabled by default
379 if ! grep --quiet 'ENABLED="true"' "/etc/default/sysstat"; then
384 SYSSTAT_PATH="/var/log/sa"
392 SAR_DIR="$WORKSPACE/archives/sar-reports"
393 mkdir -p "$SAR_DIR"
394 cp "$SYSSTAT_PATH/"* "$_"
395 # convert sar data to ascii format
396 while IFS="" read -r sarfilenum
398 [ -f "$sarfilenum" ] && LC_TIME=POSIX sar -A -f "$sarfilenum" > "$SAR_DIR/sar${sarfilenum//[!0-9]/}"
399 done < <(find "$SYSSTAT_PATH" -name "sa[0-9]*" || true)
401 # DON'T fail build if script fails.
404 </hudson.tasks.Shell>
405 <org.jenkinsci.plugins.configfiles.builder.ConfigFileBuildStep plugin="config-file-provider">
407 <org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
408 <fileId>jenkins-log-archives-settings</fileId>
410 <variable>SETTINGS_FILE</variable>
411 </org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
413 </org.jenkinsci.plugins.configfiles.builder.ConfigFileBuildStep>
416 <propertiesContent>SERVER_ID=logs</propertiesContent>
421 # SPDX-License-Identifier: EPL-1.0
422 ##############################################################################
423 # Copyright (c) 2017 The Linux Foundation and others.
425 # All rights reserved. This program and the accompanying materials
426 # are made available under the terms of the Eclipse Public License v1.0
427 # which accompanies this distribution, and is available at
428 # http://www.eclipse.org/legal/epl-v10.html
429 ##############################################################################
430 echo "---> create-netrc.sh"
432 # Ensure we fail the job if any steps fail.
435 NEXUS_URL="${NEXUSPROXY:-$NEXUS_URL}"
436 CREDENTIAL=$(xmlstarlet sel -N "x=http://maven.apache.org/SETTINGS/1.0.0" \
437 -t -m "/x:settings/x:servers/x:server[x:id='${SERVER_ID}']" \
438 -v x:username -o ":" -v x:password \
439 "$SETTINGS_FILE")
441 machine=$(echo "$NEXUS_URL" | awk -F/ '{print $3}')
442 user=$(echo "$CREDENTIAL" | cut -f1 -d:)
443 pass=$(echo "$CREDENTIAL" | cut -f2 -d:)
445 echo "machine ${machine%:*} login $user password $pass" > ~/.netrc
447 </hudson.tasks.Shell>
450 # SPDX-License-Identifier: EPL-1.0
451 ##############################################################################
452 # Copyright (c) 2017 The Linux Foundation and others.
454 # All rights reserved. This program and the accompanying materials
455 # are made available under the terms of the Eclipse Public License v1.0
456 # which accompanies this distribution, and is available at
457 # http://www.eclipse.org/legal/epl-v10.html
458 ##############################################################################
459 echo "---> lftools-install.sh"
461 # Script to install lftools via a version passed in via lf-infra-parameters
463 # Required parameters:
465 # LFTOOLS_VERSION: Passed in via lf-infra-parameters configuration. Can be
466 # set to a strict version number like '1.2.3' or using
467 # PEP-440 definitions.
471 # >=1.0.0,<2.0.0
473 # By default a released version of lftools should always be used.
474 # The purpose of the 2 variables below is so that lftools devs can test
475 # unreleased versions of lftools. There are 2 methods to install a dev version
478 # 1) gerrit patch: Used to test a patch that has not yet been merged.
479 # To do this set something like this:
480 # LFTOOLS_MODE=gerrit
481 # LFTOOLS_REFSPEC=refs/changes/96/5296/7
483 # 2) git branch: Used to install an lftools version from a specific branch.
484 # To use this set the variables as follows:
486 # LFTOOLS_REFSPEC=master
488 # 3) release : The intended use case and default setting.
489 # Set LFTOOLS_MODE=release, in this case LFTOOLS_REFSPEC is unused.
491 LFTOOLS_MODE=release # release | git | gerrit
492 LFTOOLS_REFSPEC=master
494 # Ensure we fail the job if any steps fail.
495 # DO NOT set -u as virtualenv's activate script has unbound variables
498 virtualenv --quiet "/tmp/v/lftools"
499 # shellcheck source=/tmp/v/lftools/bin/activate disable=SC1091
500 source "/tmp/v/lftools/bin/activate"
501 pip install --quiet --upgrade pip
503 case $LFTOOLS_MODE in
505 git clone https://gerrit.linuxfoundation.org/infra/releng/lftools.git /tmp/lftools
507 git fetch origin "$LFTOOLS_REFSPEC"
508 git checkout FETCH_HEAD
509 pip install --quiet --upgrade -r requirements.txt
510 pip install --quiet --upgrade -e .
515 pip install --quiet --upgrade git+https://gerrit.linuxfoundation.org/infra/releng/lftools.git@"$BRANCH"
519 if [[ $LFTOOLS_VERSION =~ ^[0-9] ]]; then
520 LFTOOLS_VERSION="==$LFTOOLS_VERSION"
523 pip install --quiet --upgrade "lftools${LFTOOLS_VERSION}"
529 # pipdeptree prints out a lot of information because lftools pulls in many
530 # dependencies. Let's only print it if we want to debug.
531 # echo "----> Pip Dependency Tree"
532 # pip install --quiet --upgrade pipdeptree
536 # SPDX-License-Identifier: EPL-1.0
537 ##############################################################################
538 # Copyright (c) 2017 The Linux Foundation and others.
540 # All rights reserved. This program and the accompanying materials
541 # are made available under the terms of the Eclipse Public License v1.0
542 # which accompanies this distribution, and is available at
543 # http://www.eclipse.org/legal/epl-v10.html
544 ##############################################################################
545 echo "---> logs-deploy.sh"
547 # Ensure we fail the job if any steps fail.
550 set -x # Trace commands for this script to make debugging easier.
552 ARCHIVE_ARTIFACTS="${ARCHIVE_ARTIFACTS:-}"
553 LOGS_SERVER="${LOGS_SERVER:-None}"
555 if [ "${LOGS_SERVER}" == 'None' ]
557 set +x # Disable trace since we no longer need it
559 echo "WARNING: Logging server not set"
561 NEXUS_URL="${NEXUSPROXY:-$NEXUS_URL}"
562 NEXUS_PATH="${SILO}/${JENKINS_HOSTNAME}/${JOB_NAME}/${BUILD_NUMBER}"
563 BUILD_URL="${BUILD_URL}"
565 lftools deploy archives -p "$ARCHIVE_ARTIFACTS" "$NEXUS_URL" "$NEXUS_PATH" "$WORKSPACE"
566 lftools deploy logs "$NEXUS_URL" "$NEXUS_PATH" "$BUILD_URL"
568 set +x # Disable trace since we no longer need it.
570 echo "Build logs: <a href=\"$LOGS_SERVER/$NEXUS_PATH\">$LOGS_SERVER/$NEXUS_PATH</a>"
573 </hudson.tasks.Shell>
576 # SPDX-License-Identifier: EPL-1.0
577 ##############################################################################
578 # Copyright (c) 2017 The Linux Foundation and others.
580 # All rights reserved. This program and the accompanying materials
581 # are made available under the terms of the Eclipse Public License v1.0
582 # which accompanies this distribution, and is available at
583 # http://www.eclipse.org/legal/epl-v10.html
584 ##############################################################################
586 # Clear log credential files
587 rm "$SETTINGS_FILE"
590 </hudson.tasks.Shell>
591 <hudson.plugins.descriptionsetter.DescriptionSetterBuilder>
592 <regexp>^Build logs: .*</regexp>
593 </hudson.plugins.descriptionsetter.DescriptionSetterBuilder>
595 <scriptOnlyIfSuccess>false</scriptOnlyIfSuccess>
596 <scriptOnlyIfFailure>false</scriptOnlyIfFailure>
597 <markBuildUnstable>false</markBuildUnstable>
598 </org.jenkinsci.plugins.postbuildscript.PostBuildScript>
599 <hudson.plugins.ws__cleanup.WsCleanup plugin="ws-cleanup">
601 <hudson.plugins.ws__cleanup.Pattern>
602 <pattern>**/*.jenkins-trigger</pattern>
604 </hudson.plugins.ws__cleanup.Pattern>
606 <deleteDirs>false</deleteDirs>
607 <cleanupMatrixParent>false</cleanupMatrixParent>
609 <cleanWhenSuccess>true</cleanWhenSuccess>
610 <cleanWhenUnstable>true</cleanWhenUnstable>
611 <cleanWhenFailure>true</cleanWhenFailure>
612 <cleanWhenNotBuilt>true</cleanWhenNotBuilt>
613 <cleanWhenAborted>true</cleanWhenAborted>
614 <notFailBuild>true</notFailBuild>
615 </hudson.plugins.ws__cleanup.WsCleanup>
618 <com.michelin.cio.hudson.plugins.maskpasswords.MaskPasswordsBuildWrapper/>
619 <hudson.plugins.build__timeout.BuildTimeoutWrapper>
620 <timeoutMinutes>10</timeoutMinutes>
621 <timeoutEnvVar>BUILD_TIMEOUT</timeoutEnvVar>
622 <failBuild>true</failBuild>
623 <writingDescription>false</writingDescription>
624 <timeoutPercentage>0</timeoutPercentage>
625 <timeoutMinutesElasticDefault>3</timeoutMinutesElasticDefault>
626 <timeoutType>absolute</timeoutType>
627 </hudson.plugins.build__timeout.BuildTimeoutWrapper>
628 <hudson.plugins.timestamper.TimestamperBuildWrapper/>
629 <com.cloudbees.jenkins.plugins.sshagent.SSHAgentBuildWrapper>
630 <user>test-credential</user>
631 </com.cloudbees.jenkins.plugins.sshagent.SSHAgentBuildWrapper>
632 <jenkins.plugins.openstack.compute.JCloudsOneOffSlave/>
633 <org.jenkinsci.plugins.configfiles.buildwrapper.ConfigFileBuildWrapper plugin="config-file-provider">
635 <org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
636 <fileId>npmrc</fileId>
637 <targetLocation>$HOME/.npmrc</targetLocation>
639 </org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
641 </org.jenkinsci.plugins.configfiles.buildwrapper.ConfigFileBuildWrapper>