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>JJB_VERSION</name>
69 <description>Jenkins Job Builder version to download and install.</description>
70 <defaultValue>1.6.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>
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/master</name>
88 </hudson.plugins.git.BranchSpec>
91 <buildChooser class="hudson.plugins.git.util.DefaultBuildChooser"/>
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>**/*.sh</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>**/*.yaml</pattern>
139 </com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.data.FilePath>
141 <disableStrictForbiddenFileVerification>false</disableStrictForbiddenFileVerification>
142 </com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.data.GerritProject>
145 <onSuccessful>false</onSuccessful>
146 <onFailed>false</onFailed>
147 <onUnstable>false</onUnstable>
148 <onNotBuilt>false</onNotBuilt>
150 <silentMode>false</silentMode>
151 <silentStartMode>false</silentStartMode>
152 <escapeQuotes>true</escapeQuotes>
153 <noNameAndEmailParameters>false</noNameAndEmailParameters>
154 <readableMessage>false</readableMessage>
155 <dependencyJobsNames/>
157 <dynamicTriggerConfiguration>False</dynamicTriggerConfiguration>
159 <allowTriggeringUnreviewedPatches>false</allowTriggeringUnreviewedPatches>
161 <com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.events.PluginChangeMergedEvent/>
162 <com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.events.PluginCommentAddedContainsEvent>
163 <commentAddedCommentContains>remerge$</commentAddedCommentContains>
164 </com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.events.PluginCommentAddedContainsEvent>
167 <buildFailureMessage/>
168 <buildSuccessfulMessage/>
169 <buildUnstableMessage/>
170 <buildNotBuiltMessage/>
171 <buildUnsuccessfulFilepath/>
173 <serverName>test-server</serverName>
174 </com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.GerritTrigger>
177 <org.jenkinsci.plugins.configfiles.builder.ConfigFileBuildStep plugin="config-file-provider">
179 <org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
180 <fileId>jjbini</fileId>
181 <targetLocation>$HOME/.config/jenkins_jobs/jenkins_jobs.ini</targetLocation>
183 </org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
185 </org.jenkinsci.plugins.configfiles.builder.ConfigFileBuildStep>
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 "---> jjb-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 "/tmp/v/jjb"
204 # shellcheck source=/tmp/v/jjb/bin/activate disable=SC1091
205 source "/tmp/v/jjb/bin/activate"
206 pip install --quiet --upgrade pip
207 pip install --quiet --upgrade pipdeptree
208 pip install --quiet --upgrade "jenkins-job-builder==$JJB_VERSION"
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 "---> jjb-merge-job.sh"
225 # Ensure we fail the job if any steps fail.
228 jenkins-jobs update --recursive --delete-old --workers 4 --exclude jjb-test jjb
230 </hudson.tasks.Shell>
233 <org.jenkinsci.plugins.postbuildscript.PostBuildScript>
237 # SPDX-License-Identifier: EPL-1.0
238 ##############################################################################
239 # Copyright (c) 2017 The Linux Foundation and others.
241 # All rights reserved. This program and the accompanying materials
242 # are made available under the terms of the Eclipse Public License v1.0
243 # which accompanies this distribution, and is available at
244 # http://www.eclipse.org/legal/epl-v10.html
245 ##############################################################################
246 echo "---> sysstat.sh"
247 set +e # DON'T fail build if script fails.
249 OS=$(facter operatingsystem)
250 case "$OS" in
252 SYSSTAT_PATH="/var/log/sysstat"
254 # Dont run the script when systat is not enabled by default
255 if ! grep --quiet 'ENABLED="true"' "/etc/default/sysstat"; then
260 SYSSTAT_PATH="/var/log/sa"
268 SAR_DIR="$WORKSPACE/archives/sar-reports"
269 mkdir -p "$SAR_DIR"
270 cp "$SYSSTAT_PATH/"* "$_"
271 # convert sar data to ascii format
272 while IFS="" read -r s
274 [ -f "$s" ] && LC_TIME=POSIX sar -A -f "$s" > "$SAR_DIR/sar${s//[!0-9]/}"
275 done < <(find "$SYSSTAT_PATH" -name "sa[0-9]*" || true)
277 # DON'T fail build if script fails.
280 </hudson.tasks.Shell>
281 <org.jenkinsci.plugins.configfiles.builder.ConfigFileBuildStep plugin="config-file-provider">
283 <org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
284 <fileId>jenkins-log-archives-settings</fileId>
286 <variable>SETTINGS_FILE</variable>
287 </org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
289 </org.jenkinsci.plugins.configfiles.builder.ConfigFileBuildStep>
292 <propertiesContent>SERVER_ID=logs</propertiesContent>
297 # SPDX-License-Identifier: EPL-1.0
298 ##############################################################################
299 # Copyright (c) 2017 The Linux Foundation and others.
301 # All rights reserved. This program and the accompanying materials
302 # are made available under the terms of the Eclipse Public License v1.0
303 # which accompanies this distribution, and is available at
304 # http://www.eclipse.org/legal/epl-v10.html
305 ##############################################################################
306 echo "---> create-netrc.sh"
308 # Ensure we fail the job if any steps fail.
311 NEXUS_URL="${NEXUS_URL:-$NEXUSPROXY}"
312 CREDENTIAL=$(xmlstarlet sel -N "x=http://maven.apache.org/SETTINGS/1.0.0" \
313 -t -m "/x:settings/x:servers/x:server[x:id='${SERVER_ID}']" \
314 -v x:username -o ":" -v x:password \
315 "$SETTINGS_FILE")
317 machine=$(echo "$NEXUS_URL" | awk -F/ '{print $3}')
318 user=$(echo "$CREDENTIAL" | cut -f1 -d:)
319 pass=$(echo "$CREDENTIAL" | cut -f2 -d:)
321 echo "machine $machine login $user password $pass" > ~/.netrc
323 </hudson.tasks.Shell>
326 # SPDX-License-Identifier: EPL-1.0
327 ##############################################################################
328 # Copyright (c) 2017 The Linux Foundation and others.
330 # All rights reserved. This program and the accompanying materials
331 # are made available under the terms of the Eclipse Public License v1.0
332 # which accompanies this distribution, and is available at
333 # http://www.eclipse.org/legal/epl-v10.html
334 ##############################################################################
335 echo "---> lftools-install.sh"
337 # By default a released version of lftools should always be used.
338 # The purpose of the 2 variables below is so that lftools devs can test
339 # unreleased versions of lftools. There are 2 methods to install a dev version
342 # 1) gerrit patch: Used to test a patch that has not yet been merged.
343 # To do this set something like this:
344 # LFTOOLS_MODE=gerrit
345 # LFTOOLS_REFSPEC=refs/changes/96/5296/7
347 # 2) git branch: Used to install an lftools version from a specific branch.
348 # To use this set the variables as follows:
350 # LFTOOLS_REFSPEC=master
352 # 3) release : The intended use case and default setting.
353 # Set LFTOOLS_MODE=release, in this case LFTOOLS_REFSPEC is unused.
355 LFTOOLS_MODE=release # release | git | gerrit
356 LFTOOLS_REFSPEC=master
358 # Ensure we fail the job if any steps fail.
359 # DO NOT set -u as virtualenv's activate script has unbound variables
362 virtualenv --quiet "/tmp/v/lftools"
363 # shellcheck source=/tmp/v/lftools/bin/activate disable=SC1091
364 source "/tmp/v/lftools/bin/activate"
365 pip install --quiet --upgrade pip
367 case $LFTOOLS_MODE in
369 git clone https://gerrit.linuxfoundation.org/infra/releng/lftools.git /tmp/lftools
371 git fetch origin "$LFTOOLS_REFSPEC"
372 git checkout FETCH_HEAD
373 pip install --quiet --upgrade -r requirements.txt
374 pip install --quiet --upgrade -e .
379 pip install --quiet --upgrade git+https://gerrit.linuxfoundation.org/infra/releng/lftools.git@"$BRANCH"
383 pip install --quiet --upgrade "lftools<1.0.0"
387 # pipdeptree prints out a lot of information because lftools pulls in many
388 # dependencies. Let's only print it if we want to debug.
389 # echo "----> Pip Dependency Tree"
390 # pip install --quiet --upgrade pipdeptree
394 # SPDX-License-Identifier: EPL-1.0
395 ##############################################################################
396 # Copyright (c) 2017 The Linux Foundation and others.
398 # All rights reserved. This program and the accompanying materials
399 # are made available under the terms of the Eclipse Public License v1.0
400 # which accompanies this distribution, and is available at
401 # http://www.eclipse.org/legal/epl-v10.html
402 ##############################################################################
403 echo "---> logs-deploy.sh"
405 # Ensure we fail the job if any steps fail.
408 set -x # Trace commands for this script to make debugging easier.
410 ARCHIVE_ARTIFACTS="${ARCHIVE_ARTIFACTS:-}"
411 LOGS_SERVER="${LOGS_SERVER:-None}"
413 if [ "${LOGS_SERVER}" == 'None' ]
415 set +x # Disable trace since we no longer need it
417 echo "WARNING: Logging server not set"
419 NEXUS_URL="${NEXUS_URL:-$NEXUSPROXY}"
420 NEXUS_PATH="${SILO}/${JENKINS_HOSTNAME}/${JOB_NAME}/${BUILD_NUMBER}"
421 BUILD_URL="${BUILD_URL}"
423 lftools deploy archives -p "$ARCHIVE_ARTIFACTS" "$NEXUS_URL" "$NEXUS_PATH" "$WORKSPACE"
424 lftools deploy logs "$NEXUS_URL" "$NEXUS_PATH" "$BUILD_URL"
426 set +x # Disable trace since we no longer need it.
428 echo "Build logs: <a href=\"$LOGS_SERVER/$NEXUS_PATH\">$LOGS_SERVER/$NEXUS_PATH</a>"
431 </hudson.tasks.Shell>
434 # SPDX-License-Identifier: EPL-1.0
435 ##############################################################################
436 # Copyright (c) 2017 The Linux Foundation and others.
438 # All rights reserved. This program and the accompanying materials
439 # are made available under the terms of the Eclipse Public License v1.0
440 # which accompanies this distribution, and is available at
441 # http://www.eclipse.org/legal/epl-v10.html
442 ##############################################################################
444 # Clear log credential files
445 rm "$SETTINGS_FILE"
448 </hudson.tasks.Shell>
449 <hudson.plugins.descriptionsetter.DescriptionSetterBuilder>
450 <regexp>^Build logs: .*</regexp>
451 </hudson.plugins.descriptionsetter.DescriptionSetterBuilder>
453 <scriptOnlyIfSuccess>false</scriptOnlyIfSuccess>
454 <scriptOnlyIfFailure>false</scriptOnlyIfFailure>
455 <markBuildUnstable>false</markBuildUnstable>
456 </org.jenkinsci.plugins.postbuildscript.PostBuildScript>
457 <hudson.plugins.ws__cleanup.WsCleanup plugin="ws-cleanup">
459 <hudson.plugins.ws__cleanup.Pattern>
460 <pattern>**/*.jenkins-trigger</pattern>
462 </hudson.plugins.ws__cleanup.Pattern>
464 <deleteDirs>false</deleteDirs>
465 <cleanupMatrixParent>false</cleanupMatrixParent>
467 <cleanWhenSuccess>true</cleanWhenSuccess>
468 <cleanWhenUnstable>true</cleanWhenUnstable>
469 <cleanWhenFailure>true</cleanWhenFailure>
470 <cleanWhenNotBuilt>true</cleanWhenNotBuilt>
471 <cleanWhenAborted>true</cleanWhenAborted>
472 <notFailBuild>true</notFailBuild>
473 </hudson.plugins.ws__cleanup.WsCleanup>
476 <com.michelin.cio.hudson.plugins.maskpasswords.MaskPasswordsBuildWrapper/>
477 <hudson.plugins.build__timeout.BuildTimeoutWrapper>
478 <timeoutMinutes>10</timeoutMinutes>
479 <timeoutEnvVar>BUILD_TIMEOUT</timeoutEnvVar>
480 <failBuild>true</failBuild>
481 <writingDescription>false</writingDescription>
482 <timeoutPercentage>0</timeoutPercentage>
483 <timeoutMinutesElasticDefault>3</timeoutMinutesElasticDefault>
484 <timeoutType>absolute</timeoutType>
485 </hudson.plugins.build__timeout.BuildTimeoutWrapper>
486 <hudson.plugins.timestamper.TimestamperBuildWrapper/>
487 <com.cloudbees.jenkins.plugins.sshagent.SSHAgentBuildWrapper>
488 <user>test-credential</user>
489 </com.cloudbees.jenkins.plugins.sshagent.SSHAgentBuildWrapper>
490 <jenkins.plugins.openstack.compute.JCloudsOneOffSlave/>