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.
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>
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>
149 <com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.data.FilePath>
150 <compareType>ANT</compareType>
151 <pattern>**/global-jjb</pattern>
152 </com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.data.FilePath>
154 <disableStrictForbiddenFileVerification>false</disableStrictForbiddenFileVerification>
155 </com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.data.GerritProject>
158 <onSuccessful>false</onSuccessful>
159 <onFailed>false</onFailed>
160 <onUnstable>false</onUnstable>
161 <onNotBuilt>false</onNotBuilt>
163 <silentMode>false</silentMode>
164 <silentStartMode>false</silentStartMode>
165 <escapeQuotes>true</escapeQuotes>
166 <noNameAndEmailParameters>false</noNameAndEmailParameters>
167 <readableMessage>false</readableMessage>
168 <dependencyJobsNames/>
170 <dynamicTriggerConfiguration>False</dynamicTriggerConfiguration>
172 <allowTriggeringUnreviewedPatches>false</allowTriggeringUnreviewedPatches>
174 <com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.events.PluginChangeMergedEvent/>
175 <com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.events.PluginCommentAddedContainsEvent>
176 <commentAddedCommentContains>remerge$</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>jjbini</fileId>
194 <targetLocation>$HOME/.config/jenkins_jobs/jenkins_jobs.ini</targetLocation>
196 </org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
198 </org.jenkinsci.plugins.configfiles.builder.ConfigFileBuildStep>
201 # SPDX-License-Identifier: EPL-1.0
202 ##############################################################################
203 # Copyright (c) 2017 The Linux Foundation and others.
205 # All rights reserved. This program and the accompanying materials
206 # are made available under the terms of the Eclipse Public License v1.0
207 # which accompanies this distribution, and is available at
208 # http://www.eclipse.org/legal/epl-v10.html
209 ##############################################################################
210 echo "---> jjb-install.sh"
212 # Ensure we fail the job if any steps fail.
213 # DO NOT set -u as virtualenv's activate script has unbound variables
216 virtualenv "/tmp/v/jjb"
217 # shellcheck source=/tmp/v/jjb/bin/activate disable=SC1091
218 source "/tmp/v/jjb/bin/activate"
219 pip install --quiet --upgrade pip
220 pip install --quiet --upgrade pipdeptree
221 pip install --quiet --upgrade "jenkins-job-builder==$JJB_VERSION"
223 echo "----> Pip Dependency Tree"
227 # SPDX-License-Identifier: EPL-1.0
228 ##############################################################################
229 # Copyright (c) 2017 The Linux Foundation and others.
231 # All rights reserved. This program and the accompanying materials
232 # are made available under the terms of the Eclipse Public License v1.0
233 # which accompanies this distribution, and is available at
234 # http://www.eclipse.org/legal/epl-v10.html
235 ##############################################################################
236 echo "---> jjb-merge-job.sh"
238 # Ensure we fail the job if any steps fail.
241 jenkins-jobs update --recursive --delete-old --workers 4 jjb/
243 </hudson.tasks.Shell>
246 <org.jenkinsci.plugins.postbuildscript.PostBuildScript>
250 # SPDX-License-Identifier: EPL-1.0
251 ##############################################################################
252 # Copyright (c) 2017 The Linux Foundation and others.
254 # All rights reserved. This program and the accompanying materials
255 # are made available under the terms of the Eclipse Public License v1.0
256 # which accompanies this distribution, and is available at
257 # http://www.eclipse.org/legal/epl-v10.html
258 ##############################################################################
259 echo "---> sysstat.sh"
260 set +e # DON'T fail build if script fails.
262 OS=$(facter operatingsystem)
263 case "$OS" in
265 SYSSTAT_PATH="/var/log/sysstat"
267 # Dont run the script when systat is not enabled by default
268 if ! grep --quiet 'ENABLED="true"' "/etc/default/sysstat"; then
273 SYSSTAT_PATH="/var/log/sa"
281 SAR_DIR="$WORKSPACE/archives/sar-reports"
282 mkdir -p "$SAR_DIR"
283 cp "$SYSSTAT_PATH/"* "$_"
284 # convert sar data to ascii format
285 while IFS="" read -r s
287 [ -f "$s" ] && LC_TIME=POSIX sar -A -f "$s" > "$SAR_DIR/sar${s//[!0-9]/}"
288 done < <(find "$SYSSTAT_PATH" -name "sa[0-9]*" || true)
290 # DON'T fail build if script fails.
293 </hudson.tasks.Shell>
294 <org.jenkinsci.plugins.configfiles.builder.ConfigFileBuildStep plugin="config-file-provider">
296 <org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
297 <fileId>jenkins-log-archives-settings</fileId>
299 <variable>SETTINGS_FILE</variable>
300 </org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
302 </org.jenkinsci.plugins.configfiles.builder.ConfigFileBuildStep>
305 <propertiesContent>SERVER_ID=logs</propertiesContent>
310 # SPDX-License-Identifier: EPL-1.0
311 ##############################################################################
312 # Copyright (c) 2017 The Linux Foundation and others.
314 # All rights reserved. This program and the accompanying materials
315 # are made available under the terms of the Eclipse Public License v1.0
316 # which accompanies this distribution, and is available at
317 # http://www.eclipse.org/legal/epl-v10.html
318 ##############################################################################
319 echo "---> create-netrc.sh"
321 # Ensure we fail the job if any steps fail.
324 NEXUS_URL="${NEXUSPROXY:-$NEXUS_URL}"
325 CREDENTIAL=$(xmlstarlet sel -N "x=http://maven.apache.org/SETTINGS/1.0.0" \
326 -t -m "/x:settings/x:servers/x:server[x:id='${SERVER_ID}']" \
327 -v x:username -o ":" -v x:password \
328 "$SETTINGS_FILE")
330 machine=$(echo "$NEXUS_URL" | awk -F/ '{print $3}')
331 user=$(echo "$CREDENTIAL" | cut -f1 -d:)
332 pass=$(echo "$CREDENTIAL" | cut -f2 -d:)
334 echo "machine $machine login $user password $pass" > ~/.netrc
336 </hudson.tasks.Shell>
339 # SPDX-License-Identifier: EPL-1.0
340 ##############################################################################
341 # Copyright (c) 2017 The Linux Foundation and others.
343 # All rights reserved. This program and the accompanying materials
344 # are made available under the terms of the Eclipse Public License v1.0
345 # which accompanies this distribution, and is available at
346 # http://www.eclipse.org/legal/epl-v10.html
347 ##############################################################################
348 echo "---> lftools-install.sh"
350 # Script to install lftools via a version passed in via lf-infra-parameters
352 # Required parameters:
354 # LFTOOLS_VERSION: Passed in via lf-infra-parameters configuration. Can be
355 # set to a strict version number like '1.2.3' or using
356 # PEP-440 definitions.
360 # >=1.0.0,<2.0.0
362 # By default a released version of lftools should always be used.
363 # The purpose of the 2 variables below is so that lftools devs can test
364 # unreleased versions of lftools. There are 2 methods to install a dev version
367 # 1) gerrit patch: Used to test a patch that has not yet been merged.
368 # To do this set something like this:
369 # LFTOOLS_MODE=gerrit
370 # LFTOOLS_REFSPEC=refs/changes/96/5296/7
372 # 2) git branch: Used to install an lftools version from a specific branch.
373 # To use this set the variables as follows:
375 # LFTOOLS_REFSPEC=master
377 # 3) release : The intended use case and default setting.
378 # Set LFTOOLS_MODE=release, in this case LFTOOLS_REFSPEC is unused.
380 LFTOOLS_MODE=release # release | git | gerrit
381 LFTOOLS_REFSPEC=master
383 # Ensure we fail the job if any steps fail.
384 # DO NOT set -u as virtualenv's activate script has unbound variables
387 virtualenv --quiet "/tmp/v/lftools"
388 # shellcheck source=/tmp/v/lftools/bin/activate disable=SC1091
389 source "/tmp/v/lftools/bin/activate"
390 pip install --quiet --upgrade pip
392 case $LFTOOLS_MODE in
394 git clone https://gerrit.linuxfoundation.org/infra/releng/lftools.git /tmp/lftools
396 git fetch origin "$LFTOOLS_REFSPEC"
397 git checkout FETCH_HEAD
398 pip install --quiet --upgrade -r requirements.txt
399 pip install --quiet --upgrade -e .
404 pip install --quiet --upgrade git+https://gerrit.linuxfoundation.org/infra/releng/lftools.git@"$BRANCH"
408 if [[ $LFTOOLS_VERSION =~ ^[0-9] ]]; then
409 LFTOOLS_VERSION="==$LFTOOLS_VERSION"
412 pip install --quiet --upgrade "lftools${LFTOOLS_VERSION}"
418 # pipdeptree prints out a lot of information because lftools pulls in many
419 # dependencies. Let's only print it if we want to debug.
420 # echo "----> Pip Dependency Tree"
421 # pip install --quiet --upgrade pipdeptree
425 # SPDX-License-Identifier: EPL-1.0
426 ##############################################################################
427 # Copyright (c) 2017 The Linux Foundation and others.
429 # All rights reserved. This program and the accompanying materials
430 # are made available under the terms of the Eclipse Public License v1.0
431 # which accompanies this distribution, and is available at
432 # http://www.eclipse.org/legal/epl-v10.html
433 ##############################################################################
434 echo "---> logs-deploy.sh"
436 # Ensure we fail the job if any steps fail.
439 set -x # Trace commands for this script to make debugging easier.
441 ARCHIVE_ARTIFACTS="${ARCHIVE_ARTIFACTS:-}"
442 LOGS_SERVER="${LOGS_SERVER:-None}"
444 if [ "${LOGS_SERVER}" == 'None' ]
446 set +x # Disable trace since we no longer need it
448 echo "WARNING: Logging server not set"
450 NEXUS_URL="${NEXUSPROXY:-$NEXUS_URL}"
451 NEXUS_PATH="${SILO}/${JENKINS_HOSTNAME}/${JOB_NAME}/${BUILD_NUMBER}"
452 BUILD_URL="${BUILD_URL}"
454 lftools deploy archives -p "$ARCHIVE_ARTIFACTS" "$NEXUS_URL" "$NEXUS_PATH" "$WORKSPACE"
455 lftools deploy logs "$NEXUS_URL" "$NEXUS_PATH" "$BUILD_URL"
457 set +x # Disable trace since we no longer need it.
459 echo "Build logs: <a href=\"$LOGS_SERVER/$NEXUS_PATH\">$LOGS_SERVER/$NEXUS_PATH</a>"
462 </hudson.tasks.Shell>
465 # SPDX-License-Identifier: EPL-1.0
466 ##############################################################################
467 # Copyright (c) 2017 The Linux Foundation and others.
469 # All rights reserved. This program and the accompanying materials
470 # are made available under the terms of the Eclipse Public License v1.0
471 # which accompanies this distribution, and is available at
472 # http://www.eclipse.org/legal/epl-v10.html
473 ##############################################################################
475 # Clear log credential files
476 rm "$SETTINGS_FILE"
479 </hudson.tasks.Shell>
480 <hudson.plugins.descriptionsetter.DescriptionSetterBuilder>
481 <regexp>^Build logs: .*</regexp>
482 </hudson.plugins.descriptionsetter.DescriptionSetterBuilder>
484 <scriptOnlyIfSuccess>false</scriptOnlyIfSuccess>
485 <scriptOnlyIfFailure>false</scriptOnlyIfFailure>
486 <markBuildUnstable>false</markBuildUnstable>
487 </org.jenkinsci.plugins.postbuildscript.PostBuildScript>
488 <hudson.plugins.ws__cleanup.WsCleanup plugin="ws-cleanup">
490 <hudson.plugins.ws__cleanup.Pattern>
491 <pattern>**/*.jenkins-trigger</pattern>
493 </hudson.plugins.ws__cleanup.Pattern>
495 <deleteDirs>false</deleteDirs>
496 <cleanupMatrixParent>false</cleanupMatrixParent>
498 <cleanWhenSuccess>true</cleanWhenSuccess>
499 <cleanWhenUnstable>true</cleanWhenUnstable>
500 <cleanWhenFailure>true</cleanWhenFailure>
501 <cleanWhenNotBuilt>true</cleanWhenNotBuilt>
502 <cleanWhenAborted>true</cleanWhenAborted>
503 <notFailBuild>true</notFailBuild>
504 </hudson.plugins.ws__cleanup.WsCleanup>
507 <com.michelin.cio.hudson.plugins.maskpasswords.MaskPasswordsBuildWrapper/>
508 <hudson.plugins.build__timeout.BuildTimeoutWrapper>
509 <timeoutMinutes>10</timeoutMinutes>
510 <timeoutEnvVar>BUILD_TIMEOUT</timeoutEnvVar>
511 <failBuild>true</failBuild>
512 <writingDescription>false</writingDescription>
513 <timeoutPercentage>0</timeoutPercentage>
514 <timeoutMinutesElasticDefault>3</timeoutMinutesElasticDefault>
515 <timeoutType>absolute</timeoutType>
516 </hudson.plugins.build__timeout.BuildTimeoutWrapper>
517 <hudson.plugins.timestamper.TimestamperBuildWrapper/>
518 <com.cloudbees.jenkins.plugins.sshagent.SSHAgentBuildWrapper>
519 <user>test-credential</user>
520 </com.cloudbees.jenkins.plugins.sshagent.SSHAgentBuildWrapper>
521 <jenkins.plugins.openstack.compute.JCloudsOneOffSlave/>