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>false</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>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>
77 <name>JJB_VERSION</name>
78 <description>Jenkins Job Builder version to download and install.</description>
79 <defaultValue>1.6.2</defaultValue>
80 </hudson.model.StringParameterDefinition>
81 </parameterDefinitions>
82 </hudson.model.ParametersDefinitionProperty>
84 <scm class="hudson.plugins.git.GitSCM">
85 <configVersion>2</configVersion>
87 <hudson.plugins.git.UserRemoteConfig>
90 <url>$GIT_URL/$GERRIT_PROJECT</url>
91 <credentialsId>test-credential</credentialsId>
92 </hudson.plugins.git.UserRemoteConfig>
95 <hudson.plugins.git.BranchSpec>
96 <name>refs/heads/master</name>
97 </hudson.plugins.git.BranchSpec>
100 <buildChooser class="hudson.plugins.git.util.DefaultBuildChooser"/>
101 <doGenerateSubmoduleConfigurations>false</doGenerateSubmoduleConfigurations>
102 <authorOrCommitter>false</authorOrCommitter>
103 <wipeOutWorkspace>true</wipeOutWorkspace>
104 <pruneBranches>false</pruneBranches>
105 <remotePoll>false</remotePoll>
106 <gitTool>Default</gitTool>
107 <submoduleCfg class="list"/>
112 <skipTag>true</skipTag>
114 <useShallowClone>false</useShallowClone>
115 <ignoreNotifyCommit>false</ignoreNotifyCommit>
117 <hudson.plugins.git.extensions.impl.SubmoduleOption>
118 <disableSubmodules>false</disableSubmodules>
119 <recursiveSubmodules>true</recursiveSubmodules>
120 <trackingSubmodules>false</trackingSubmodules>
122 <timeout>10</timeout>
123 </hudson.plugins.git.extensions.impl.SubmoduleOption>
124 <hudson.plugins.git.extensions.impl.WipeWorkspace/>
127 <triggers class="vector">
128 <com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.GerritTrigger>
131 <com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.data.GerritProject>
132 <compareType>ANT</compareType>
133 <pattern>releng/ciman</pattern>
135 <com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.data.Branch>
136 <compareType>ANT</compareType>
137 <pattern>**/master</pattern>
138 </com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.data.Branch>
141 <com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.data.FilePath>
142 <compareType>ANT</compareType>
143 <pattern>**/*.sh</pattern>
144 </com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.data.FilePath>
145 <com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.data.FilePath>
146 <compareType>ANT</compareType>
147 <pattern>**/*.yaml</pattern>
148 </com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.data.FilePath>
150 <disableStrictForbiddenFileVerification>false</disableStrictForbiddenFileVerification>
151 </com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.data.GerritProject>
154 <onSuccessful>false</onSuccessful>
155 <onFailed>false</onFailed>
156 <onUnstable>false</onUnstable>
157 <onNotBuilt>false</onNotBuilt>
159 <silentMode>false</silentMode>
160 <silentStartMode>false</silentStartMode>
161 <escapeQuotes>true</escapeQuotes>
162 <noNameAndEmailParameters>false</noNameAndEmailParameters>
163 <readableMessage>false</readableMessage>
164 <dependencyJobsNames/>
166 <dynamicTriggerConfiguration>False</dynamicTriggerConfiguration>
168 <allowTriggeringUnreviewedPatches>false</allowTriggeringUnreviewedPatches>
170 <com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.events.PluginChangeMergedEvent/>
171 <com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.events.PluginCommentAddedContainsEvent>
172 <commentAddedCommentContains>remerge$</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>
186 <org.jenkinsci.plugins.configfiles.builder.ConfigFileBuildStep plugin="config-file-provider">
188 <org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
189 <fileId>jjbini</fileId>
190 <targetLocation>$HOME/.config/jenkins_jobs/jenkins_jobs.ini</targetLocation>
192 </org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
194 </org.jenkinsci.plugins.configfiles.builder.ConfigFileBuildStep>
197 # SPDX-License-Identifier: EPL-1.0
198 ##############################################################################
199 # Copyright (c) 2017 The Linux Foundation and others.
201 # All rights reserved. This program and the accompanying materials
202 # are made available under the terms of the Eclipse Public License v1.0
203 # which accompanies this distribution, and is available at
204 # http://www.eclipse.org/legal/epl-v10.html
205 ##############################################################################
206 echo "---> jjb-install.sh"
208 # Ensure we fail the job if any steps fail.
209 # DO NOT set -u as virtualenv's activate script has unbound variables
212 virtualenv "/tmp/v/jjb"
213 # shellcheck source=/tmp/v/jjb/bin/activate disable=SC1091
214 source "/tmp/v/jjb/bin/activate"
215 pip install --quiet --upgrade pip
216 pip install --quiet --upgrade pipdeptree
217 pip install --quiet --upgrade "jenkins-job-builder==$JJB_VERSION"
219 echo "----> Pip Dependency Tree"
223 # SPDX-License-Identifier: EPL-1.0
224 ##############################################################################
225 # Copyright (c) 2017 The Linux Foundation and others.
227 # All rights reserved. This program and the accompanying materials
228 # are made available under the terms of the Eclipse Public License v1.0
229 # which accompanies this distribution, and is available at
230 # http://www.eclipse.org/legal/epl-v10.html
231 ##############################################################################
232 echo "---> jjb-merge-job.sh"
234 # Ensure we fail the job if any steps fail.
237 jenkins-jobs update --recursive --delete-old --workers 4 --exclude jjb-test jjb
239 </hudson.tasks.Shell>
242 <org.jenkinsci.plugins.postbuildscript.PostBuildScript>
246 # SPDX-License-Identifier: EPL-1.0
247 ##############################################################################
248 # Copyright (c) 2017 The Linux Foundation and others.
250 # All rights reserved. This program and the accompanying materials
251 # are made available under the terms of the Eclipse Public License v1.0
252 # which accompanies this distribution, and is available at
253 # http://www.eclipse.org/legal/epl-v10.html
254 ##############################################################################
255 echo "---> sysstat.sh"
256 set +e # DON'T fail build if script fails.
258 OS=$(facter operatingsystem)
259 case "$OS" in
261 SYSSTAT_PATH="/var/log/sysstat"
263 # Dont run the script when systat is not enabled by default
264 if ! grep --quiet 'ENABLED="true"' "/etc/default/sysstat"; then
269 SYSSTAT_PATH="/var/log/sa"
277 SAR_DIR="$WORKSPACE/archives/sar-reports"
278 mkdir -p "$SAR_DIR"
279 cp "$SYSSTAT_PATH/"* "$_"
280 # convert sar data to ascii format
281 while IFS="" read -r s
283 [ -f "$s" ] && LC_TIME=POSIX sar -A -f "$s" > "$SAR_DIR/sar${s//[!0-9]/}"
284 done < <(find "$SYSSTAT_PATH" -name "sa[0-9]*" || true)
286 # DON'T fail build if script fails.
289 </hudson.tasks.Shell>
290 <org.jenkinsci.plugins.configfiles.builder.ConfigFileBuildStep plugin="config-file-provider">
292 <org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
293 <fileId>jenkins-log-archives-settings</fileId>
295 <variable>SETTINGS_FILE</variable>
296 </org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
298 </org.jenkinsci.plugins.configfiles.builder.ConfigFileBuildStep>
301 <propertiesContent>SERVER_ID=logs</propertiesContent>
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 "---> create-netrc.sh"
317 # Ensure we fail the job if any steps fail.
320 NEXUS_URL="${NEXUS_URL:-$NEXUSPROXY}"
321 CREDENTIAL=$(xmlstarlet sel -N "x=http://maven.apache.org/SETTINGS/1.0.0" \
322 -t -m "/x:settings/x:servers/x:server[x:id='${SERVER_ID}']" \
323 -v x:username -o ":" -v x:password \
324 "$SETTINGS_FILE")
326 machine=$(echo "$NEXUS_URL" | awk -F/ '{print $3}')
327 user=$(echo "$CREDENTIAL" | cut -f1 -d:)
328 pass=$(echo "$CREDENTIAL" | cut -f2 -d:)
330 echo "machine $machine login $user password $pass" > ~/.netrc
332 </hudson.tasks.Shell>
335 # SPDX-License-Identifier: EPL-1.0
336 ##############################################################################
337 # Copyright (c) 2017 The Linux Foundation and others.
339 # All rights reserved. This program and the accompanying materials
340 # are made available under the terms of the Eclipse Public License v1.0
341 # which accompanies this distribution, and is available at
342 # http://www.eclipse.org/legal/epl-v10.html
343 ##############################################################################
344 echo "---> lftools-install.sh"
346 # Script to install lftools via a version passed in via lf-infra-parameters
348 # Required parameters:
350 # LFTOOLS_VERSION: Passed in via lf-infra-parameters configuration. Can be
351 # set to a strict version number like '1.2.3' or using
352 # PEP-440 definitions.
356 # >=1.0.0,<2.0.0
358 # By default a released version of lftools should always be used.
359 # The purpose of the 2 variables below is so that lftools devs can test
360 # unreleased versions of lftools. There are 2 methods to install a dev version
363 # 1) gerrit patch: Used to test a patch that has not yet been merged.
364 # To do this set something like this:
365 # LFTOOLS_MODE=gerrit
366 # LFTOOLS_REFSPEC=refs/changes/96/5296/7
368 # 2) git branch: Used to install an lftools version from a specific branch.
369 # To use this set the variables as follows:
371 # LFTOOLS_REFSPEC=master
373 # 3) release : The intended use case and default setting.
374 # Set LFTOOLS_MODE=release, in this case LFTOOLS_REFSPEC is unused.
376 LFTOOLS_MODE=release # release | git | gerrit
377 LFTOOLS_REFSPEC=master
379 # Ensure we fail the job if any steps fail.
380 # DO NOT set -u as virtualenv's activate script has unbound variables
383 virtualenv --quiet "/tmp/v/lftools"
384 # shellcheck source=/tmp/v/lftools/bin/activate disable=SC1091
385 source "/tmp/v/lftools/bin/activate"
386 pip install --quiet --upgrade pip
388 case $LFTOOLS_MODE in
390 git clone https://gerrit.linuxfoundation.org/infra/releng/lftools.git /tmp/lftools
392 git fetch origin "$LFTOOLS_REFSPEC"
393 git checkout FETCH_HEAD
394 pip install --quiet --upgrade -r requirements.txt
395 pip install --quiet --upgrade -e .
400 pip install --quiet --upgrade git+https://gerrit.linuxfoundation.org/infra/releng/lftools.git@"$BRANCH"
404 if [[ $LFTOOLS_VERSION =~ ^[0-9] ]]; then
405 LFTOOLS_VERSION="==$LFTOOLS_VERSION"
408 pip install --quiet --upgrade "lftools${LFTOOLS_VERSION}"
414 # pipdeptree prints out a lot of information because lftools pulls in many
415 # dependencies. Let's only print it if we want to debug.
416 # echo "----> Pip Dependency Tree"
417 # pip install --quiet --upgrade pipdeptree
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 "---> logs-deploy.sh"
432 # Ensure we fail the job if any steps fail.
435 set -x # Trace commands for this script to make debugging easier.
437 ARCHIVE_ARTIFACTS="${ARCHIVE_ARTIFACTS:-}"
438 LOGS_SERVER="${LOGS_SERVER:-None}"
440 if [ "${LOGS_SERVER}" == 'None' ]
442 set +x # Disable trace since we no longer need it
444 echo "WARNING: Logging server not set"
446 NEXUS_URL="${NEXUS_URL:-$NEXUSPROXY}"
447 NEXUS_PATH="${SILO}/${JENKINS_HOSTNAME}/${JOB_NAME}/${BUILD_NUMBER}"
448 BUILD_URL="${BUILD_URL}"
450 lftools deploy archives -p "$ARCHIVE_ARTIFACTS" "$NEXUS_URL" "$NEXUS_PATH" "$WORKSPACE"
451 lftools deploy logs "$NEXUS_URL" "$NEXUS_PATH" "$BUILD_URL"
453 set +x # Disable trace since we no longer need it.
455 echo "Build logs: <a href=\"$LOGS_SERVER/$NEXUS_PATH\">$LOGS_SERVER/$NEXUS_PATH</a>"
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 ##############################################################################
471 # Clear log credential files
472 rm "$SETTINGS_FILE"
475 </hudson.tasks.Shell>
476 <hudson.plugins.descriptionsetter.DescriptionSetterBuilder>
477 <regexp>^Build logs: .*</regexp>
478 </hudson.plugins.descriptionsetter.DescriptionSetterBuilder>
480 <scriptOnlyIfSuccess>false</scriptOnlyIfSuccess>
481 <scriptOnlyIfFailure>false</scriptOnlyIfFailure>
482 <markBuildUnstable>false</markBuildUnstable>
483 </org.jenkinsci.plugins.postbuildscript.PostBuildScript>
484 <hudson.plugins.ws__cleanup.WsCleanup plugin="ws-cleanup">
486 <hudson.plugins.ws__cleanup.Pattern>
487 <pattern>**/*.jenkins-trigger</pattern>
489 </hudson.plugins.ws__cleanup.Pattern>
491 <deleteDirs>false</deleteDirs>
492 <cleanupMatrixParent>false</cleanupMatrixParent>
494 <cleanWhenSuccess>true</cleanWhenSuccess>
495 <cleanWhenUnstable>true</cleanWhenUnstable>
496 <cleanWhenFailure>true</cleanWhenFailure>
497 <cleanWhenNotBuilt>true</cleanWhenNotBuilt>
498 <cleanWhenAborted>true</cleanWhenAborted>
499 <notFailBuild>true</notFailBuild>
500 </hudson.plugins.ws__cleanup.WsCleanup>
503 <com.michelin.cio.hudson.plugins.maskpasswords.MaskPasswordsBuildWrapper/>
504 <hudson.plugins.build__timeout.BuildTimeoutWrapper>
505 <timeoutMinutes>10</timeoutMinutes>
506 <timeoutEnvVar>BUILD_TIMEOUT</timeoutEnvVar>
507 <failBuild>true</failBuild>
508 <writingDescription>false</writingDescription>
509 <timeoutPercentage>0</timeoutPercentage>
510 <timeoutMinutesElasticDefault>3</timeoutMinutesElasticDefault>
511 <timeoutType>absolute</timeoutType>
512 </hudson.plugins.build__timeout.BuildTimeoutWrapper>
513 <hudson.plugins.timestamper.TimestamperBuildWrapper/>
514 <com.cloudbees.jenkins.plugins.sshagent.SSHAgentBuildWrapper>
515 <user>test-credential</user>
516 </com.cloudbees.jenkins.plugins.sshagent.SSHAgentBuildWrapper>
517 <jenkins.plugins.openstack.compute.JCloudsOneOffSlave/>