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>
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>
89 <refspec>$GERRIT_REFSPEC</refspec>
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/$GERRIT_BRANCH</name>
97 </hudson.plugins.git.BranchSpec>
99 <doGenerateSubmoduleConfigurations>false</doGenerateSubmoduleConfigurations>
100 <remotePoll>false</remotePoll>
101 <gitTool>Default</gitTool>
102 <submoduleCfg class="list"/>
107 <hudson.plugins.git.extensions.impl.BuildChooserSetting>
108 <buildChooser class="com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.GerritTriggerBuildChooser"/>
109 </hudson.plugins.git.extensions.impl.BuildChooserSetting>
110 <hudson.plugins.git.extensions.impl.SubmoduleOption>
111 <disableSubmodules>false</disableSubmodules>
112 <recursiveSubmodules>true</recursiveSubmodules>
113 <trackingSubmodules>false</trackingSubmodules>
114 <parentCredentials>false</parentCredentials>
116 <timeout>10</timeout>
117 </hudson.plugins.git.extensions.impl.SubmoduleOption>
118 <hudson.plugins.git.extensions.impl.WipeWorkspace/>
121 <triggers class="vector">
122 <com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.GerritTrigger>
125 <com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.data.GerritProject>
126 <compareType>ANT</compareType>
127 <pattern>releng/ciman</pattern>
129 <com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.data.Branch>
130 <compareType>ANT</compareType>
131 <pattern>**/master</pattern>
132 </com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.data.Branch>
135 <com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.data.FilePath>
136 <compareType>ANT</compareType>
137 <pattern>**/*.sh</pattern>
138 </com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.data.FilePath>
139 <com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.data.FilePath>
140 <compareType>ANT</compareType>
141 <pattern>**/*.yaml</pattern>
142 </com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.data.FilePath>
143 <com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.data.FilePath>
144 <compareType>ANT</compareType>
145 <pattern>**/global-jjb</pattern>
146 </com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.data.FilePath>
148 <disableStrictForbiddenFileVerification>false</disableStrictForbiddenFileVerification>
149 </com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.data.GerritProject>
152 <onSuccessful>false</onSuccessful>
153 <onFailed>false</onFailed>
154 <onUnstable>false</onUnstable>
155 <onNotBuilt>false</onNotBuilt>
157 <silentMode>false</silentMode>
158 <silentStartMode>false</silentStartMode>
159 <escapeQuotes>true</escapeQuotes>
160 <noNameAndEmailParameters>false</noNameAndEmailParameters>
161 <readableMessage>false</readableMessage>
162 <dependencyJobsNames/>
164 <dynamicTriggerConfiguration>False</dynamicTriggerConfiguration>
166 <allowTriggeringUnreviewedPatches>false</allowTriggeringUnreviewedPatches>
168 <com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.events.PluginPatchsetCreatedEvent>
169 <excludeDrafts>true</excludeDrafts>
170 <excludeTrivialRebase>false</excludeTrivialRebase>
171 <excludeNoCodeChange>false</excludeNoCodeChange>
172 </com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.events.PluginPatchsetCreatedEvent>
173 <com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.events.PluginDraftPublishedEvent/>
174 <com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.events.PluginCommentAddedContainsEvent>
175 <commentAddedCommentContains>recheck$</commentAddedCommentContains>
176 </com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.events.PluginCommentAddedContainsEvent>
179 <buildFailureMessage/>
180 <buildSuccessfulMessage/>
181 <buildUnstableMessage/>
182 <buildNotBuiltMessage/>
183 <buildUnsuccessfulFilepath/>
185 <serverName>test-server</serverName>
186 </com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.GerritTrigger>
189 <org.jenkinsci.plugins.configfiles.builder.ConfigFileBuildStep plugin="config-file-provider">
191 <org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
192 <fileId>jjbini</fileId>
193 <targetLocation>$HOME/.config/jenkins_jobs/jenkins_jobs.ini</targetLocation>
195 </org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
197 </org.jenkinsci.plugins.configfiles.builder.ConfigFileBuildStep>
200 # SPDX-License-Identifier: EPL-1.0
201 ##############################################################################
202 # Copyright (c) 2017 The Linux Foundation and others.
204 # All rights reserved. This program and the accompanying materials
205 # are made available under the terms of the Eclipse Public License v1.0
206 # which accompanies this distribution, and is available at
207 # http://www.eclipse.org/legal/epl-v10.html
208 ##############################################################################
210 # This script will make sure that there are no JIRA URLs in the commit
211 # message. JIRA URLs will break the its-jira plugin
213 # Ensure we fail the job if any steps fail.
214 # Do not treat undefined variables as errors as in this case we are allowed
215 # to have JIRA_URL undefined
219 if [ -n "${JIRA_URL}" ];
221 BASE_URL=$(echo $JIRA_URL | awk -F'/' '{print $3}')
222 JIRA_LINK=$(git rev-list --format=%B --max-count=1 HEAD | grep -io "http[s]*://$BASE_URL/" || true)
223 if [[ ! -z "$JIRA_LINK" ]]
225 echo 'Remove JIRA URLs from commit message'
226 echo 'Add jira references as: Issue: <JIRAKEY>-<ISSUE#>, instead of URLs'
232 # SPDX-License-Identifier: EPL-1.0
233 ##############################################################################
234 # Copyright (c) 2017 The Linux Foundation and others.
236 # All rights reserved. This program and the accompanying materials
237 # are made available under the terms of the Eclipse Public License v1.0
238 # which accompanies this distribution, and is available at
239 # http://www.eclipse.org/legal/epl-v10.html
240 ##############################################################################
241 echo "---> jjb-install.sh"
243 # Ensure we fail the job if any steps fail.
244 # DO NOT set -u as virtualenv's activate script has unbound variables
247 virtualenv "/tmp/v/jjb"
248 # shellcheck source=/tmp/v/jjb/bin/activate disable=SC1091
249 source "/tmp/v/jjb/bin/activate"
250 pip install --quiet --upgrade pip
251 pip install --quiet --upgrade pipdeptree
252 pip install --quiet --upgrade "jenkins-job-builder==$JJB_VERSION"
254 echo "----> Pip Dependency Tree"
258 # SPDX-License-Identifier: EPL-1.0
259 ##############################################################################
260 # Copyright (c) 2017 The Linux Foundation and others.
262 # All rights reserved. This program and the accompanying materials
263 # are made available under the terms of the Eclipse Public License v1.0
264 # which accompanies this distribution, and is available at
265 # http://www.eclipse.org/legal/epl-v10.html
266 ##############################################################################
267 echo "---> jjb-verify-job.sh"
269 # Ensure we fail the job if any steps fail.
272 jenkins-jobs -l DEBUG test --recursive -o archives/job-configs jjb/
274 # Sort job output into sub-directories. On large Jenkins systems that have
275 # many jobs archiving so many files into the same directory makes NGINX return
276 # the directory list slow.
277 pushd archives/job-configs
280 if [[ $(ls "$letter"* > /dev/null 2>&1) -eq 0 ]]
282 mkdir "$letter"
283 find . -maxdepth 1 -type f -name "$letter*" -exec mv {} "$letter" \;
289 # SPDX-License-Identifier: EPL-1.0
290 ##############################################################################
291 # Copyright (c) 2015 The Linux Foundation and others.
293 # All rights reserved. This program and the accompanying materials
294 # are made available under the terms of the Eclipse Public License v1.0
295 # which accompanies this distribution, and is available at
296 # http://www.eclipse.org/legal/epl-v10.html
297 ##############################################################################
298 echo "---> jjb-check-unicode.sh"
300 if LC_ALL=C grep -I -r '[^[:print:][:space:]]' jjb/; then
301 echo "Found files containing non-ascii characters."
305 echo "All files are ASCII only"
307 </hudson.tasks.Shell>
310 # SPDX-License-Identifier: EPL-1.0
311 ##############################################################################
312 # Copyright (c) 2016 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 "---> gpg-verify-git-signature.sh"
321 if git log --show-signature -1 | grep -E -q 'gpg: Signature made.*key ID'; then
322 echo "Git commit is GPG signed."
324 echo "WARNING: GPG signature missing for the commit."
327 # Do NOT fail the job for unsigned commits
330 </hudson.tasks.Shell>
333 <org.jenkinsci.plugins.postbuildscript.PostBuildScript>
337 # SPDX-License-Identifier: EPL-1.0
338 ##############################################################################
339 # Copyright (c) 2017 The Linux Foundation and others.
341 # All rights reserved. This program and the accompanying materials
342 # are made available under the terms of the Eclipse Public License v1.0
343 # which accompanies this distribution, and is available at
344 # http://www.eclipse.org/legal/epl-v10.html
345 ##############################################################################
346 echo "---> sysstat.sh"
347 set +e # DON'T fail build if script fails.
349 OS=$(facter operatingsystem)
350 case "$OS" in
352 SYSSTAT_PATH="/var/log/sysstat"
354 # Dont run the script when systat is not enabled by default
355 if ! grep --quiet 'ENABLED="true"' "/etc/default/sysstat"; then
360 SYSSTAT_PATH="/var/log/sa"
368 SAR_DIR="$WORKSPACE/archives/sar-reports"
369 mkdir -p "$SAR_DIR"
370 cp "$SYSSTAT_PATH/"* "$_"
371 # convert sar data to ascii format
372 while IFS="" read -r sarfilenum
374 [ -f "$sarfilenum" ] && LC_TIME=POSIX sar -A -f "$sarfilenum" > "$SAR_DIR/sar${sarfilenum//[!0-9]/}"
375 done < <(find "$SYSSTAT_PATH" -name "sa[0-9]*" || true)
377 # DON'T fail build if script fails.
380 </hudson.tasks.Shell>
381 <org.jenkinsci.plugins.configfiles.builder.ConfigFileBuildStep plugin="config-file-provider">
383 <org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
384 <fileId>jenkins-log-archives-settings</fileId>
386 <variable>SETTINGS_FILE</variable>
387 </org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
389 </org.jenkinsci.plugins.configfiles.builder.ConfigFileBuildStep>
392 <propertiesContent>SERVER_ID=logs</propertiesContent>
397 # SPDX-License-Identifier: EPL-1.0
398 ##############################################################################
399 # Copyright (c) 2017 The Linux Foundation and others.
401 # All rights reserved. This program and the accompanying materials
402 # are made available under the terms of the Eclipse Public License v1.0
403 # which accompanies this distribution, and is available at
404 # http://www.eclipse.org/legal/epl-v10.html
405 ##############################################################################
406 echo "---> create-netrc.sh"
408 # Ensure we fail the job if any steps fail.
411 NEXUS_URL="${NEXUSPROXY:-$NEXUS_URL}"
412 CREDENTIAL=$(xmlstarlet sel -N "x=http://maven.apache.org/SETTINGS/1.0.0" \
413 -t -m "/x:settings/x:servers/x:server[x:id='${SERVER_ID}']" \
414 -v x:username -o ":" -v x:password \
415 "$SETTINGS_FILE")
417 machine=$(echo "$NEXUS_URL" | awk -F/ '{print $3}')
418 user=$(echo "$CREDENTIAL" | cut -f1 -d:)
419 pass=$(echo "$CREDENTIAL" | cut -f2 -d:)
421 echo "machine ${machine%:*} login $user password $pass" > ~/.netrc
423 </hudson.tasks.Shell>
426 # SPDX-License-Identifier: EPL-1.0
427 ##############################################################################
428 # Copyright (c) 2017 The Linux Foundation and others.
430 # All rights reserved. This program and the accompanying materials
431 # are made available under the terms of the Eclipse Public License v1.0
432 # which accompanies this distribution, and is available at
433 # http://www.eclipse.org/legal/epl-v10.html
434 ##############################################################################
435 echo "---> lftools-install.sh"
437 # Script to install lftools via a version passed in via lf-infra-parameters
439 # Required parameters:
441 # LFTOOLS_VERSION: Passed in via lf-infra-parameters configuration. Can be
442 # set to a strict version number like '1.2.3' or using
443 # PEP-440 definitions.
447 # >=1.0.0,<2.0.0
449 # By default a released version of lftools should always be used.
450 # The purpose of the 2 variables below is so that lftools devs can test
451 # unreleased versions of lftools. There are 2 methods to install a dev version
454 # 1) gerrit patch: Used to test a patch that has not yet been merged.
455 # To do this set something like this:
456 # LFTOOLS_MODE=gerrit
457 # LFTOOLS_REFSPEC=refs/changes/96/5296/7
459 # 2) git branch: Used to install an lftools version from a specific branch.
460 # To use this set the variables as follows:
462 # LFTOOLS_REFSPEC=master
464 # 3) release : The intended use case and default setting.
465 # Set LFTOOLS_MODE=release, in this case LFTOOLS_REFSPEC is unused.
467 LFTOOLS_MODE=release # release | git | gerrit
468 LFTOOLS_REFSPEC=master
470 # Ensure we fail the job if any steps fail.
471 # DO NOT set -u as virtualenv's activate script has unbound variables
474 virtualenv --quiet "/tmp/v/lftools"
475 # shellcheck source=/tmp/v/lftools/bin/activate disable=SC1091
476 source "/tmp/v/lftools/bin/activate"
477 pip install --quiet --upgrade pip
479 case $LFTOOLS_MODE in
481 git clone https://gerrit.linuxfoundation.org/infra/releng/lftools.git /tmp/lftools
483 git fetch origin "$LFTOOLS_REFSPEC"
484 git checkout FETCH_HEAD
485 pip install --quiet --upgrade -r requirements.txt
486 pip install --quiet --upgrade -e .
491 pip install --quiet --upgrade git+https://gerrit.linuxfoundation.org/infra/releng/lftools.git@"$BRANCH"
495 if [[ $LFTOOLS_VERSION =~ ^[0-9] ]]; then
496 LFTOOLS_VERSION="==$LFTOOLS_VERSION"
499 pip install --quiet --upgrade "lftools${LFTOOLS_VERSION}"
505 # pipdeptree prints out a lot of information because lftools pulls in many
506 # dependencies. Let's only print it if we want to debug.
507 # echo "----> Pip Dependency Tree"
508 # pip install --quiet --upgrade pipdeptree
512 # SPDX-License-Identifier: EPL-1.0
513 ##############################################################################
514 # Copyright (c) 2017 The Linux Foundation and others.
516 # All rights reserved. This program and the accompanying materials
517 # are made available under the terms of the Eclipse Public License v1.0
518 # which accompanies this distribution, and is available at
519 # http://www.eclipse.org/legal/epl-v10.html
520 ##############################################################################
521 echo "---> logs-deploy.sh"
523 # Ensure we fail the job if any steps fail.
526 set -x # Trace commands for this script to make debugging easier.
528 ARCHIVE_ARTIFACTS="${ARCHIVE_ARTIFACTS:-}"
529 LOGS_SERVER="${LOGS_SERVER:-None}"
531 if [ "${LOGS_SERVER}" == 'None' ]
533 set +x # Disable trace since we no longer need it
535 echo "WARNING: Logging server not set"
537 NEXUS_URL="${NEXUSPROXY:-$NEXUS_URL}"
538 NEXUS_PATH="${SILO}/${JENKINS_HOSTNAME}/${JOB_NAME}/${BUILD_NUMBER}"
539 BUILD_URL="${BUILD_URL}"
541 lftools deploy archives -p "$ARCHIVE_ARTIFACTS" "$NEXUS_URL" "$NEXUS_PATH" "$WORKSPACE"
542 lftools deploy logs "$NEXUS_URL" "$NEXUS_PATH" "$BUILD_URL"
544 set +x # Disable trace since we no longer need it.
546 echo "Build logs: <a href=\"$LOGS_SERVER/$NEXUS_PATH\">$LOGS_SERVER/$NEXUS_PATH</a>"
549 </hudson.tasks.Shell>
552 # SPDX-License-Identifier: EPL-1.0
553 ##############################################################################
554 # Copyright (c) 2017 The Linux Foundation and others.
556 # All rights reserved. This program and the accompanying materials
557 # are made available under the terms of the Eclipse Public License v1.0
558 # which accompanies this distribution, and is available at
559 # http://www.eclipse.org/legal/epl-v10.html
560 ##############################################################################
562 # Clear log credential files
563 rm "$SETTINGS_FILE"
566 </hudson.tasks.Shell>
567 <hudson.plugins.descriptionsetter.DescriptionSetterBuilder>
568 <regexp>^Build logs: .*</regexp>
569 </hudson.plugins.descriptionsetter.DescriptionSetterBuilder>
571 <scriptOnlyIfSuccess>false</scriptOnlyIfSuccess>
572 <scriptOnlyIfFailure>false</scriptOnlyIfFailure>
573 <markBuildUnstable>false</markBuildUnstable>
574 </org.jenkinsci.plugins.postbuildscript.PostBuildScript>
575 <hudson.plugins.ws__cleanup.WsCleanup plugin="ws-cleanup">
577 <hudson.plugins.ws__cleanup.Pattern>
578 <pattern>**/*.jenkins-trigger</pattern>
580 </hudson.plugins.ws__cleanup.Pattern>
582 <deleteDirs>false</deleteDirs>
583 <cleanupMatrixParent>false</cleanupMatrixParent>
585 <cleanWhenSuccess>true</cleanWhenSuccess>
586 <cleanWhenUnstable>true</cleanWhenUnstable>
587 <cleanWhenFailure>true</cleanWhenFailure>
588 <cleanWhenNotBuilt>true</cleanWhenNotBuilt>
589 <cleanWhenAborted>true</cleanWhenAborted>
590 <notFailBuild>true</notFailBuild>
591 </hudson.plugins.ws__cleanup.WsCleanup>
594 <com.michelin.cio.hudson.plugins.maskpasswords.MaskPasswordsBuildWrapper/>
595 <hudson.plugins.build__timeout.BuildTimeoutWrapper>
596 <timeoutMinutes>10</timeoutMinutes>
597 <timeoutEnvVar>BUILD_TIMEOUT</timeoutEnvVar>
598 <failBuild>true</failBuild>
599 <writingDescription>false</writingDescription>
600 <timeoutPercentage>0</timeoutPercentage>
601 <timeoutMinutesElasticDefault>3</timeoutMinutesElasticDefault>
602 <timeoutType>absolute</timeoutType>
603 </hudson.plugins.build__timeout.BuildTimeoutWrapper>
604 <hudson.plugins.timestamper.TimestamperBuildWrapper/>
605 <com.cloudbees.jenkins.plugins.sshagent.SSHAgentBuildWrapper>
606 <user>test-credential</user>
607 </com.cloudbees.jenkins.plugins.sshagent.SSHAgentBuildWrapper>
608 <jenkins.plugins.openstack.compute.JCloudsOneOffSlave/>
609 <org.jenkinsci.plugins.configfiles.buildwrapper.ConfigFileBuildWrapper plugin="config-file-provider">
611 <org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
612 <fileId>npmrc</fileId>
613 <targetLocation>$HOME/.npmrc</targetLocation>
615 </org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
617 </org.jenkinsci.plugins.configfiles.buildwrapper.ConfigFileBuildWrapper>