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.
66 </hudson.model.StringParameterDefinition>
67 <hudson.model.StringParameterDefinition>
68 <name>PACKER_VERSION</name>
69 <description>Packer version to download and install.</description>
70 <defaultValue>1.0.2</defaultValue>
71 </hudson.model.StringParameterDefinition>
72 </parameterDefinitions>
73 </hudson.model.ParametersDefinitionProperty>
75 <scm class="hudson.plugins.git.GitSCM">
76 <configVersion>2</configVersion>
78 <hudson.plugins.git.UserRemoteConfig>
80 <refspec>$GERRIT_REFSPEC</refspec>
81 <url>$GIT_URL/$GERRIT_PROJECT</url>
82 <credentialsId>test-credential</credentialsId>
83 </hudson.plugins.git.UserRemoteConfig>
86 <hudson.plugins.git.BranchSpec>
87 <name>refs/heads/$GERRIT_BRANCH</name>
88 </hudson.plugins.git.BranchSpec>
91 <buildChooser class="com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.GerritTriggerBuildChooser"/>
92 <doGenerateSubmoduleConfigurations>false</doGenerateSubmoduleConfigurations>
93 <authorOrCommitter>false</authorOrCommitter>
94 <wipeOutWorkspace>true</wipeOutWorkspace>
95 <pruneBranches>false</pruneBranches>
96 <remotePoll>false</remotePoll>
97 <gitTool>Default</gitTool>
98 <submoduleCfg class="list"/>
103 <skipTag>true</skipTag>
105 <useShallowClone>false</useShallowClone>
106 <ignoreNotifyCommit>false</ignoreNotifyCommit>
108 <hudson.plugins.git.extensions.impl.SubmoduleOption>
109 <disableSubmodules>false</disableSubmodules>
110 <recursiveSubmodules>true</recursiveSubmodules>
111 <trackingSubmodules>false</trackingSubmodules>
113 <timeout>10</timeout>
114 </hudson.plugins.git.extensions.impl.SubmoduleOption>
115 <hudson.plugins.git.extensions.impl.WipeWorkspace/>
118 <triggers class="vector">
119 <com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.GerritTrigger>
122 <com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.data.GerritProject>
123 <compareType>ANT</compareType>
124 <pattern>releng/ciman</pattern>
126 <com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.data.Branch>
127 <compareType>ANT</compareType>
128 <pattern>**/master</pattern>
129 </com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.data.Branch>
132 <com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.data.FilePath>
133 <compareType>ANT</compareType>
134 <pattern>packer/vars/['centos', 'ubuntu1604'].json</pattern>
135 </com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.data.FilePath>
136 <com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.data.FilePath>
137 <compareType>ANT</compareType>
138 <pattern>packer/templates/['java-builder', 'mininet'].json</pattern>
139 </com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.data.FilePath>
140 <com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.data.FilePath>
141 <compareType>ANT</compareType>
142 <pattern>packer/provision/['java-builder', 'mininet'].sh</pattern>
143 </com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.data.FilePath>
144 <com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.data.FilePath>
145 <compareType>ANT</compareType>
146 <pattern>packer/provision/lib/**</pattern>
147 </com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.data.FilePath>
149 <disableStrictForbiddenFileVerification>false</disableStrictForbiddenFileVerification>
150 </com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.data.GerritProject>
153 <onSuccessful>false</onSuccessful>
154 <onFailed>false</onFailed>
155 <onUnstable>false</onUnstable>
156 <onNotBuilt>false</onNotBuilt>
158 <silentMode>false</silentMode>
159 <silentStartMode>false</silentStartMode>
160 <escapeQuotes>true</escapeQuotes>
161 <noNameAndEmailParameters>false</noNameAndEmailParameters>
162 <readableMessage>false</readableMessage>
163 <dependencyJobsNames/>
165 <dynamicTriggerConfiguration>False</dynamicTriggerConfiguration>
167 <allowTriggeringUnreviewedPatches>false</allowTriggeringUnreviewedPatches>
169 <com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.events.PluginPatchsetCreatedEvent>
170 <excludeDrafts>false</excludeDrafts>
171 <excludeTrivialRebase>false</excludeTrivialRebase>
172 <excludeNoCodeChange>false</excludeNoCodeChange>
173 </com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.events.PluginPatchsetCreatedEvent>
174 <com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.events.PluginDraftPublishedEvent/>
175 <com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.events.PluginCommentAddedContainsEvent>
176 <commentAddedCommentContains>recheck$</commentAddedCommentContains>
177 </com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.events.PluginCommentAddedContainsEvent>
180 <buildFailureMessage/>
181 <buildSuccessfulMessage/>
182 <buildUnstableMessage/>
183 <buildNotBuiltMessage/>
184 <buildUnsuccessfulFilepath/>
186 <serverName>test-server</serverName>
187 </com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.GerritTrigger>
190 <org.jenkinsci.plugins.configfiles.builder.ConfigFileBuildStep plugin="config-file-provider">
192 <org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
193 <fileId>ci-packer-cloud-env</fileId>
195 <variable>CLOUDENV</variable>
196 </org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
198 </org.jenkinsci.plugins.configfiles.builder.ConfigFileBuildStep>
201 <propertiesContent>PACKER_VERSION=1.0.2
207 # SPDX-License-Identifier: EPL-1.0
208 ##############################################################################
209 # Copyright (c) 2017 The Linux Foundation and others.
211 # All rights reserved. This program and the accompanying materials
212 # are made available under the terms of the Eclipse Public License v1.0
213 # which accompanies this distribution, and is available at
214 # http://www.eclipse.org/legal/epl-v10.html
215 ##############################################################################
216 echo "---> packer-install.sh"
217 # The script checks for the packer binaries and installs the binary
218 # if its not available
220 # $PACKER_VERSION : Define a packer version passed as job paramter
222 PACKER_VERSION="${PACKER_VERSION:-1.0.2}"
224 # Ensure we fail the job if any steps fail.
226 # Default packer binary made available on the build image
227 packer_bin="/usr/local/bin/packer.io"
229 if hash "$packer_bin" 2>/dev/null; then
230 echo "packer.io command is available."
232 echo "packer.io command not is available. Installing packer ..."
233 # Installs Hashicorp's Packer binary, required for verify & merge packer jobs
235 wget "https://releases.hashicorp.com/packer/${PACKER_VERSION}/packer_${PACKER_VERSION}_linux_amd64.zip"
236 mkdir -p "${WORKSPACE}/bin"
237 unzip "packer_${PACKER_VERSION}_linux_amd64.zip" -d ${WORKSPACE}/bin/
238 # rename packer to avoid conflict with binary in cracklib
239 mv ${WORKSPACE}/bin/packer "${WORKSPACE}/bin/packer.io"
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 "---> packer-validate.sh"
254 # The script validates an packers files.
256 # $CLOUDENV : Provides the cloud credential file.
258 # Ensure we fail the job if any steps fail.
261 PACKER_LOGS_DIR="$WORKSPACE/archives/packer"
262 mkdir -p "$PACKER_LOGS_DIR"
263 export PATH="${WORKSPACE}/bin:$PATH"
266 varfiles=(../packer/vars/*.json)
267 templates=(../packer/templates/*.json)
269 for varfile in "${varfiles[@]}"; do
270 for template in "${templates[@]}"; do
271 export PACKER_LOG="yes" && \
272 export PACKER_LOG_PATH="$PACKER_LOGS_DIR/packer-validate-${varfile##*/}-${template##*/}.log" && \
273 packer.io validate -var-file="$CLOUDENV" \
274 -var-file="$varfile" "$template"
275 if [ $? -ne 0 ]; then
281 </hudson.tasks.Shell>
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 "---> packer-clear-credentials.sh"
295 set +e # DO NOT cause build failure if any of the rm calls fail.
296 rm "$CLOUDENV"
299 </hudson.tasks.Shell>
302 <org.jenkinsci.plugins.postbuildscript.PostBuildScript>
306 # SPDX-License-Identifier: EPL-1.0
307 ##############################################################################
308 # Copyright (c) 2017 The Linux Foundation and others.
310 # All rights reserved. This program and the accompanying materials
311 # are made available under the terms of the Eclipse Public License v1.0
312 # which accompanies this distribution, and is available at
313 # http://www.eclipse.org/legal/epl-v10.html
314 ##############################################################################
315 echo "---> sysstat.sh"
316 set +e # DON'T fail build if script fails.
318 OS=$(facter operatingsystem)
319 case "$OS" in
321 SYSSTAT_PATH="/var/log/sysstat"
323 # Dont run the script when systat is not enabled by default
324 if ! grep --quiet 'ENABLED="true"' "/etc/default/sysstat"; then
329 SYSSTAT_PATH="/var/log/sa"
337 SAR_DIR="$WORKSPACE/archives/sar-reports"
338 mkdir -p "$SAR_DIR"
339 cp "$SYSSTAT_PATH/"* "$_"
340 # convert sar data to ascii format
341 while IFS="" read -r s
343 [ -f "$s" ] && LC_TIME=POSIX sar -A -f "$s" > "$SAR_DIR/sar${s//[!0-9]/}"
344 done < <(find "$SYSSTAT_PATH" -name "sa[0-9]*" || true)
346 # DON'T fail build if script fails.
349 </hudson.tasks.Shell>
350 <org.jenkinsci.plugins.configfiles.builder.ConfigFileBuildStep plugin="config-file-provider">
352 <org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
353 <fileId>jenkins-log-archives-settings</fileId>
355 <variable>SETTINGS_FILE</variable>
356 </org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
358 </org.jenkinsci.plugins.configfiles.builder.ConfigFileBuildStep>
361 <propertiesContent>SERVER_ID=logs</propertiesContent>
366 # SPDX-License-Identifier: EPL-1.0
367 ##############################################################################
368 # Copyright (c) 2017 The Linux Foundation and others.
370 # All rights reserved. This program and the accompanying materials
371 # are made available under the terms of the Eclipse Public License v1.0
372 # which accompanies this distribution, and is available at
373 # http://www.eclipse.org/legal/epl-v10.html
374 ##############################################################################
375 echo "---> create-netrc.sh"
377 # Ensure we fail the job if any steps fail.
380 NEXUS_URL="${NEXUS_URL:-$NEXUSPROXY}"
381 CREDENTIAL=$(xmlstarlet sel -N "x=http://maven.apache.org/SETTINGS/1.0.0" \
382 -t -m "/x:settings/x:servers/x:server[x:id='${SERVER_ID}']" \
383 -v x:username -o ":" -v x:password \
384 "$SETTINGS_FILE")
386 machine=$(echo "$NEXUS_URL" | awk -F/ '{print $3}')
387 user=$(echo "$CREDENTIAL" | cut -f1 -d:)
388 pass=$(echo "$CREDENTIAL" | cut -f2 -d:)
390 echo "machine $machine login $user password $pass" > ~/.netrc
392 </hudson.tasks.Shell>
395 # SPDX-License-Identifier: EPL-1.0
396 ##############################################################################
397 # Copyright (c) 2017 The Linux Foundation and others.
399 # All rights reserved. This program and the accompanying materials
400 # are made available under the terms of the Eclipse Public License v1.0
401 # which accompanies this distribution, and is available at
402 # http://www.eclipse.org/legal/epl-v10.html
403 ##############################################################################
404 echo "---> lftools-install.sh"
406 # Ensure we fail the job if any steps fail.
407 # DO NOT set -u as virtualenv's activate script has unbound variables
410 virtualenv --quiet "/tmp/v/lftools"
411 # shellcheck source=/tmp/v/lftools/bin/activate disable=SC1091
412 source "/tmp/v/lftools/bin/activate"
413 pip install --quiet --upgrade pip
414 pip install --quiet --upgrade "lftools<1.0.0"
416 # pipdeptree prints out a lot of information because lftools pulls in many
417 # dependencies. Let's only print it if we want to debug.
418 # echo "----> Pip Dependency Tree"
419 # pip install --quiet --upgrade pipdeptree
423 # SPDX-License-Identifier: EPL-1.0
424 ##############################################################################
425 # Copyright (c) 2017 The Linux Foundation and others.
427 # All rights reserved. This program and the accompanying materials
428 # are made available under the terms of the Eclipse Public License v1.0
429 # which accompanies this distribution, and is available at
430 # http://www.eclipse.org/legal/epl-v10.html
431 ##############################################################################
432 echo "---> logs-deploy.sh"
434 # Ensure we fail the job if any steps fail.
437 set -x # Trace commands for this script to make debugging easier.
439 ARCHIVE_ARTIFACTS="${ARCHIVE_ARTIFACTS:-}"
440 LOGS_SERVER="${LOGS_SERVER:-None}"
442 if [ "${LOGS_SERVER}" == 'None' ]
444 set +x # Disable trace since we no longer need it
446 echo "WARNING: Logging server not set"
448 NEXUS_URL="${NEXUS_URL:-$NEXUSPROXY}"
449 NEXUS_PATH="${SILO}/${JENKINS_HOSTNAME}/${JOB_NAME}/${BUILD_NUMBER}"
450 BUILD_URL="${BUILD_URL}"
452 lftools deploy archives -p "$ARCHIVE_ARTIFACTS" "$NEXUS_URL" "$NEXUS_PATH" "$WORKSPACE"
453 lftools deploy logs "$NEXUS_URL" "$NEXUS_PATH" "$BUILD_URL"
455 set +x # Disable trace since we no longer need it.
457 echo "Build logs: <a href=\"$LOGS_SERVER/$NEXUS_PATH\">$LOGS_SERVER/$NEXUS_PATH</a>"
460 </hudson.tasks.Shell>
463 # SPDX-License-Identifier: EPL-1.0
464 ##############################################################################
465 # Copyright (c) 2017 The Linux Foundation and others.
467 # All rights reserved. This program and the accompanying materials
468 # are made available under the terms of the Eclipse Public License v1.0
469 # which accompanies this distribution, and is available at
470 # http://www.eclipse.org/legal/epl-v10.html
471 ##############################################################################
473 # Clear log credential files
474 rm "$SETTINGS_FILE"
477 </hudson.tasks.Shell>
478 <hudson.plugins.descriptionsetter.DescriptionSetterBuilder>
479 <regexp>^Build logs: .*</regexp>
480 </hudson.plugins.descriptionsetter.DescriptionSetterBuilder>
482 <scriptOnlyIfSuccess>false</scriptOnlyIfSuccess>
483 <scriptOnlyIfFailure>false</scriptOnlyIfFailure>
484 <markBuildUnstable>false</markBuildUnstable>
485 </org.jenkinsci.plugins.postbuildscript.PostBuildScript>
486 <hudson.plugins.ws__cleanup.WsCleanup plugin="ws-cleanup">
488 <hudson.plugins.ws__cleanup.Pattern>
489 <pattern>**/*.jenkins-trigger</pattern>
491 </hudson.plugins.ws__cleanup.Pattern>
493 <deleteDirs>false</deleteDirs>
494 <cleanupMatrixParent>false</cleanupMatrixParent>
496 <cleanWhenSuccess>true</cleanWhenSuccess>
497 <cleanWhenUnstable>true</cleanWhenUnstable>
498 <cleanWhenFailure>true</cleanWhenFailure>
499 <cleanWhenNotBuilt>true</cleanWhenNotBuilt>
500 <cleanWhenAborted>true</cleanWhenAborted>
501 <notFailBuild>true</notFailBuild>
502 </hudson.plugins.ws__cleanup.WsCleanup>
505 <com.michelin.cio.hudson.plugins.maskpasswords.MaskPasswordsBuildWrapper/>
506 <hudson.plugins.build__timeout.BuildTimeoutWrapper>
507 <timeoutMinutes>10</timeoutMinutes>
508 <timeoutEnvVar>BUILD_TIMEOUT</timeoutEnvVar>
509 <failBuild>true</failBuild>
510 <writingDescription>false</writingDescription>
511 <timeoutPercentage>0</timeoutPercentage>
512 <timeoutMinutesElasticDefault>3</timeoutMinutesElasticDefault>
513 <timeoutType>absolute</timeoutType>
514 </hudson.plugins.build__timeout.BuildTimeoutWrapper>
515 <hudson.plugins.timestamper.TimestamperBuildWrapper/>
516 <com.cloudbees.jenkins.plugins.sshagent.SSHAgentBuildWrapper>
517 <user>test-credential</user>
518 </com.cloudbees.jenkins.plugins.sshagent.SSHAgentBuildWrapper>
519 <jenkins.plugins.openstack.compute.JCloudsOneOffSlave/>