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 a Node project directory.</description>
80 </hudson.model.StringParameterDefinition>
81 <hudson.model.StringParameterDefinition>
82 <name>NODE_VERSION</name>
83 <description>Version of NodeJS to install.</description>
84 <defaultValue>6.11.4</defaultValue>
85 </hudson.model.StringParameterDefinition>
86 </parameterDefinitions>
87 </hudson.model.ParametersDefinitionProperty>
89 <scm class="hudson.plugins.git.GitSCM">
90 <configVersion>2</configVersion>
92 <hudson.plugins.git.UserRemoteConfig>
94 <refspec>$GERRIT_REFSPEC</refspec>
95 <url>$GIT_URL/$GERRIT_PROJECT</url>
96 <credentialsId>test-credential</credentialsId>
97 </hudson.plugins.git.UserRemoteConfig>
100 <hudson.plugins.git.BranchSpec>
101 <name>refs/heads/origin/$GERRIT_BRANCH</name>
102 </hudson.plugins.git.BranchSpec>
104 <doGenerateSubmoduleConfigurations>false</doGenerateSubmoduleConfigurations>
105 <remotePoll>false</remotePoll>
106 <gitTool>Default</gitTool>
107 <submoduleCfg class="list"/>
112 <hudson.plugins.git.extensions.impl.BuildChooserSetting>
113 <buildChooser class="com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.GerritTriggerBuildChooser"/>
114 </hudson.plugins.git.extensions.impl.BuildChooserSetting>
115 <hudson.plugins.git.extensions.impl.SubmoduleOption>
116 <disableSubmodules>false</disableSubmodules>
117 <recursiveSubmodules>true</recursiveSubmodules>
118 <trackingSubmodules>false</trackingSubmodules>
119 <parentCredentials>false</parentCredentials>
121 <timeout>10</timeout>
122 </hudson.plugins.git.extensions.impl.SubmoduleOption>
123 <hudson.plugins.git.extensions.impl.WipeWorkspace/>
126 <triggers class="vector">
127 <com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.GerritTrigger>
130 <com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.data.GerritProject>
131 <compareType>ANT</compareType>
132 <pattern>releng/ciman</pattern>
134 <com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.data.Branch>
135 <compareType>ANT</compareType>
136 <pattern>**/master</pattern>
137 </com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.data.Branch>
140 <com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.data.FilePath>
141 <compareType>ANT</compareType>
142 <pattern>{node-dir}/**</pattern>
143 </com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.data.FilePath>
145 <disableStrictForbiddenFileVerification>false</disableStrictForbiddenFileVerification>
146 </com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.data.GerritProject>
149 <onSuccessful>false</onSuccessful>
150 <onFailed>false</onFailed>
151 <onUnstable>false</onUnstable>
152 <onNotBuilt>false</onNotBuilt>
154 <silentMode>false</silentMode>
155 <silentStartMode>false</silentStartMode>
156 <escapeQuotes>true</escapeQuotes>
157 <noNameAndEmailParameters>false</noNameAndEmailParameters>
158 <readableMessage>false</readableMessage>
159 <dependencyJobsNames/>
161 <dynamicTriggerConfiguration>False</dynamicTriggerConfiguration>
163 <allowTriggeringUnreviewedPatches>false</allowTriggeringUnreviewedPatches>
165 <com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.events.PluginPatchsetCreatedEvent>
166 <excludeDrafts>false</excludeDrafts>
167 <excludeTrivialRebase>false</excludeTrivialRebase>
168 <excludeNoCodeChange>false</excludeNoCodeChange>
169 </com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.events.PluginPatchsetCreatedEvent>
170 <com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.events.PluginDraftPublishedEvent/>
171 <com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.events.PluginCommentAddedContainsEvent>
172 <commentAddedCommentContains>recheck$</commentAddedCommentContains>
173 </com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.events.PluginCommentAddedContainsEvent>
176 <buildFailureMessage/>
177 <buildSuccessfulMessage/>
178 <buildUnstableMessage/>
179 <buildNotBuiltMessage/>
180 <buildUnsuccessfulFilepath/>
182 <serverName>test-server</serverName>
183 </com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.GerritTrigger>
188 # SPDX-License-Identifier: EPL-1.0
189 ##############################################################################
190 # Copyright (c) 2017 The Linux Foundation and others.
192 # All rights reserved. This program and the accompanying materials
193 # are made available under the terms of the Eclipse Public License v1.0
194 # which accompanies this distribution, and is available at
195 # http://www.eclipse.org/legal/epl-v10.html
196 ##############################################################################
197 echo "---> node-install.sh"
199 # Ensure we fail the job if any steps fail.
200 # DO NOT set -u as virtualenv's activate script has unbound variables
203 virtualenv --quiet "/tmp/v/python"
204 # shellcheck source=/tmp/v/node/bin/activate disable=SC1091
205 source "/tmp/v/python/bin/activate"
206 pip install --quiet --upgrade pip
207 pip install --quiet --upgrade pipdeptree
208 pip install --quiet --upgrade nodeenv
210 echo "----> Pip Dependency Tree"
214 # SPDX-License-Identifier: EPL-1.0
215 ##############################################################################
216 # Copyright (c) 2017 The Linux Foundation and others.
218 # All rights reserved. This program and the accompanying materials
219 # are made available under the terms of the Eclipse Public License v1.0
220 # which accompanies this distribution, and is available at
221 # http://www.eclipse.org/legal/epl-v10.html
222 ##############################################################################
223 echo "---> node-run.sh"
225 # Ensure we fail the job if any steps fail.
226 # DO NOT set -u as virtualenv's activate script has unbound variables
230 nodeenv --node="$NODE_VERSION" --prebuilt "/tmp/v/node"
231 source /tmp/v/node/bin/activate
232 cd "$WORKSPACE/$NODE_DIR"
236 </hudson.tasks.Shell>
239 <org.jenkinsci.plugins.postbuildscript.PostBuildScript>
243 # SPDX-License-Identifier: EPL-1.0
244 ##############################################################################
245 # Copyright (c) 2017 The Linux Foundation and others.
247 # All rights reserved. This program and the accompanying materials
248 # are made available under the terms of the Eclipse Public License v1.0
249 # which accompanies this distribution, and is available at
250 # http://www.eclipse.org/legal/epl-v10.html
251 ##############################################################################
252 echo "---> sysstat.sh"
253 set +e # DON'T fail build if script fails.
255 OS=$(facter operatingsystem)
256 case "$OS" in
258 SYSSTAT_PATH="/var/log/sysstat"
260 # Dont run the script when systat is not enabled by default
261 if ! grep --quiet 'ENABLED="true"' "/etc/default/sysstat"; then
266 SYSSTAT_PATH="/var/log/sa"
274 SAR_DIR="$WORKSPACE/archives/sar-reports"
275 mkdir -p "$SAR_DIR"
276 cp "$SYSSTAT_PATH/"* "$_"
277 # convert sar data to ascii format
278 while IFS="" read -r sarfilenum
280 [ -f "$sarfilenum" ] && LC_TIME=POSIX sar -A -f "$sarfilenum" > "$SAR_DIR/sar${sarfilenum//[!0-9]/}"
281 done < <(find "$SYSSTAT_PATH" -name "sa[0-9]*" || true)
283 # DON'T fail build if script fails.
286 </hudson.tasks.Shell>
287 <org.jenkinsci.plugins.configfiles.builder.ConfigFileBuildStep plugin="config-file-provider">
289 <org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
290 <fileId>jenkins-log-archives-settings</fileId>
292 <variable>SETTINGS_FILE</variable>
293 </org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
295 </org.jenkinsci.plugins.configfiles.builder.ConfigFileBuildStep>
298 <propertiesContent>SERVER_ID=logs</propertiesContent>
303 # SPDX-License-Identifier: EPL-1.0
304 ##############################################################################
305 # Copyright (c) 2017 The Linux Foundation and others.
307 # All rights reserved. This program and the accompanying materials
308 # are made available under the terms of the Eclipse Public License v1.0
309 # which accompanies this distribution, and is available at
310 # http://www.eclipse.org/legal/epl-v10.html
311 ##############################################################################
312 echo "---> create-netrc.sh"
314 # Ensure we fail the job if any steps fail.
317 NEXUS_URL="${NEXUSPROXY:-$NEXUS_URL}"
318 CREDENTIAL=$(xmlstarlet sel -N "x=http://maven.apache.org/SETTINGS/1.0.0" \
319 -t -m "/x:settings/x:servers/x:server[x:id='${SERVER_ID}']" \
320 -v x:username -o ":" -v x:password \
321 "$SETTINGS_FILE")
323 machine=$(echo "$NEXUS_URL" | awk -F/ '{print $3}')
324 user=$(echo "$CREDENTIAL" | cut -f1 -d:)
325 pass=$(echo "$CREDENTIAL" | cut -f2 -d:)
327 echo "machine ${machine%:*} login $user password $pass" > ~/.netrc
329 </hudson.tasks.Shell>
332 # SPDX-License-Identifier: EPL-1.0
333 ##############################################################################
334 # Copyright (c) 2017 The Linux Foundation and others.
336 # All rights reserved. This program and the accompanying materials
337 # are made available under the terms of the Eclipse Public License v1.0
338 # which accompanies this distribution, and is available at
339 # http://www.eclipse.org/legal/epl-v10.html
340 ##############################################################################
341 echo "---> lftools-install.sh"
343 # Script to install lftools via a version passed in via lf-infra-parameters
345 # Required parameters:
347 # LFTOOLS_VERSION: Passed in via lf-infra-parameters configuration. Can be
348 # set to a strict version number like '1.2.3' or using
349 # PEP-440 definitions.
353 # >=1.0.0,<2.0.0
355 # By default a released version of lftools should always be used.
356 # The purpose of the 2 variables below is so that lftools devs can test
357 # unreleased versions of lftools. There are 2 methods to install a dev version
360 # 1) gerrit patch: Used to test a patch that has not yet been merged.
361 # To do this set something like this:
362 # LFTOOLS_MODE=gerrit
363 # LFTOOLS_REFSPEC=refs/changes/96/5296/7
365 # 2) git branch: Used to install an lftools version from a specific branch.
366 # To use this set the variables as follows:
368 # LFTOOLS_REFSPEC=master
370 # 3) release : The intended use case and default setting.
371 # Set LFTOOLS_MODE=release, in this case LFTOOLS_REFSPEC is unused.
373 LFTOOLS_MODE=release # release | git | gerrit
374 LFTOOLS_REFSPEC=master
376 # Ensure we fail the job if any steps fail.
377 # DO NOT set -u as virtualenv's activate script has unbound variables
380 virtualenv --quiet "/tmp/v/lftools"
381 # shellcheck source=/tmp/v/lftools/bin/activate disable=SC1091
382 source "/tmp/v/lftools/bin/activate"
383 pip install --quiet --upgrade pip
385 case $LFTOOLS_MODE in
387 git clone https://gerrit.linuxfoundation.org/infra/releng/lftools.git /tmp/lftools
389 git fetch origin "$LFTOOLS_REFSPEC"
390 git checkout FETCH_HEAD
391 pip install --quiet --upgrade -r requirements.txt
392 pip install --quiet --upgrade -e .
397 pip install --quiet --upgrade git+https://gerrit.linuxfoundation.org/infra/releng/lftools.git@"$BRANCH"
401 if [[ $LFTOOLS_VERSION =~ ^[0-9] ]]; then
402 LFTOOLS_VERSION="==$LFTOOLS_VERSION"
405 pip install --quiet --upgrade "lftools${LFTOOLS_VERSION}"
411 # pipdeptree prints out a lot of information because lftools pulls in many
412 # dependencies. Let's only print it if we want to debug.
413 # echo "----> Pip Dependency Tree"
414 # pip install --quiet --upgrade pipdeptree
418 # SPDX-License-Identifier: EPL-1.0
419 ##############################################################################
420 # Copyright (c) 2017 The Linux Foundation and others.
422 # All rights reserved. This program and the accompanying materials
423 # are made available under the terms of the Eclipse Public License v1.0
424 # which accompanies this distribution, and is available at
425 # http://www.eclipse.org/legal/epl-v10.html
426 ##############################################################################
427 echo "---> logs-deploy.sh"
429 # Ensure we fail the job if any steps fail.
432 set -x # Trace commands for this script to make debugging easier.
434 ARCHIVE_ARTIFACTS="${ARCHIVE_ARTIFACTS:-}"
435 LOGS_SERVER="${LOGS_SERVER:-None}"
437 if [ "${LOGS_SERVER}" == 'None' ]
439 set +x # Disable trace since we no longer need it
441 echo "WARNING: Logging server not set"
443 NEXUS_URL="${NEXUSPROXY:-$NEXUS_URL}"
444 NEXUS_PATH="${SILO}/${JENKINS_HOSTNAME}/${JOB_NAME}/${BUILD_NUMBER}"
445 BUILD_URL="${BUILD_URL}"
447 lftools deploy archives -p "$ARCHIVE_ARTIFACTS" "$NEXUS_URL" "$NEXUS_PATH" "$WORKSPACE"
448 lftools deploy logs "$NEXUS_URL" "$NEXUS_PATH" "$BUILD_URL"
450 set +x # Disable trace since we no longer need it.
452 echo "Build logs: <a href=\"$LOGS_SERVER/$NEXUS_PATH\">$LOGS_SERVER/$NEXUS_PATH</a>"
455 </hudson.tasks.Shell>
458 # SPDX-License-Identifier: EPL-1.0
459 ##############################################################################
460 # Copyright (c) 2017 The Linux Foundation and others.
462 # All rights reserved. This program and the accompanying materials
463 # are made available under the terms of the Eclipse Public License v1.0
464 # which accompanies this distribution, and is available at
465 # http://www.eclipse.org/legal/epl-v10.html
466 ##############################################################################
468 # Clear log credential files
469 rm "$SETTINGS_FILE"
472 </hudson.tasks.Shell>
473 <hudson.plugins.descriptionsetter.DescriptionSetterBuilder>
474 <regexp>^Build logs: .*</regexp>
475 </hudson.plugins.descriptionsetter.DescriptionSetterBuilder>
477 <scriptOnlyIfSuccess>false</scriptOnlyIfSuccess>
478 <scriptOnlyIfFailure>false</scriptOnlyIfFailure>
479 <markBuildUnstable>false</markBuildUnstable>
480 </org.jenkinsci.plugins.postbuildscript.PostBuildScript>
481 <hudson.plugins.ws__cleanup.WsCleanup plugin="ws-cleanup">
483 <hudson.plugins.ws__cleanup.Pattern>
484 <pattern>**/*.jenkins-trigger</pattern>
486 </hudson.plugins.ws__cleanup.Pattern>
488 <deleteDirs>false</deleteDirs>
489 <cleanupMatrixParent>false</cleanupMatrixParent>
491 <cleanWhenSuccess>true</cleanWhenSuccess>
492 <cleanWhenUnstable>true</cleanWhenUnstable>
493 <cleanWhenFailure>true</cleanWhenFailure>
494 <cleanWhenNotBuilt>true</cleanWhenNotBuilt>
495 <cleanWhenAborted>true</cleanWhenAborted>
496 <notFailBuild>true</notFailBuild>
497 </hudson.plugins.ws__cleanup.WsCleanup>
500 <com.michelin.cio.hudson.plugins.maskpasswords.MaskPasswordsBuildWrapper/>
501 <hudson.plugins.build__timeout.BuildTimeoutWrapper>
502 <timeoutMinutes>10</timeoutMinutes>
503 <timeoutEnvVar>BUILD_TIMEOUT</timeoutEnvVar>
504 <failBuild>true</failBuild>
505 <writingDescription>false</writingDescription>
506 <timeoutPercentage>0</timeoutPercentage>
507 <timeoutMinutesElasticDefault>3</timeoutMinutesElasticDefault>
508 <timeoutType>absolute</timeoutType>
509 </hudson.plugins.build__timeout.BuildTimeoutWrapper>
510 <hudson.plugins.timestamper.TimestamperBuildWrapper/>
511 <com.cloudbees.jenkins.plugins.sshagent.SSHAgentBuildWrapper>
512 <user>test-credential</user>
513 </com.cloudbees.jenkins.plugins.sshagent.SSHAgentBuildWrapper>
514 <jenkins.plugins.openstack.compute.JCloudsOneOffSlave/>
515 <org.jenkinsci.plugins.configfiles.buildwrapper.ConfigFileBuildWrapper plugin="config-file-provider">
517 <org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
518 <fileId>npmrc</fileId>
519 <targetLocation>$HOME/.npmrc</targetLocation>
521 </org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
523 </org.jenkinsci.plugins.configfiles.buildwrapper.ConfigFileBuildWrapper>