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>
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.PluginPatchsetCreatedEvent>
175 <excludeDrafts>true</excludeDrafts>
176 <excludeTrivialRebase>false</excludeTrivialRebase>
177 <excludeNoCodeChange>false</excludeNoCodeChange>
178 </com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.events.PluginPatchsetCreatedEvent>
179 <com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.events.PluginDraftPublishedEvent/>
180 <com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.events.PluginCommentAddedContainsEvent>
181 <commentAddedCommentContains>recheck$</commentAddedCommentContains>
182 </com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.events.PluginCommentAddedContainsEvent>
185 <buildFailureMessage/>
186 <buildSuccessfulMessage/>
187 <buildUnstableMessage/>
188 <buildNotBuiltMessage/>
189 <buildUnsuccessfulFilepath/>
191 <serverName>test-server</serverName>
192 </com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.GerritTrigger>
195 <org.jenkinsci.plugins.configfiles.builder.ConfigFileBuildStep plugin="config-file-provider">
197 <org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
198 <fileId>jjbini</fileId>
199 <targetLocation>$HOME/.config/jenkins_jobs/jenkins_jobs.ini</targetLocation>
201 </org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
203 </org.jenkinsci.plugins.configfiles.builder.ConfigFileBuildStep>
206 # SPDX-License-Identifier: EPL-1.0
207 ##############################################################################
208 # Copyright (c) 2017 The Linux Foundation and others.
210 # All rights reserved. This program and the accompanying materials
211 # are made available under the terms of the Eclipse Public License v1.0
212 # which accompanies this distribution, and is available at
213 # http://www.eclipse.org/legal/epl-v10.html
214 ##############################################################################
216 # This script will make sure that there are no JIRA URLs in the commit
217 # message. JIRA URLs will break the its-jira plugin
219 # Ensure we fail the job if any steps fail.
220 # Do not treat undefined variables as errors as in this case we are allowed
221 # to have JIRA_URL undefined
225 if [ -n "${JIRA_URL}" ];
227 BASE_URL=$(echo $JIRA_URL | awk -F'/' '{print $3}')
228 JIRA_LINK=$(git rev-list --format=%B --max-count=1 HEAD | grep -io "http[s]*://$BASE_URL/" || true)
229 if [[ ! -z "$JIRA_LINK" ]]
231 echo 'Remove JIRA URLs from commit message'
232 echo 'Add jira references as: Issue: <JIRAKEY>-<ISSUE#>, instead of URLs'
238 # SPDX-License-Identifier: EPL-1.0
239 ##############################################################################
240 # Copyright (c) 2017 The Linux Foundation and others.
242 # All rights reserved. This program and the accompanying materials
243 # are made available under the terms of the Eclipse Public License v1.0
244 # which accompanies this distribution, and is available at
245 # http://www.eclipse.org/legal/epl-v10.html
246 ##############################################################################
247 echo "---> jjb-install.sh"
249 # Ensure we fail the job if any steps fail.
250 # DO NOT set -u as virtualenv's activate script has unbound variables
253 virtualenv "/tmp/v/jjb"
254 # shellcheck source=/tmp/v/jjb/bin/activate disable=SC1091
255 source "/tmp/v/jjb/bin/activate"
256 pip install --quiet --upgrade pip
257 pip install --quiet --upgrade pipdeptree
258 pip install --quiet --upgrade "jenkins-job-builder==$JJB_VERSION"
260 echo "----> Pip Dependency Tree"
264 # SPDX-License-Identifier: EPL-1.0
265 ##############################################################################
266 # Copyright (c) 2017 The Linux Foundation and others.
268 # All rights reserved. This program and the accompanying materials
269 # are made available under the terms of the Eclipse Public License v1.0
270 # which accompanies this distribution, and is available at
271 # http://www.eclipse.org/legal/epl-v10.html
272 ##############################################################################
273 echo "---> jjb-verify-job.sh"
275 # Ensure we fail the job if any steps fail.
278 jenkins-jobs -l DEBUG test --recursive -o archives/job-configs jjb/
280 # Sort job output into sub-directories. On large Jenkins systems that have
281 # many jobs archiving so many files into the same directory makes NGINX return
282 # the directory list slow.
283 pushd archives/job-configs
286 if [[ $(ls "$letter"* > /dev/null 2>&1) -eq 0 ]]
288 mkdir "$letter"
289 find . -maxdepth 1 -type f -name "$letter*" -exec mv {} "$letter" \;
295 # SPDX-License-Identifier: EPL-1.0
296 ##############################################################################
297 # Copyright (c) 2015 The Linux Foundation and others.
299 # All rights reserved. This program and the accompanying materials
300 # are made available under the terms of the Eclipse Public License v1.0
301 # which accompanies this distribution, and is available at
302 # http://www.eclipse.org/legal/epl-v10.html
303 ##############################################################################
304 echo "---> jjb-check-unicode.sh"
306 if LC_ALL=C grep --exclude=docs/ -r '[^[:print:][:space:]]' jjb/; then
307 echo "Found files containing non-ascii characters."
311 echo "All files are ASCII only"
313 </hudson.tasks.Shell>
316 # SPDX-License-Identifier: EPL-1.0
317 ##############################################################################
318 # Copyright (c) 2016 The Linux Foundation and others.
320 # All rights reserved. This program and the accompanying materials
321 # are made available under the terms of the Eclipse Public License v1.0
322 # which accompanies this distribution, and is available at
323 # http://www.eclipse.org/legal/epl-v10.html
324 ##############################################################################
325 echo "---> gpg-verify-git-signature.sh"
327 if git log --show-signature -1 | grep -E -q 'gpg: Signature made.*key ID'; then
328 echo "Git commit is GPG signed."
330 echo "WARNING: GPG signature missing for the commit."
333 # Do NOT fail the job for unsigned commits
336 </hudson.tasks.Shell>
339 <org.jenkinsci.plugins.postbuildscript.PostBuildScript>
343 # SPDX-License-Identifier: EPL-1.0
344 ##############################################################################
345 # Copyright (c) 2017 The Linux Foundation and others.
347 # All rights reserved. This program and the accompanying materials
348 # are made available under the terms of the Eclipse Public License v1.0
349 # which accompanies this distribution, and is available at
350 # http://www.eclipse.org/legal/epl-v10.html
351 ##############################################################################
352 echo "---> sysstat.sh"
353 set +e # DON'T fail build if script fails.
355 OS=$(facter operatingsystem)
356 case "$OS" in
358 SYSSTAT_PATH="/var/log/sysstat"
360 # Dont run the script when systat is not enabled by default
361 if ! grep --quiet 'ENABLED="true"' "/etc/default/sysstat"; then
366 SYSSTAT_PATH="/var/log/sa"
374 SAR_DIR="$WORKSPACE/archives/sar-reports"
375 mkdir -p "$SAR_DIR"
376 cp "$SYSSTAT_PATH/"* "$_"
377 # convert sar data to ascii format
378 while IFS="" read -r s
380 [ -f "$s" ] && LC_TIME=POSIX sar -A -f "$s" > "$SAR_DIR/sar${s//[!0-9]/}"
381 done < <(find "$SYSSTAT_PATH" -name "sa[0-9]*" || true)
383 # DON'T fail build if script fails.
386 </hudson.tasks.Shell>
387 <org.jenkinsci.plugins.configfiles.builder.ConfigFileBuildStep plugin="config-file-provider">
389 <org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
390 <fileId>jenkins-log-archives-settings</fileId>
392 <variable>SETTINGS_FILE</variable>
393 </org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
395 </org.jenkinsci.plugins.configfiles.builder.ConfigFileBuildStep>
398 <propertiesContent>SERVER_ID=logs</propertiesContent>
403 # SPDX-License-Identifier: EPL-1.0
404 ##############################################################################
405 # Copyright (c) 2017 The Linux Foundation and others.
407 # All rights reserved. This program and the accompanying materials
408 # are made available under the terms of the Eclipse Public License v1.0
409 # which accompanies this distribution, and is available at
410 # http://www.eclipse.org/legal/epl-v10.html
411 ##############################################################################
412 echo "---> create-netrc.sh"
414 # Ensure we fail the job if any steps fail.
417 NEXUS_URL="${NEXUS_URL:-$NEXUSPROXY}"
418 CREDENTIAL=$(xmlstarlet sel -N "x=http://maven.apache.org/SETTINGS/1.0.0" \
419 -t -m "/x:settings/x:servers/x:server[x:id='${SERVER_ID}']" \
420 -v x:username -o ":" -v x:password \
421 "$SETTINGS_FILE")
423 machine=$(echo "$NEXUS_URL" | awk -F/ '{print $3}')
424 user=$(echo "$CREDENTIAL" | cut -f1 -d:)
425 pass=$(echo "$CREDENTIAL" | cut -f2 -d:)
427 echo "machine $machine login $user password $pass" > ~/.netrc
429 </hudson.tasks.Shell>
432 # SPDX-License-Identifier: EPL-1.0
433 ##############################################################################
434 # Copyright (c) 2017 The Linux Foundation and others.
436 # All rights reserved. This program and the accompanying materials
437 # are made available under the terms of the Eclipse Public License v1.0
438 # which accompanies this distribution, and is available at
439 # http://www.eclipse.org/legal/epl-v10.html
440 ##############################################################################
441 echo "---> lftools-install.sh"
443 # Script to install lftools via a version passed in via lf-infra-parameters
445 # Required parameters:
447 # LFTOOLS_VERSION: Passed in via lf-infra-parameters configuration. Can be
448 # set to a strict version number like '1.2.3' or using
449 # PEP-440 definitions.
453 # >=1.0.0,<2.0.0
455 # By default a released version of lftools should always be used.
456 # The purpose of the 2 variables below is so that lftools devs can test
457 # unreleased versions of lftools. There are 2 methods to install a dev version
460 # 1) gerrit patch: Used to test a patch that has not yet been merged.
461 # To do this set something like this:
462 # LFTOOLS_MODE=gerrit
463 # LFTOOLS_REFSPEC=refs/changes/96/5296/7
465 # 2) git branch: Used to install an lftools version from a specific branch.
466 # To use this set the variables as follows:
468 # LFTOOLS_REFSPEC=master
470 # 3) release : The intended use case and default setting.
471 # Set LFTOOLS_MODE=release, in this case LFTOOLS_REFSPEC is unused.
473 LFTOOLS_MODE=release # release | git | gerrit
474 LFTOOLS_REFSPEC=master
476 # Ensure we fail the job if any steps fail.
477 # DO NOT set -u as virtualenv's activate script has unbound variables
480 virtualenv --quiet "/tmp/v/lftools"
481 # shellcheck source=/tmp/v/lftools/bin/activate disable=SC1091
482 source "/tmp/v/lftools/bin/activate"
483 pip install --quiet --upgrade pip
485 case $LFTOOLS_MODE in
487 git clone https://gerrit.linuxfoundation.org/infra/releng/lftools.git /tmp/lftools
489 git fetch origin "$LFTOOLS_REFSPEC"
490 git checkout FETCH_HEAD
491 pip install --quiet --upgrade -r requirements.txt
492 pip install --quiet --upgrade -e .
497 pip install --quiet --upgrade git+https://gerrit.linuxfoundation.org/infra/releng/lftools.git@"$BRANCH"
501 if [[ $LFTOOLS_VERSION =~ ^[0-9] ]]; then
502 LFTOOLS_VERSION="==$LFTOOLS_VERSION"
505 pip install --quiet --upgrade "lftools${LFTOOLS_VERSION}"
511 # pipdeptree prints out a lot of information because lftools pulls in many
512 # dependencies. Let's only print it if we want to debug.
513 # echo "----> Pip Dependency Tree"
514 # pip install --quiet --upgrade pipdeptree
518 # SPDX-License-Identifier: EPL-1.0
519 ##############################################################################
520 # Copyright (c) 2017 The Linux Foundation and others.
522 # All rights reserved. This program and the accompanying materials
523 # are made available under the terms of the Eclipse Public License v1.0
524 # which accompanies this distribution, and is available at
525 # http://www.eclipse.org/legal/epl-v10.html
526 ##############################################################################
527 echo "---> logs-deploy.sh"
529 # Ensure we fail the job if any steps fail.
532 set -x # Trace commands for this script to make debugging easier.
534 ARCHIVE_ARTIFACTS="${ARCHIVE_ARTIFACTS:-}"
535 LOGS_SERVER="${LOGS_SERVER:-None}"
537 if [ "${LOGS_SERVER}" == 'None' ]
539 set +x # Disable trace since we no longer need it
541 echo "WARNING: Logging server not set"
543 NEXUS_URL="${NEXUS_URL:-$NEXUSPROXY}"
544 NEXUS_PATH="${SILO}/${JENKINS_HOSTNAME}/${JOB_NAME}/${BUILD_NUMBER}"
545 BUILD_URL="${BUILD_URL}"
547 lftools deploy archives -p "$ARCHIVE_ARTIFACTS" "$NEXUS_URL" "$NEXUS_PATH" "$WORKSPACE"
548 lftools deploy logs "$NEXUS_URL" "$NEXUS_PATH" "$BUILD_URL"
550 set +x # Disable trace since we no longer need it.
552 echo "Build logs: <a href=\"$LOGS_SERVER/$NEXUS_PATH\">$LOGS_SERVER/$NEXUS_PATH</a>"
555 </hudson.tasks.Shell>
558 # SPDX-License-Identifier: EPL-1.0
559 ##############################################################################
560 # Copyright (c) 2017 The Linux Foundation and others.
562 # All rights reserved. This program and the accompanying materials
563 # are made available under the terms of the Eclipse Public License v1.0
564 # which accompanies this distribution, and is available at
565 # http://www.eclipse.org/legal/epl-v10.html
566 ##############################################################################
568 # Clear log credential files
569 rm "$SETTINGS_FILE"
572 </hudson.tasks.Shell>
573 <hudson.plugins.descriptionsetter.DescriptionSetterBuilder>
574 <regexp>^Build logs: .*</regexp>
575 </hudson.plugins.descriptionsetter.DescriptionSetterBuilder>
577 <scriptOnlyIfSuccess>false</scriptOnlyIfSuccess>
578 <scriptOnlyIfFailure>false</scriptOnlyIfFailure>
579 <markBuildUnstable>false</markBuildUnstable>
580 </org.jenkinsci.plugins.postbuildscript.PostBuildScript>
581 <hudson.plugins.ws__cleanup.WsCleanup plugin="ws-cleanup">
583 <hudson.plugins.ws__cleanup.Pattern>
584 <pattern>**/*.jenkins-trigger</pattern>
586 </hudson.plugins.ws__cleanup.Pattern>
588 <deleteDirs>false</deleteDirs>
589 <cleanupMatrixParent>false</cleanupMatrixParent>
591 <cleanWhenSuccess>true</cleanWhenSuccess>
592 <cleanWhenUnstable>true</cleanWhenUnstable>
593 <cleanWhenFailure>true</cleanWhenFailure>
594 <cleanWhenNotBuilt>true</cleanWhenNotBuilt>
595 <cleanWhenAborted>true</cleanWhenAborted>
596 <notFailBuild>true</notFailBuild>
597 </hudson.plugins.ws__cleanup.WsCleanup>
600 <com.michelin.cio.hudson.plugins.maskpasswords.MaskPasswordsBuildWrapper/>
601 <hudson.plugins.build__timeout.BuildTimeoutWrapper>
602 <timeoutMinutes>10</timeoutMinutes>
603 <timeoutEnvVar>BUILD_TIMEOUT</timeoutEnvVar>
604 <failBuild>true</failBuild>
605 <writingDescription>false</writingDescription>
606 <timeoutPercentage>0</timeoutPercentage>
607 <timeoutMinutesElasticDefault>3</timeoutMinutesElasticDefault>
608 <timeoutType>absolute</timeoutType>
609 </hudson.plugins.build__timeout.BuildTimeoutWrapper>
610 <hudson.plugins.timestamper.TimestamperBuildWrapper/>
611 <com.cloudbees.jenkins.plugins.sshagent.SSHAgentBuildWrapper>
612 <user>test-credential</user>
613 </com.cloudbees.jenkins.plugins.sshagent.SSHAgentBuildWrapper>
614 <jenkins.plugins.openstack.compute.JCloudsOneOffSlave/>