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>
105 <buildChooser class="com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.GerritTriggerBuildChooser"/>
106 <doGenerateSubmoduleConfigurations>false</doGenerateSubmoduleConfigurations>
107 <authorOrCommitter>false</authorOrCommitter>
108 <wipeOutWorkspace>true</wipeOutWorkspace>
109 <pruneBranches>false</pruneBranches>
110 <remotePoll>false</remotePoll>
111 <gitTool>Default</gitTool>
112 <submoduleCfg class="list"/>
117 <skipTag>true</skipTag>
119 <useShallowClone>false</useShallowClone>
120 <ignoreNotifyCommit>false</ignoreNotifyCommit>
122 <hudson.plugins.git.extensions.impl.SubmoduleOption>
123 <disableSubmodules>false</disableSubmodules>
124 <recursiveSubmodules>true</recursiveSubmodules>
125 <trackingSubmodules>false</trackingSubmodules>
127 <timeout>10</timeout>
128 </hudson.plugins.git.extensions.impl.SubmoduleOption>
129 <hudson.plugins.git.extensions.impl.WipeWorkspace/>
132 <triggers class="vector">
133 <com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.GerritTrigger>
136 <com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.data.GerritProject>
137 <compareType>ANT</compareType>
138 <pattern>releng/ciman</pattern>
140 <com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.data.Branch>
141 <compareType>ANT</compareType>
142 <pattern>**/master</pattern>
143 </com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.data.Branch>
146 <com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.data.FilePath>
147 <compareType>ANT</compareType>
148 <pattern>{node-dir}/**</pattern>
149 </com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.data.FilePath>
151 <disableStrictForbiddenFileVerification>false</disableStrictForbiddenFileVerification>
152 </com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.data.GerritProject>
155 <onSuccessful>false</onSuccessful>
156 <onFailed>false</onFailed>
157 <onUnstable>false</onUnstable>
158 <onNotBuilt>false</onNotBuilt>
160 <silentMode>false</silentMode>
161 <silentStartMode>false</silentStartMode>
162 <escapeQuotes>true</escapeQuotes>
163 <noNameAndEmailParameters>false</noNameAndEmailParameters>
164 <readableMessage>false</readableMessage>
165 <dependencyJobsNames/>
167 <dynamicTriggerConfiguration>False</dynamicTriggerConfiguration>
169 <allowTriggeringUnreviewedPatches>false</allowTriggeringUnreviewedPatches>
171 <com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.events.PluginPatchsetCreatedEvent>
172 <excludeDrafts>false</excludeDrafts>
173 <excludeTrivialRebase>false</excludeTrivialRebase>
174 <excludeNoCodeChange>false</excludeNoCodeChange>
175 </com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.events.PluginPatchsetCreatedEvent>
176 <com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.events.PluginDraftPublishedEvent/>
177 <com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.events.PluginCommentAddedContainsEvent>
178 <commentAddedCommentContains>recheck$</commentAddedCommentContains>
179 </com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.events.PluginCommentAddedContainsEvent>
182 <buildFailureMessage/>
183 <buildSuccessfulMessage/>
184 <buildUnstableMessage/>
185 <buildNotBuiltMessage/>
186 <buildUnsuccessfulFilepath/>
188 <serverName>test-server</serverName>
189 </com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.GerritTrigger>
194 # SPDX-License-Identifier: EPL-1.0
195 ##############################################################################
196 # Copyright (c) 2017 The Linux Foundation and others.
198 # All rights reserved. This program and the accompanying materials
199 # are made available under the terms of the Eclipse Public License v1.0
200 # which accompanies this distribution, and is available at
201 # http://www.eclipse.org/legal/epl-v10.html
202 ##############################################################################
203 echo "---> node-install.sh"
205 # Ensure we fail the job if any steps fail.
206 # DO NOT set -u as virtualenv's activate script has unbound variables
209 virtualenv --quiet "/tmp/v/python"
210 # shellcheck source=/tmp/v/node/bin/activate disable=SC1091
211 source "/tmp/v/python/bin/activate"
212 pip install --quiet --upgrade pip
213 pip install --quiet --upgrade pipdeptree
214 pip install --quiet --upgrade nodeenv
216 echo "----> Pip Dependency Tree"
220 # SPDX-License-Identifier: EPL-1.0
221 ##############################################################################
222 # Copyright (c) 2017 The Linux Foundation and others.
224 # All rights reserved. This program and the accompanying materials
225 # are made available under the terms of the Eclipse Public License v1.0
226 # which accompanies this distribution, and is available at
227 # http://www.eclipse.org/legal/epl-v10.html
228 ##############################################################################
229 echo "---> node-run.sh"
231 # Ensure we fail the job if any steps fail.
232 # DO NOT set -u as virtualenv's activate script has unbound variables
236 nodeenv --node="$NODE_VERSION" --prebuilt "/tmp/v/node"
237 source /tmp/v/node/bin/activate
238 cd "$WORKSPACE/$NODE_DIR"
242 </hudson.tasks.Shell>
245 <org.jenkinsci.plugins.postbuildscript.PostBuildScript>
249 # SPDX-License-Identifier: EPL-1.0
250 ##############################################################################
251 # Copyright (c) 2017 The Linux Foundation and others.
253 # All rights reserved. This program and the accompanying materials
254 # are made available under the terms of the Eclipse Public License v1.0
255 # which accompanies this distribution, and is available at
256 # http://www.eclipse.org/legal/epl-v10.html
257 ##############################################################################
258 echo "---> sysstat.sh"
259 set +e # DON'T fail build if script fails.
261 OS=$(facter operatingsystem)
262 case "$OS" in
264 SYSSTAT_PATH="/var/log/sysstat"
266 # Dont run the script when systat is not enabled by default
267 if ! grep --quiet 'ENABLED="true"' "/etc/default/sysstat"; then
272 SYSSTAT_PATH="/var/log/sa"
280 SAR_DIR="$WORKSPACE/archives/sar-reports"
281 mkdir -p "$SAR_DIR"
282 cp "$SYSSTAT_PATH/"* "$_"
283 # convert sar data to ascii format
284 while IFS="" read -r s
286 [ -f "$s" ] && LC_TIME=POSIX sar -A -f "$s" > "$SAR_DIR/sar${s//[!0-9]/}"
287 done < <(find "$SYSSTAT_PATH" -name "sa[0-9]*" || true)
289 # DON'T fail build if script fails.
292 </hudson.tasks.Shell>
293 <org.jenkinsci.plugins.configfiles.builder.ConfigFileBuildStep plugin="config-file-provider">
295 <org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
296 <fileId>jenkins-log-archives-settings</fileId>
298 <variable>SETTINGS_FILE</variable>
299 </org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
301 </org.jenkinsci.plugins.configfiles.builder.ConfigFileBuildStep>
304 <propertiesContent>SERVER_ID=logs</propertiesContent>
309 # SPDX-License-Identifier: EPL-1.0
310 ##############################################################################
311 # Copyright (c) 2017 The Linux Foundation and others.
313 # All rights reserved. This program and the accompanying materials
314 # are made available under the terms of the Eclipse Public License v1.0
315 # which accompanies this distribution, and is available at
316 # http://www.eclipse.org/legal/epl-v10.html
317 ##############################################################################
318 echo "---> create-netrc.sh"
320 # Ensure we fail the job if any steps fail.
323 NEXUS_URL="${NEXUSPROXY:-$NEXUS_URL}"
324 CREDENTIAL=$(xmlstarlet sel -N "x=http://maven.apache.org/SETTINGS/1.0.0" \
325 -t -m "/x:settings/x:servers/x:server[x:id='${SERVER_ID}']" \
326 -v x:username -o ":" -v x:password \
327 "$SETTINGS_FILE")
329 machine=$(echo "$NEXUS_URL" | awk -F/ '{print $3}')
330 user=$(echo "$CREDENTIAL" | cut -f1 -d:)
331 pass=$(echo "$CREDENTIAL" | cut -f2 -d:)
333 echo "machine ${machine%:*} login $user password $pass" > ~/.netrc
335 </hudson.tasks.Shell>
338 # SPDX-License-Identifier: EPL-1.0
339 ##############################################################################
340 # Copyright (c) 2017 The Linux Foundation and others.
342 # All rights reserved. This program and the accompanying materials
343 # are made available under the terms of the Eclipse Public License v1.0
344 # which accompanies this distribution, and is available at
345 # http://www.eclipse.org/legal/epl-v10.html
346 ##############################################################################
347 echo "---> lftools-install.sh"
349 # Script to install lftools via a version passed in via lf-infra-parameters
351 # Required parameters:
353 # LFTOOLS_VERSION: Passed in via lf-infra-parameters configuration. Can be
354 # set to a strict version number like '1.2.3' or using
355 # PEP-440 definitions.
359 # >=1.0.0,<2.0.0
361 # By default a released version of lftools should always be used.
362 # The purpose of the 2 variables below is so that lftools devs can test
363 # unreleased versions of lftools. There are 2 methods to install a dev version
366 # 1) gerrit patch: Used to test a patch that has not yet been merged.
367 # To do this set something like this:
368 # LFTOOLS_MODE=gerrit
369 # LFTOOLS_REFSPEC=refs/changes/96/5296/7
371 # 2) git branch: Used to install an lftools version from a specific branch.
372 # To use this set the variables as follows:
374 # LFTOOLS_REFSPEC=master
376 # 3) release : The intended use case and default setting.
377 # Set LFTOOLS_MODE=release, in this case LFTOOLS_REFSPEC is unused.
379 LFTOOLS_MODE=release # release | git | gerrit
380 LFTOOLS_REFSPEC=master
382 # Ensure we fail the job if any steps fail.
383 # DO NOT set -u as virtualenv's activate script has unbound variables
386 virtualenv --quiet "/tmp/v/lftools"
387 # shellcheck source=/tmp/v/lftools/bin/activate disable=SC1091
388 source "/tmp/v/lftools/bin/activate"
389 pip install --quiet --upgrade pip
391 case $LFTOOLS_MODE in
393 git clone https://gerrit.linuxfoundation.org/infra/releng/lftools.git /tmp/lftools
395 git fetch origin "$LFTOOLS_REFSPEC"
396 git checkout FETCH_HEAD
397 pip install --quiet --upgrade -r requirements.txt
398 pip install --quiet --upgrade -e .
403 pip install --quiet --upgrade git+https://gerrit.linuxfoundation.org/infra/releng/lftools.git@"$BRANCH"
407 if [[ $LFTOOLS_VERSION =~ ^[0-9] ]]; then
408 LFTOOLS_VERSION="==$LFTOOLS_VERSION"
411 pip install --quiet --upgrade "lftools${LFTOOLS_VERSION}"
417 # pipdeptree prints out a lot of information because lftools pulls in many
418 # dependencies. Let's only print it if we want to debug.
419 # echo "----> Pip Dependency Tree"
420 # pip install --quiet --upgrade pipdeptree
424 # SPDX-License-Identifier: EPL-1.0
425 ##############################################################################
426 # Copyright (c) 2017 The Linux Foundation and others.
428 # All rights reserved. This program and the accompanying materials
429 # are made available under the terms of the Eclipse Public License v1.0
430 # which accompanies this distribution, and is available at
431 # http://www.eclipse.org/legal/epl-v10.html
432 ##############################################################################
433 echo "---> logs-deploy.sh"
435 # Ensure we fail the job if any steps fail.
438 set -x # Trace commands for this script to make debugging easier.
440 ARCHIVE_ARTIFACTS="${ARCHIVE_ARTIFACTS:-}"
441 LOGS_SERVER="${LOGS_SERVER:-None}"
443 if [ "${LOGS_SERVER}" == 'None' ]
445 set +x # Disable trace since we no longer need it
447 echo "WARNING: Logging server not set"
449 NEXUS_URL="${NEXUSPROXY:-$NEXUS_URL}"
450 NEXUS_PATH="${SILO}/${JENKINS_HOSTNAME}/${JOB_NAME}/${BUILD_NUMBER}"
451 BUILD_URL="${BUILD_URL}"
453 lftools deploy archives -p "$ARCHIVE_ARTIFACTS" "$NEXUS_URL" "$NEXUS_PATH" "$WORKSPACE"
454 lftools deploy logs "$NEXUS_URL" "$NEXUS_PATH" "$BUILD_URL"
456 set +x # Disable trace since we no longer need it.
458 echo "Build logs: <a href=\"$LOGS_SERVER/$NEXUS_PATH\">$LOGS_SERVER/$NEXUS_PATH</a>"
461 </hudson.tasks.Shell>
464 # SPDX-License-Identifier: EPL-1.0
465 ##############################################################################
466 # Copyright (c) 2017 The Linux Foundation and others.
468 # All rights reserved. This program and the accompanying materials
469 # are made available under the terms of the Eclipse Public License v1.0
470 # which accompanies this distribution, and is available at
471 # http://www.eclipse.org/legal/epl-v10.html
472 ##############################################################################
474 # Clear log credential files
475 rm "$SETTINGS_FILE"
478 </hudson.tasks.Shell>
479 <hudson.plugins.descriptionsetter.DescriptionSetterBuilder>
480 <regexp>^Build logs: .*</regexp>
481 </hudson.plugins.descriptionsetter.DescriptionSetterBuilder>
483 <scriptOnlyIfSuccess>false</scriptOnlyIfSuccess>
484 <scriptOnlyIfFailure>false</scriptOnlyIfFailure>
485 <markBuildUnstable>false</markBuildUnstable>
486 </org.jenkinsci.plugins.postbuildscript.PostBuildScript>
487 <hudson.plugins.ws__cleanup.WsCleanup plugin="ws-cleanup">
489 <hudson.plugins.ws__cleanup.Pattern>
490 <pattern>**/*.jenkins-trigger</pattern>
492 </hudson.plugins.ws__cleanup.Pattern>
494 <deleteDirs>false</deleteDirs>
495 <cleanupMatrixParent>false</cleanupMatrixParent>
497 <cleanWhenSuccess>true</cleanWhenSuccess>
498 <cleanWhenUnstable>true</cleanWhenUnstable>
499 <cleanWhenFailure>true</cleanWhenFailure>
500 <cleanWhenNotBuilt>true</cleanWhenNotBuilt>
501 <cleanWhenAborted>true</cleanWhenAborted>
502 <notFailBuild>true</notFailBuild>
503 </hudson.plugins.ws__cleanup.WsCleanup>
506 <com.michelin.cio.hudson.plugins.maskpasswords.MaskPasswordsBuildWrapper/>
507 <hudson.plugins.build__timeout.BuildTimeoutWrapper>
508 <timeoutMinutes>10</timeoutMinutes>
509 <timeoutEnvVar>BUILD_TIMEOUT</timeoutEnvVar>
510 <failBuild>true</failBuild>
511 <writingDescription>false</writingDescription>
512 <timeoutPercentage>0</timeoutPercentage>
513 <timeoutMinutesElasticDefault>3</timeoutMinutesElasticDefault>
514 <timeoutType>absolute</timeoutType>
515 </hudson.plugins.build__timeout.BuildTimeoutWrapper>
516 <hudson.plugins.timestamper.TimestamperBuildWrapper/>
517 <com.cloudbees.jenkins.plugins.sshagent.SSHAgentBuildWrapper>
518 <user>test-credential</user>
519 </com.cloudbees.jenkins.plugins.sshagent.SSHAgentBuildWrapper>
520 <jenkins.plugins.openstack.compute.JCloudsOneOffSlave/>
521 <org.jenkinsci.plugins.configfiles.buildwrapper.ConfigFileBuildWrapper plugin="config-file-provider">
523 <org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
524 <fileId>npmrc</fileId>
525 <targetLocation>$HOME/.npmrc</targetLocation>
527 </org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
529 </org.jenkinsci.plugins.configfiles.buildwrapper.ConfigFileBuildWrapper>