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>
100 <buildChooser class="com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.GerritTriggerBuildChooser"/>
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.PluginPatchsetCreatedEvent>
171 <excludeDrafts>false</excludeDrafts>
172 <excludeTrivialRebase>false</excludeTrivialRebase>
173 <excludeNoCodeChange>false</excludeNoCodeChange>
174 </com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.events.PluginPatchsetCreatedEvent>
175 <com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.events.PluginDraftPublishedEvent/>
176 <com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.events.PluginCommentAddedContainsEvent>
177 <commentAddedCommentContains>recheck$</commentAddedCommentContains>
178 </com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.events.PluginCommentAddedContainsEvent>
181 <buildFailureMessage/>
182 <buildSuccessfulMessage/>
183 <buildUnstableMessage/>
184 <buildNotBuiltMessage/>
185 <buildUnsuccessfulFilepath/>
187 <serverName>test-server</serverName>
188 </com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.GerritTrigger>
191 <org.jenkinsci.plugins.configfiles.builder.ConfigFileBuildStep plugin="config-file-provider">
193 <org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
194 <fileId>jjbini</fileId>
195 <targetLocation>$HOME/.config/jenkins_jobs/jenkins_jobs.ini</targetLocation>
197 </org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
199 </org.jenkinsci.plugins.configfiles.builder.ConfigFileBuildStep>
202 # SPDX-License-Identifier: EPL-1.0
203 ##############################################################################
204 # Copyright (c) 2017 The Linux Foundation and others.
206 # All rights reserved. This program and the accompanying materials
207 # are made available under the terms of the Eclipse Public License v1.0
208 # which accompanies this distribution, and is available at
209 # http://www.eclipse.org/legal/epl-v10.html
210 ##############################################################################
212 # This script will make sure that there are no JIRA URLs in the commit
213 # message. JIRA URLs will break the its-jira plugin
215 # Ensure we fail the job if any steps fail.
216 # Do not treat undefined variables as errors as in this case we are allowed
217 # to have JIRA_URL undefined
221 if [ -n "${JIRA_URL}" ];
223 BASE_URL=$(echo $JIRA_URL | awk -F'/' '{print $3}')
224 JIRA_LINK=$(git rev-list --format=%B --max-count=1 HEAD | grep -io "http[s]*://$BASE_URL/" || true)
225 if [[ ! -z "$JIRA_LINK" ]]
227 echo 'Remove JIRA URLs from commit message'
228 echo 'Add jira references as: Issue: <JIRAKEY>-<ISSUE#>, instead of URLs'
234 # SPDX-License-Identifier: EPL-1.0
235 ##############################################################################
236 # Copyright (c) 2017 The Linux Foundation and others.
238 # All rights reserved. This program and the accompanying materials
239 # are made available under the terms of the Eclipse Public License v1.0
240 # which accompanies this distribution, and is available at
241 # http://www.eclipse.org/legal/epl-v10.html
242 ##############################################################################
243 echo "---> jjb-install.sh"
245 # Ensure we fail the job if any steps fail.
246 # DO NOT set -u as virtualenv's activate script has unbound variables
249 virtualenv "/tmp/v/jjb"
250 # shellcheck source=/tmp/v/jjb/bin/activate disable=SC1091
251 source "/tmp/v/jjb/bin/activate"
252 pip install --quiet --upgrade pip
253 pip install --quiet --upgrade pipdeptree
254 pip install --quiet --upgrade "jenkins-job-builder==$JJB_VERSION"
256 echo "----> Pip Dependency Tree"
260 # SPDX-License-Identifier: EPL-1.0
261 ##############################################################################
262 # Copyright (c) 2017 The Linux Foundation and others.
264 # All rights reserved. This program and the accompanying materials
265 # are made available under the terms of the Eclipse Public License v1.0
266 # which accompanies this distribution, and is available at
267 # http://www.eclipse.org/legal/epl-v10.html
268 ##############################################################################
269 echo "---> jjb-verify-job.sh"
271 # Ensure we fail the job if any steps fail.
274 jenkins-jobs -l DEBUG test --recursive -o archives/job-configs --exclude jjb-test jjb
276 # Sort job output into sub-directories. On large Jenkins systems that have
277 # many jobs archiving so many files into the same directory makes NGINX return
278 # the directory list slow.
279 pushd archives/job-configs
282 if [[ $(ls "$letter"* > /dev/null 2>&1) -eq 0 ]]
284 mkdir "$letter"
285 find . -maxdepth 1 -type f -name "$letter*" -exec mv {} "$letter" \;
291 # SPDX-License-Identifier: EPL-1.0
292 ##############################################################################
293 # Copyright (c) 2015 The Linux Foundation and others.
295 # All rights reserved. This program and the accompanying materials
296 # are made available under the terms of the Eclipse Public License v1.0
297 # which accompanies this distribution, and is available at
298 # http://www.eclipse.org/legal/epl-v10.html
299 ##############################################################################
300 echo "---> jjb-check-unicode.sh"
302 if LC_ALL=C grep -r '[^[:print:][:space:]]' jjb/; then
303 echo "Found files containing non-ascii characters."
307 echo "All files are ASCII only"
309 </hudson.tasks.Shell>
312 # SPDX-License-Identifier: EPL-1.0
313 ##############################################################################
314 # Copyright (c) 2016 The Linux Foundation and others.
316 # All rights reserved. This program and the accompanying materials
317 # are made available under the terms of the Eclipse Public License v1.0
318 # which accompanies this distribution, and is available at
319 # http://www.eclipse.org/legal/epl-v10.html
320 ##############################################################################
321 echo "---> gpg-verify-git-signature.sh"
323 if git log --show-signature -1 | grep -E -q 'gpg: Signature made.*key ID'; then
324 echo "Git commit is GPG signed."
326 echo "WARNING: GPG signature missing for the commit."
329 # Do NOT fail the job for unsigned commits
332 </hudson.tasks.Shell>
335 <org.jenkinsci.plugins.postbuildscript.PostBuildScript>
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 "---> sysstat.sh"
349 set +e # DON'T fail build if script fails.
351 OS=$(facter operatingsystem)
352 case "$OS" in
354 SYSSTAT_PATH="/var/log/sysstat"
356 # Dont run the script when systat is not enabled by default
357 if ! grep --quiet 'ENABLED="true"' "/etc/default/sysstat"; then
362 SYSSTAT_PATH="/var/log/sa"
370 SAR_DIR="$WORKSPACE/archives/sar-reports"
371 mkdir -p "$SAR_DIR"
372 cp "$SYSSTAT_PATH/"* "$_"
373 # convert sar data to ascii format
374 while IFS="" read -r s
376 [ -f "$s" ] && LC_TIME=POSIX sar -A -f "$s" > "$SAR_DIR/sar${s//[!0-9]/}"
377 done < <(find "$SYSSTAT_PATH" -name "sa[0-9]*" || true)
379 # DON'T fail build if script fails.
382 </hudson.tasks.Shell>
383 <org.jenkinsci.plugins.configfiles.builder.ConfigFileBuildStep plugin="config-file-provider">
385 <org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
386 <fileId>jenkins-log-archives-settings</fileId>
388 <variable>SETTINGS_FILE</variable>
389 </org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
391 </org.jenkinsci.plugins.configfiles.builder.ConfigFileBuildStep>
394 <propertiesContent>SERVER_ID=logs</propertiesContent>
399 # SPDX-License-Identifier: EPL-1.0
400 ##############################################################################
401 # Copyright (c) 2017 The Linux Foundation and others.
403 # All rights reserved. This program and the accompanying materials
404 # are made available under the terms of the Eclipse Public License v1.0
405 # which accompanies this distribution, and is available at
406 # http://www.eclipse.org/legal/epl-v10.html
407 ##############################################################################
408 echo "---> create-netrc.sh"
410 # Ensure we fail the job if any steps fail.
413 NEXUS_URL="${NEXUS_URL:-$NEXUSPROXY}"
414 CREDENTIAL=$(xmlstarlet sel -N "x=http://maven.apache.org/SETTINGS/1.0.0" \
415 -t -m "/x:settings/x:servers/x:server[x:id='${SERVER_ID}']" \
416 -v x:username -o ":" -v x:password \
417 "$SETTINGS_FILE")
419 machine=$(echo "$NEXUS_URL" | awk -F/ '{print $3}')
420 user=$(echo "$CREDENTIAL" | cut -f1 -d:)
421 pass=$(echo "$CREDENTIAL" | cut -f2 -d:)
423 echo "machine $machine login $user password $pass" > ~/.netrc
425 </hudson.tasks.Shell>
428 # SPDX-License-Identifier: EPL-1.0
429 ##############################################################################
430 # Copyright (c) 2017 The Linux Foundation and others.
432 # All rights reserved. This program and the accompanying materials
433 # are made available under the terms of the Eclipse Public License v1.0
434 # which accompanies this distribution, and is available at
435 # http://www.eclipse.org/legal/epl-v10.html
436 ##############################################################################
437 echo "---> lftools-install.sh"
439 # Script to install lftools via a version passed in via lf-infra-parameters
441 # Required parameters:
443 # LFTOOLS_VERSION: Passed in via lf-infra-parameters configuration. Can be
444 # set to a strict version number like '1.2.3' or using
445 # PEP-440 definitions.
449 # >=1.0.0,<2.0.0
451 # By default a released version of lftools should always be used.
452 # The purpose of the 2 variables below is so that lftools devs can test
453 # unreleased versions of lftools. There are 2 methods to install a dev version
456 # 1) gerrit patch: Used to test a patch that has not yet been merged.
457 # To do this set something like this:
458 # LFTOOLS_MODE=gerrit
459 # LFTOOLS_REFSPEC=refs/changes/96/5296/7
461 # 2) git branch: Used to install an lftools version from a specific branch.
462 # To use this set the variables as follows:
464 # LFTOOLS_REFSPEC=master
466 # 3) release : The intended use case and default setting.
467 # Set LFTOOLS_MODE=release, in this case LFTOOLS_REFSPEC is unused.
469 LFTOOLS_MODE=release # release | git | gerrit
470 LFTOOLS_REFSPEC=master
472 # Ensure we fail the job if any steps fail.
473 # DO NOT set -u as virtualenv's activate script has unbound variables
476 virtualenv --quiet "/tmp/v/lftools"
477 # shellcheck source=/tmp/v/lftools/bin/activate disable=SC1091
478 source "/tmp/v/lftools/bin/activate"
479 pip install --quiet --upgrade pip
481 case $LFTOOLS_MODE in
483 git clone https://gerrit.linuxfoundation.org/infra/releng/lftools.git /tmp/lftools
485 git fetch origin "$LFTOOLS_REFSPEC"
486 git checkout FETCH_HEAD
487 pip install --quiet --upgrade -r requirements.txt
488 pip install --quiet --upgrade -e .
493 pip install --quiet --upgrade git+https://gerrit.linuxfoundation.org/infra/releng/lftools.git@"$BRANCH"
497 if [[ $LFTOOLS_VERSION =~ ^[0-9] ]]; then
498 LFTOOLS_VERSION="==$LFTOOLS_VERSION"
501 pip install --quiet --upgrade "lftools${LFTOOLS_VERSION}"
507 # pipdeptree prints out a lot of information because lftools pulls in many
508 # dependencies. Let's only print it if we want to debug.
509 # echo "----> Pip Dependency Tree"
510 # pip install --quiet --upgrade pipdeptree
514 # SPDX-License-Identifier: EPL-1.0
515 ##############################################################################
516 # Copyright (c) 2017 The Linux Foundation and others.
518 # All rights reserved. This program and the accompanying materials
519 # are made available under the terms of the Eclipse Public License v1.0
520 # which accompanies this distribution, and is available at
521 # http://www.eclipse.org/legal/epl-v10.html
522 ##############################################################################
523 echo "---> logs-deploy.sh"
525 # Ensure we fail the job if any steps fail.
528 set -x # Trace commands for this script to make debugging easier.
530 ARCHIVE_ARTIFACTS="${ARCHIVE_ARTIFACTS:-}"
531 LOGS_SERVER="${LOGS_SERVER:-None}"
533 if [ "${LOGS_SERVER}" == 'None' ]
535 set +x # Disable trace since we no longer need it
537 echo "WARNING: Logging server not set"
539 NEXUS_URL="${NEXUS_URL:-$NEXUSPROXY}"
540 NEXUS_PATH="${SILO}/${JENKINS_HOSTNAME}/${JOB_NAME}/${BUILD_NUMBER}"
541 BUILD_URL="${BUILD_URL}"
543 lftools deploy archives -p "$ARCHIVE_ARTIFACTS" "$NEXUS_URL" "$NEXUS_PATH" "$WORKSPACE"
544 lftools deploy logs "$NEXUS_URL" "$NEXUS_PATH" "$BUILD_URL"
546 set +x # Disable trace since we no longer need it.
548 echo "Build logs: <a href=\"$LOGS_SERVER/$NEXUS_PATH\">$LOGS_SERVER/$NEXUS_PATH</a>"
551 </hudson.tasks.Shell>
554 # SPDX-License-Identifier: EPL-1.0
555 ##############################################################################
556 # Copyright (c) 2017 The Linux Foundation and others.
558 # All rights reserved. This program and the accompanying materials
559 # are made available under the terms of the Eclipse Public License v1.0
560 # which accompanies this distribution, and is available at
561 # http://www.eclipse.org/legal/epl-v10.html
562 ##############################################################################
564 # Clear log credential files
565 rm "$SETTINGS_FILE"
568 </hudson.tasks.Shell>
569 <hudson.plugins.descriptionsetter.DescriptionSetterBuilder>
570 <regexp>^Build logs: .*</regexp>
571 </hudson.plugins.descriptionsetter.DescriptionSetterBuilder>
573 <scriptOnlyIfSuccess>false</scriptOnlyIfSuccess>
574 <scriptOnlyIfFailure>false</scriptOnlyIfFailure>
575 <markBuildUnstable>false</markBuildUnstable>
576 </org.jenkinsci.plugins.postbuildscript.PostBuildScript>
577 <hudson.plugins.ws__cleanup.WsCleanup plugin="ws-cleanup">
579 <hudson.plugins.ws__cleanup.Pattern>
580 <pattern>**/*.jenkins-trigger</pattern>
582 </hudson.plugins.ws__cleanup.Pattern>
584 <deleteDirs>false</deleteDirs>
585 <cleanupMatrixParent>false</cleanupMatrixParent>
587 <cleanWhenSuccess>true</cleanWhenSuccess>
588 <cleanWhenUnstable>true</cleanWhenUnstable>
589 <cleanWhenFailure>true</cleanWhenFailure>
590 <cleanWhenNotBuilt>true</cleanWhenNotBuilt>
591 <cleanWhenAborted>true</cleanWhenAborted>
592 <notFailBuild>true</notFailBuild>
593 </hudson.plugins.ws__cleanup.WsCleanup>
596 <com.michelin.cio.hudson.plugins.maskpasswords.MaskPasswordsBuildWrapper/>
597 <hudson.plugins.build__timeout.BuildTimeoutWrapper>
598 <timeoutMinutes>10</timeoutMinutes>
599 <timeoutEnvVar>BUILD_TIMEOUT</timeoutEnvVar>
600 <failBuild>true</failBuild>
601 <writingDescription>false</writingDescription>
602 <timeoutPercentage>0</timeoutPercentage>
603 <timeoutMinutesElasticDefault>3</timeoutMinutesElasticDefault>
604 <timeoutType>absolute</timeoutType>
605 </hudson.plugins.build__timeout.BuildTimeoutWrapper>
606 <hudson.plugins.timestamper.TimestamperBuildWrapper/>
607 <com.cloudbees.jenkins.plugins.sshagent.SSHAgentBuildWrapper>
608 <user>test-credential</user>
609 </com.cloudbees.jenkins.plugins.sshagent.SSHAgentBuildWrapper>
610 <jenkins.plugins.openstack.compute.JCloudsOneOffSlave/>