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 <com.coravy.hudson.plugins.github.GithubProjectProperty>
13 <projectUrl>https://github.com/example-org/releng/ciman</projectUrl>
14 </com.coravy.hudson.plugins.github.GithubProjectProperty>
15 <hudson.model.ParametersDefinitionProperty>
16 <parameterDefinitions>
17 <hudson.model.StringParameterDefinition>
19 <description>Parameter to identify a Gerrit project. This is typically the
20 project repo path as exists in Gerrit.
21 For example: ofextensions/circuitsw
23 <defaultValue>releng/ciman</defaultValue>
24 </hudson.model.StringParameterDefinition>
25 <hudson.model.StringParameterDefinition>
27 <description>Stream is often set to the same name as 'branch' but can
28 sometimes be used as a name representing a project's release code
31 <defaultValue>master</defaultValue>
32 </hudson.model.StringParameterDefinition>
33 <hudson.model.StringParameterDefinition>
34 <name>GERRIT_PROJECT</name>
35 <description>Parameter to identify Gerrit project. This is typically the
36 project repo path as exists in Gerrit.
37 For example: ofextensions/circuitsw
39 Note that Gerrit will override this parameter automatically if a
40 job is triggered by Gerrit.
42 <defaultValue>releng/ciman</defaultValue>
43 </hudson.model.StringParameterDefinition>
44 <hudson.model.StringParameterDefinition>
45 <name>GERRIT_BRANCH</name>
46 <description>Parameter to identify a Gerrit branch.
48 Note that Gerrit will override this parameter automatically if a
49 job is triggered by Gerrit.
51 <defaultValue>master</defaultValue>
52 </hudson.model.StringParameterDefinition>
53 <hudson.model.StringParameterDefinition>
54 <name>GERRIT_REFSPEC</name>
55 <description>Parameter to identify a refspec when pulling from Gerrit.
57 Note that Gerrit will override this parameter automatically if a
58 job is triggered by Gerrit.
60 <defaultValue>refs/heads/master</defaultValue>
61 </hudson.model.StringParameterDefinition>
62 <hudson.model.StringParameterDefinition>
63 <name>LFTOOLS_VERSION</name>
64 <description>Version of lftools to install. Can be a specific version like
65 '0.6.0' or a PEP-440 definition.
66 https://www.python.org/dev/peps/pep-0440/
67 For example '<1.0.0' or '>=1.0.0,<2.0.0'.
69 <defaultValue><1.0.0</defaultValue>
70 </hudson.model.StringParameterDefinition>
71 <hudson.model.StringParameterDefinition>
72 <name>JJB_VERSION</name>
73 <description>Jenkins Job Builder version to download and install.</description>
74 <defaultValue>1.6.2</defaultValue>
75 </hudson.model.StringParameterDefinition>
76 </parameterDefinitions>
77 </hudson.model.ParametersDefinitionProperty>
79 <scm class="hudson.plugins.git.GitSCM">
80 <configVersion>2</configVersion>
82 <hudson.plugins.git.UserRemoteConfig>
84 <refspec>+refs/pull/*:refs/remotes/origin/pr/*</refspec>
85 <url>git@github.com:example-org/releng/ciman</url>
86 <credentialsId>test-credential</credentialsId>
87 </hudson.plugins.git.UserRemoteConfig>
90 <hudson.plugins.git.BranchSpec>
92 </hudson.plugins.git.BranchSpec>
95 <buildChooser class="hudson.plugins.git.util.DefaultBuildChooser"/>
96 <doGenerateSubmoduleConfigurations>false</doGenerateSubmoduleConfigurations>
97 <authorOrCommitter>false</authorOrCommitter>
98 <wipeOutWorkspace>true</wipeOutWorkspace>
99 <pruneBranches>false</pruneBranches>
100 <remotePoll>false</remotePoll>
101 <gitTool>Default</gitTool>
102 <submoduleCfg class="list"/>
107 <skipTag>true</skipTag>
109 <useShallowClone>false</useShallowClone>
110 <ignoreNotifyCommit>false</ignoreNotifyCommit>
112 <hudson.plugins.git.extensions.impl.SubmoduleOption>
113 <disableSubmodules>false</disableSubmodules>
114 <recursiveSubmodules>true</recursiveSubmodules>
115 <trackingSubmodules>false</trackingSubmodules>
117 <timeout>10</timeout>
118 </hudson.plugins.git.extensions.impl.SubmoduleOption>
119 <hudson.plugins.git.extensions.impl.WipeWorkspace/>
122 <triggers class="vector">
123 <org.jenkinsci.plugins.ghprb.GhprbTrigger>
126 <allowMembersOfWhitelistedOrgsAsAdmin>false</allowMembersOfWhitelistedOrgsAsAdmin>
130 <triggerPhrase>^recheck$</triggerPhrase>
131 <onlyTriggerPhrase>false</onlyTriggerPhrase>
132 <useGitHubHooks>true</useGitHubHooks>
133 <permitAll>true</permitAll>
134 <autoCloseFailedPullRequests>false</autoCloseFailedPullRequests>
136 <org.jenkinsci.plugins.ghprb.extensions.status.GhprbSimpleStatus>
137 <commitStatusContext>JJB Verify</commitStatusContext>
138 </org.jenkinsci.plugins.ghprb.extensions.status.GhprbSimpleStatus>
140 </org.jenkinsci.plugins.ghprb.GhprbTrigger>
143 <org.jenkinsci.plugins.configfiles.builder.ConfigFileBuildStep plugin="config-file-provider">
145 <org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
146 <fileId>jjbini</fileId>
147 <targetLocation>$HOME/.config/jenkins_jobs/jenkins_jobs.ini</targetLocation>
149 </org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
151 </org.jenkinsci.plugins.configfiles.builder.ConfigFileBuildStep>
154 # SPDX-License-Identifier: EPL-1.0
155 ##############################################################################
156 # Copyright (c) 2017 The Linux Foundation and others.
158 # All rights reserved. This program and the accompanying materials
159 # are made available under the terms of the Eclipse Public License v1.0
160 # which accompanies this distribution, and is available at
161 # http://www.eclipse.org/legal/epl-v10.html
162 ##############################################################################
164 # This script will make sure that there are no JIRA URLs in the commit
165 # message. JIRA URLs will break the its-jira plugin
167 # Ensure we fail the job if any steps fail.
168 # Do not treat undefined variables as errors as in this case we are allowed
169 # to have JIRA_URL undefined
173 if [ -n "${JIRA_URL}" ];
175 BASE_URL=$(echo $JIRA_URL | awk -F'/' '{print $3}')
176 JIRA_LINK=$(git rev-list --format=%B --max-count=1 HEAD | grep -io "http[s]*://$BASE_URL/" || true)
177 if [[ ! -z "$JIRA_LINK" ]]
179 echo 'Remove JIRA URLs from commit message'
180 echo 'Add jira references as: Issue: <JIRAKEY>-<ISSUE#>, instead of URLs'
186 # SPDX-License-Identifier: EPL-1.0
187 ##############################################################################
188 # Copyright (c) 2017 The Linux Foundation and others.
190 # All rights reserved. This program and the accompanying materials
191 # are made available under the terms of the Eclipse Public License v1.0
192 # which accompanies this distribution, and is available at
193 # http://www.eclipse.org/legal/epl-v10.html
194 ##############################################################################
195 echo "---> jjb-install.sh"
197 # Ensure we fail the job if any steps fail.
198 # DO NOT set -u as virtualenv's activate script has unbound variables
201 virtualenv "/tmp/v/jjb"
202 # shellcheck source=/tmp/v/jjb/bin/activate disable=SC1091
203 source "/tmp/v/jjb/bin/activate"
204 pip install --quiet --upgrade pip
205 pip install --quiet --upgrade pipdeptree
206 pip install --quiet --upgrade "jenkins-job-builder==$JJB_VERSION"
208 echo "----> Pip Dependency Tree"
212 # SPDX-License-Identifier: EPL-1.0
213 ##############################################################################
214 # Copyright (c) 2017 The Linux Foundation and others.
216 # All rights reserved. This program and the accompanying materials
217 # are made available under the terms of the Eclipse Public License v1.0
218 # which accompanies this distribution, and is available at
219 # http://www.eclipse.org/legal/epl-v10.html
220 ##############################################################################
221 echo "---> jjb-verify-job.sh"
223 # Ensure we fail the job if any steps fail.
226 jenkins-jobs -l DEBUG test --recursive -o archives/job-configs jjb/
228 # Sort job output into sub-directories. On large Jenkins systems that have
229 # many jobs archiving so many files into the same directory makes NGINX return
230 # the directory list slow.
231 pushd archives/job-configs
234 if [[ $(ls "$letter"* > /dev/null 2>&1) -eq 0 ]]
236 mkdir "$letter"
237 find . -maxdepth 1 -type f -name "$letter*" -exec mv {} "$letter" \;
243 # SPDX-License-Identifier: EPL-1.0
244 ##############################################################################
245 # Copyright (c) 2015 The Linux Foundation and others.
247 # All rights reserved. This program and the accompanying materials
248 # are made available under the terms of the Eclipse Public License v1.0
249 # which accompanies this distribution, and is available at
250 # http://www.eclipse.org/legal/epl-v10.html
251 ##############################################################################
252 echo "---> jjb-check-unicode.sh"
254 if LC_ALL=C grep --exclude=docs/ -r '[^[:print:][:space:]]' jjb/; then
255 echo "Found files containing non-ascii characters."
259 echo "All files are ASCII only"
261 </hudson.tasks.Shell>
264 # SPDX-License-Identifier: EPL-1.0
265 ##############################################################################
266 # Copyright (c) 2016 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 "---> gpg-verify-git-signature.sh"
275 if git log --show-signature -1 | grep -E -q 'gpg: Signature made.*key ID'; then
276 echo "Git commit is GPG signed."
278 echo "WARNING: GPG signature missing for the commit."
281 # Do NOT fail the job for unsigned commits
284 </hudson.tasks.Shell>
287 <org.jenkinsci.plugins.postbuildscript.PostBuildScript>
291 # SPDX-License-Identifier: EPL-1.0
292 ##############################################################################
293 # Copyright (c) 2017 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 "---> sysstat.sh"
301 set +e # DON'T fail build if script fails.
303 OS=$(facter operatingsystem)
304 case "$OS" in
306 SYSSTAT_PATH="/var/log/sysstat"
308 # Dont run the script when systat is not enabled by default
309 if ! grep --quiet 'ENABLED="true"' "/etc/default/sysstat"; then
314 SYSSTAT_PATH="/var/log/sa"
322 SAR_DIR="$WORKSPACE/archives/sar-reports"
323 mkdir -p "$SAR_DIR"
324 cp "$SYSSTAT_PATH/"* "$_"
325 # convert sar data to ascii format
326 while IFS="" read -r s
328 [ -f "$s" ] && LC_TIME=POSIX sar -A -f "$s" > "$SAR_DIR/sar${s//[!0-9]/}"
329 done < <(find "$SYSSTAT_PATH" -name "sa[0-9]*" || true)
331 # DON'T fail build if script fails.
334 </hudson.tasks.Shell>
335 <org.jenkinsci.plugins.configfiles.builder.ConfigFileBuildStep plugin="config-file-provider">
337 <org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
338 <fileId>jenkins-log-archives-settings</fileId>
340 <variable>SETTINGS_FILE</variable>
341 </org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
343 </org.jenkinsci.plugins.configfiles.builder.ConfigFileBuildStep>
346 <propertiesContent>SERVER_ID=logs</propertiesContent>
351 # SPDX-License-Identifier: EPL-1.0
352 ##############################################################################
353 # Copyright (c) 2017 The Linux Foundation and others.
355 # All rights reserved. This program and the accompanying materials
356 # are made available under the terms of the Eclipse Public License v1.0
357 # which accompanies this distribution, and is available at
358 # http://www.eclipse.org/legal/epl-v10.html
359 ##############################################################################
360 echo "---> create-netrc.sh"
362 # Ensure we fail the job if any steps fail.
365 NEXUS_URL="${NEXUS_URL:-$NEXUSPROXY}"
366 CREDENTIAL=$(xmlstarlet sel -N "x=http://maven.apache.org/SETTINGS/1.0.0" \
367 -t -m "/x:settings/x:servers/x:server[x:id='${SERVER_ID}']" \
368 -v x:username -o ":" -v x:password \
369 "$SETTINGS_FILE")
371 machine=$(echo "$NEXUS_URL" | awk -F/ '{print $3}')
372 user=$(echo "$CREDENTIAL" | cut -f1 -d:)
373 pass=$(echo "$CREDENTIAL" | cut -f2 -d:)
375 echo "machine $machine login $user password $pass" > ~/.netrc
377 </hudson.tasks.Shell>
380 # SPDX-License-Identifier: EPL-1.0
381 ##############################################################################
382 # Copyright (c) 2017 The Linux Foundation and others.
384 # All rights reserved. This program and the accompanying materials
385 # are made available under the terms of the Eclipse Public License v1.0
386 # which accompanies this distribution, and is available at
387 # http://www.eclipse.org/legal/epl-v10.html
388 ##############################################################################
389 echo "---> lftools-install.sh"
391 # Script to install lftools via a version passed in via lf-infra-parameters
393 # Required parameters:
395 # LFTOOLS_VERSION: Passed in via lf-infra-parameters configuration. Can be
396 # set to a strict version number like '1.2.3' or using
397 # PEP-440 definitions.
401 # >=1.0.0,<2.0.0
403 # By default a released version of lftools should always be used.
404 # The purpose of the 2 variables below is so that lftools devs can test
405 # unreleased versions of lftools. There are 2 methods to install a dev version
408 # 1) gerrit patch: Used to test a patch that has not yet been merged.
409 # To do this set something like this:
410 # LFTOOLS_MODE=gerrit
411 # LFTOOLS_REFSPEC=refs/changes/96/5296/7
413 # 2) git branch: Used to install an lftools version from a specific branch.
414 # To use this set the variables as follows:
416 # LFTOOLS_REFSPEC=master
418 # 3) release : The intended use case and default setting.
419 # Set LFTOOLS_MODE=release, in this case LFTOOLS_REFSPEC is unused.
421 LFTOOLS_MODE=release # release | git | gerrit
422 LFTOOLS_REFSPEC=master
424 # Ensure we fail the job if any steps fail.
425 # DO NOT set -u as virtualenv's activate script has unbound variables
428 virtualenv --quiet "/tmp/v/lftools"
429 # shellcheck source=/tmp/v/lftools/bin/activate disable=SC1091
430 source "/tmp/v/lftools/bin/activate"
431 pip install --quiet --upgrade pip
433 case $LFTOOLS_MODE in
435 git clone https://gerrit.linuxfoundation.org/infra/releng/lftools.git /tmp/lftools
437 git fetch origin "$LFTOOLS_REFSPEC"
438 git checkout FETCH_HEAD
439 pip install --quiet --upgrade -r requirements.txt
440 pip install --quiet --upgrade -e .
445 pip install --quiet --upgrade git+https://gerrit.linuxfoundation.org/infra/releng/lftools.git@"$BRANCH"
449 if [[ $LFTOOLS_VERSION =~ ^[0-9] ]]; then
450 LFTOOLS_VERSION="==$LFTOOLS_VERSION"
453 pip install --quiet --upgrade "lftools${LFTOOLS_VERSION}"
459 # pipdeptree prints out a lot of information because lftools pulls in many
460 # dependencies. Let's only print it if we want to debug.
461 # echo "----> Pip Dependency Tree"
462 # pip install --quiet --upgrade pipdeptree
466 # SPDX-License-Identifier: EPL-1.0
467 ##############################################################################
468 # Copyright (c) 2017 The Linux Foundation and others.
470 # All rights reserved. This program and the accompanying materials
471 # are made available under the terms of the Eclipse Public License v1.0
472 # which accompanies this distribution, and is available at
473 # http://www.eclipse.org/legal/epl-v10.html
474 ##############################################################################
475 echo "---> logs-deploy.sh"
477 # Ensure we fail the job if any steps fail.
480 set -x # Trace commands for this script to make debugging easier.
482 ARCHIVE_ARTIFACTS="${ARCHIVE_ARTIFACTS:-}"
483 LOGS_SERVER="${LOGS_SERVER:-None}"
485 if [ "${LOGS_SERVER}" == 'None' ]
487 set +x # Disable trace since we no longer need it
489 echo "WARNING: Logging server not set"
491 NEXUS_URL="${NEXUS_URL:-$NEXUSPROXY}"
492 NEXUS_PATH="${SILO}/${JENKINS_HOSTNAME}/${JOB_NAME}/${BUILD_NUMBER}"
493 BUILD_URL="${BUILD_URL}"
495 lftools deploy archives -p "$ARCHIVE_ARTIFACTS" "$NEXUS_URL" "$NEXUS_PATH" "$WORKSPACE"
496 lftools deploy logs "$NEXUS_URL" "$NEXUS_PATH" "$BUILD_URL"
498 set +x # Disable trace since we no longer need it.
500 echo "Build logs: <a href=\"$LOGS_SERVER/$NEXUS_PATH\">$LOGS_SERVER/$NEXUS_PATH</a>"
503 </hudson.tasks.Shell>
506 # SPDX-License-Identifier: EPL-1.0
507 ##############################################################################
508 # Copyright (c) 2017 The Linux Foundation and others.
510 # All rights reserved. This program and the accompanying materials
511 # are made available under the terms of the Eclipse Public License v1.0
512 # which accompanies this distribution, and is available at
513 # http://www.eclipse.org/legal/epl-v10.html
514 ##############################################################################
516 # Clear log credential files
517 rm "$SETTINGS_FILE"
520 </hudson.tasks.Shell>
521 <hudson.plugins.descriptionsetter.DescriptionSetterBuilder>
522 <regexp>^Build logs: .*</regexp>
523 </hudson.plugins.descriptionsetter.DescriptionSetterBuilder>
525 <scriptOnlyIfSuccess>false</scriptOnlyIfSuccess>
526 <scriptOnlyIfFailure>false</scriptOnlyIfFailure>
527 <markBuildUnstable>false</markBuildUnstable>
528 </org.jenkinsci.plugins.postbuildscript.PostBuildScript>
529 <hudson.plugins.ws__cleanup.WsCleanup plugin="ws-cleanup">
531 <hudson.plugins.ws__cleanup.Pattern>
532 <pattern>**/*.jenkins-trigger</pattern>
534 </hudson.plugins.ws__cleanup.Pattern>
536 <deleteDirs>false</deleteDirs>
537 <cleanupMatrixParent>false</cleanupMatrixParent>
539 <cleanWhenSuccess>true</cleanWhenSuccess>
540 <cleanWhenUnstable>true</cleanWhenUnstable>
541 <cleanWhenFailure>true</cleanWhenFailure>
542 <cleanWhenNotBuilt>true</cleanWhenNotBuilt>
543 <cleanWhenAborted>true</cleanWhenAborted>
544 <notFailBuild>true</notFailBuild>
545 </hudson.plugins.ws__cleanup.WsCleanup>
548 <com.michelin.cio.hudson.plugins.maskpasswords.MaskPasswordsBuildWrapper/>
549 <hudson.plugins.build__timeout.BuildTimeoutWrapper>
550 <timeoutMinutes>10</timeoutMinutes>
551 <timeoutEnvVar>BUILD_TIMEOUT</timeoutEnvVar>
552 <failBuild>true</failBuild>
553 <writingDescription>false</writingDescription>
554 <timeoutPercentage>0</timeoutPercentage>
555 <timeoutMinutesElasticDefault>3</timeoutMinutesElasticDefault>
556 <timeoutType>absolute</timeoutType>
557 </hudson.plugins.build__timeout.BuildTimeoutWrapper>
558 <hudson.plugins.timestamper.TimestamperBuildWrapper/>
559 <com.cloudbees.jenkins.plugins.sshagent.SSHAgentBuildWrapper>
560 <user>test-credential</user>
561 </com.cloudbees.jenkins.plugins.sshagent.SSHAgentBuildWrapper>
562 <jenkins.plugins.openstack.compute.JCloudsOneOffSlave/>