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 plugin="github">
13 <projectUrl>https://github.com/example-org/releng/ciman</projectUrl>
15 </com.coravy.hudson.plugins.github.GithubProjectProperty>
16 <hudson.model.ParametersDefinitionProperty>
17 <parameterDefinitions>
18 <hudson.model.StringParameterDefinition>
20 <description>Parameter to identify a Gerrit project. This is typically the
21 project repo path as exists in Gerrit.
22 For example: ofextensions/circuitsw
24 <defaultValue>releng/ciman</defaultValue>
25 </hudson.model.StringParameterDefinition>
26 <hudson.model.StringParameterDefinition>
28 <description>Stream is often set to the same name as 'branch' but can
29 sometimes be used as a name representing a project's release code
32 <defaultValue>master</defaultValue>
33 </hudson.model.StringParameterDefinition>
34 <hudson.model.StringParameterDefinition>
35 <name>GERRIT_PROJECT</name>
36 <description>Parameter to identify Gerrit project. This is typically the
37 project repo path as exists in Gerrit.
38 For example: ofextensions/circuitsw
40 Note that Gerrit will override this parameter automatically if a
41 job is triggered by Gerrit.
43 <defaultValue>releng/ciman</defaultValue>
44 </hudson.model.StringParameterDefinition>
45 <hudson.model.StringParameterDefinition>
46 <name>GERRIT_BRANCH</name>
47 <description>Parameter to identify a Gerrit branch.
49 Note that Gerrit will override this parameter automatically if a
50 job is triggered by Gerrit.
52 <defaultValue>master</defaultValue>
53 </hudson.model.StringParameterDefinition>
54 <hudson.model.StringParameterDefinition>
55 <name>GERRIT_REFSPEC</name>
56 <description>Parameter to identify a refspec when pulling from Gerrit.
58 Note that Gerrit will override this parameter automatically if a
59 job is triggered by Gerrit.
61 <defaultValue>refs/heads/master</defaultValue>
62 </hudson.model.StringParameterDefinition>
63 <hudson.model.StringParameterDefinition>
64 <name>LFTOOLS_VERSION</name>
65 <description>Version of lftools to install. Can be a specific version like
66 '0.6.0' or a PEP-440 definition.
67 https://www.python.org/dev/peps/pep-0440/
68 For example '<1.0.0' or '>=1.0.0,<2.0.0'.
70 <defaultValue><1.0.0</defaultValue>
71 </hudson.model.StringParameterDefinition>
72 <hudson.model.StringParameterDefinition>
73 <name>JJB_VERSION</name>
74 <description>Jenkins Job Builder version to download and install.</description>
75 <defaultValue>1.6.2</defaultValue>
76 </hudson.model.StringParameterDefinition>
77 </parameterDefinitions>
78 </hudson.model.ParametersDefinitionProperty>
80 <scm class="hudson.plugins.git.GitSCM">
81 <configVersion>2</configVersion>
83 <hudson.plugins.git.UserRemoteConfig>
85 <refspec>+refs/pull/*:refs/remotes/origin/pr/*</refspec>
86 <url>git@github.com:example-org/releng/ciman</url>
87 <credentialsId>test-credential</credentialsId>
88 </hudson.plugins.git.UserRemoteConfig>
91 <hudson.plugins.git.BranchSpec>
93 </hudson.plugins.git.BranchSpec>
95 <doGenerateSubmoduleConfigurations>false</doGenerateSubmoduleConfigurations>
96 <remotePoll>false</remotePoll>
97 <gitTool>Default</gitTool>
98 <submoduleCfg class="list"/>
103 <hudson.plugins.git.extensions.impl.BuildChooserSetting>
104 <buildChooser class="hudson.plugins.git.util.DefaultBuildChooser"/>
105 </hudson.plugins.git.extensions.impl.BuildChooserSetting>
106 <hudson.plugins.git.extensions.impl.SubmoduleOption>
107 <disableSubmodules>false</disableSubmodules>
108 <recursiveSubmodules>true</recursiveSubmodules>
109 <trackingSubmodules>false</trackingSubmodules>
110 <parentCredentials>false</parentCredentials>
112 <timeout>10</timeout>
113 </hudson.plugins.git.extensions.impl.SubmoduleOption>
114 <hudson.plugins.git.extensions.impl.WipeWorkspace/>
117 <triggers class="vector">
118 <org.jenkinsci.plugins.ghprb.GhprbTrigger>
121 <allowMembersOfWhitelistedOrgsAsAdmin>false</allowMembersOfWhitelistedOrgsAsAdmin>
127 <triggerPhrase>^recheck$</triggerPhrase>
129 <onlyTriggerPhrase>false</onlyTriggerPhrase>
130 <useGitHubHooks>true</useGitHubHooks>
131 <permitAll>true</permitAll>
132 <autoCloseFailedPullRequests>false</autoCloseFailedPullRequests>
134 <org.jenkinsci.plugins.ghprb.extensions.status.GhprbSimpleStatus>
135 <commitStatusContext>JJB Verify</commitStatusContext>
136 </org.jenkinsci.plugins.ghprb.extensions.status.GhprbSimpleStatus>
138 </org.jenkinsci.plugins.ghprb.GhprbTrigger>
141 <org.jenkinsci.plugins.configfiles.builder.ConfigFileBuildStep plugin="config-file-provider">
143 <org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
144 <fileId>jjbini</fileId>
145 <targetLocation>$HOME/.config/jenkins_jobs/jenkins_jobs.ini</targetLocation>
147 </org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
149 </org.jenkinsci.plugins.configfiles.builder.ConfigFileBuildStep>
152 # SPDX-License-Identifier: EPL-1.0
153 ##############################################################################
154 # Copyright (c) 2017 The Linux Foundation and others.
156 # All rights reserved. This program and the accompanying materials
157 # are made available under the terms of the Eclipse Public License v1.0
158 # which accompanies this distribution, and is available at
159 # http://www.eclipse.org/legal/epl-v10.html
160 ##############################################################################
162 # This script will make sure that there are no JIRA URLs in the commit
163 # message. JIRA URLs will break the its-jira plugin
165 # Ensure we fail the job if any steps fail.
166 # Do not treat undefined variables as errors as in this case we are allowed
167 # to have JIRA_URL undefined
171 if [ -n "${JIRA_URL}" ];
173 BASE_URL=$(echo $JIRA_URL | awk -F'/' '{print $3}')
174 JIRA_LINK=$(git rev-list --format=%B --max-count=1 HEAD | grep -io "http[s]*://$BASE_URL/" || true)
175 if [[ ! -z "$JIRA_LINK" ]]
177 echo 'Remove JIRA URLs from commit message'
178 echo 'Add jira references as: Issue: <JIRAKEY>-<ISSUE#>, instead of URLs'
184 # SPDX-License-Identifier: EPL-1.0
185 ##############################################################################
186 # Copyright (c) 2017 The Linux Foundation and others.
188 # All rights reserved. This program and the accompanying materials
189 # are made available under the terms of the Eclipse Public License v1.0
190 # which accompanies this distribution, and is available at
191 # http://www.eclipse.org/legal/epl-v10.html
192 ##############################################################################
193 echo "---> jjb-install.sh"
195 # Ensure we fail the job if any steps fail.
196 # DO NOT set -u as virtualenv's activate script has unbound variables
199 virtualenv "/tmp/v/jjb"
200 # shellcheck source=/tmp/v/jjb/bin/activate disable=SC1091
201 source "/tmp/v/jjb/bin/activate"
202 pip install --quiet --upgrade pip
203 pip install --quiet --upgrade pipdeptree
204 pip install --quiet --upgrade "jenkins-job-builder==$JJB_VERSION"
206 echo "----> Pip Dependency Tree"
210 # SPDX-License-Identifier: EPL-1.0
211 ##############################################################################
212 # Copyright (c) 2017 The Linux Foundation and others.
214 # All rights reserved. This program and the accompanying materials
215 # are made available under the terms of the Eclipse Public License v1.0
216 # which accompanies this distribution, and is available at
217 # http://www.eclipse.org/legal/epl-v10.html
218 ##############################################################################
219 echo "---> jjb-verify-job.sh"
221 # Ensure we fail the job if any steps fail.
224 jenkins-jobs -l DEBUG test --recursive -o archives/job-configs jjb/
226 # Sort job output into sub-directories. On large Jenkins systems that have
227 # many jobs archiving so many files into the same directory makes NGINX return
228 # the directory list slow.
229 pushd archives/job-configs
232 if [[ $(ls "$letter"* > /dev/null 2>&1) -eq 0 ]]
234 mkdir "$letter"
235 find . -maxdepth 1 -type f -name "$letter*" -exec mv {} "$letter" \;
241 # SPDX-License-Identifier: EPL-1.0
242 ##############################################################################
243 # Copyright (c) 2015 The Linux Foundation and others.
245 # All rights reserved. This program and the accompanying materials
246 # are made available under the terms of the Eclipse Public License v1.0
247 # which accompanies this distribution, and is available at
248 # http://www.eclipse.org/legal/epl-v10.html
249 ##############################################################################
250 echo "---> jjb-check-unicode.sh"
252 if LC_ALL=C grep -I -r '[^[:print:][:space:]]' jjb/; then
253 echo "Found files containing non-ascii characters."
257 echo "All files are ASCII only"
259 </hudson.tasks.Shell>
262 # SPDX-License-Identifier: EPL-1.0
263 ##############################################################################
264 # Copyright (c) 2016 The Linux Foundation and others.
266 # All rights reserved. This program and the accompanying materials
267 # are made available under the terms of the Eclipse Public License v1.0
268 # which accompanies this distribution, and is available at
269 # http://www.eclipse.org/legal/epl-v10.html
270 ##############################################################################
271 echo "---> gpg-verify-git-signature.sh"
273 if git log --show-signature -1 | grep -E -q 'gpg: Signature made.*key ID'; then
274 echo "Git commit is GPG signed."
276 echo "WARNING: GPG signature missing for the commit."
279 # Do NOT fail the job for unsigned commits
282 </hudson.tasks.Shell>
285 <org.jenkinsci.plugins.postbuildscript.PostBuildScript>
289 # SPDX-License-Identifier: EPL-1.0
290 ##############################################################################
291 # Copyright (c) 2017 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 "---> sysstat.sh"
299 set +e # DON'T fail build if script fails.
301 OS=$(facter operatingsystem)
302 case "$OS" in
304 SYSSTAT_PATH="/var/log/sysstat"
306 # Dont run the script when systat is not enabled by default
307 if ! grep --quiet 'ENABLED="true"' "/etc/default/sysstat"; then
312 SYSSTAT_PATH="/var/log/sa"
320 SAR_DIR="$WORKSPACE/archives/sar-reports"
321 mkdir -p "$SAR_DIR"
322 cp "$SYSSTAT_PATH/"* "$_"
323 # convert sar data to ascii format
324 while IFS="" read -r sarfilenum
326 [ -f "$sarfilenum" ] && LC_TIME=POSIX sar -A -f "$sarfilenum" > "$SAR_DIR/sar${sarfilenum//[!0-9]/}"
327 done < <(find "$SYSSTAT_PATH" -name "sa[0-9]*" || true)
329 # DON'T fail build if script fails.
332 </hudson.tasks.Shell>
333 <org.jenkinsci.plugins.configfiles.builder.ConfigFileBuildStep plugin="config-file-provider">
335 <org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
336 <fileId>jenkins-log-archives-settings</fileId>
338 <variable>SETTINGS_FILE</variable>
339 </org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
341 </org.jenkinsci.plugins.configfiles.builder.ConfigFileBuildStep>
344 <propertiesContent>SERVER_ID=logs</propertiesContent>
349 # SPDX-License-Identifier: EPL-1.0
350 ##############################################################################
351 # Copyright (c) 2017 The Linux Foundation and others.
353 # All rights reserved. This program and the accompanying materials
354 # are made available under the terms of the Eclipse Public License v1.0
355 # which accompanies this distribution, and is available at
356 # http://www.eclipse.org/legal/epl-v10.html
357 ##############################################################################
358 echo "---> create-netrc.sh"
360 # Ensure we fail the job if any steps fail.
363 NEXUS_URL="${NEXUSPROXY:-$NEXUS_URL}"
364 CREDENTIAL=$(xmlstarlet sel -N "x=http://maven.apache.org/SETTINGS/1.0.0" \
365 -t -m "/x:settings/x:servers/x:server[x:id='${SERVER_ID}']" \
366 -v x:username -o ":" -v x:password \
367 "$SETTINGS_FILE")
369 machine=$(echo "$NEXUS_URL" | awk -F/ '{print $3}')
370 user=$(echo "$CREDENTIAL" | cut -f1 -d:)
371 pass=$(echo "$CREDENTIAL" | cut -f2 -d:)
373 echo "machine ${machine%:*} login $user password $pass" > ~/.netrc
375 </hudson.tasks.Shell>
378 # SPDX-License-Identifier: EPL-1.0
379 ##############################################################################
380 # Copyright (c) 2017 The Linux Foundation and others.
382 # All rights reserved. This program and the accompanying materials
383 # are made available under the terms of the Eclipse Public License v1.0
384 # which accompanies this distribution, and is available at
385 # http://www.eclipse.org/legal/epl-v10.html
386 ##############################################################################
387 echo "---> lftools-install.sh"
389 # Script to install lftools via a version passed in via lf-infra-parameters
391 # Required parameters:
393 # LFTOOLS_VERSION: Passed in via lf-infra-parameters configuration. Can be
394 # set to a strict version number like '1.2.3' or using
395 # PEP-440 definitions.
399 # >=1.0.0,<2.0.0
401 # By default a released version of lftools should always be used.
402 # The purpose of the 2 variables below is so that lftools devs can test
403 # unreleased versions of lftools. There are 2 methods to install a dev version
406 # 1) gerrit patch: Used to test a patch that has not yet been merged.
407 # To do this set something like this:
408 # LFTOOLS_MODE=gerrit
409 # LFTOOLS_REFSPEC=refs/changes/96/5296/7
411 # 2) git branch: Used to install an lftools version from a specific branch.
412 # To use this set the variables as follows:
414 # LFTOOLS_REFSPEC=master
416 # 3) release : The intended use case and default setting.
417 # Set LFTOOLS_MODE=release, in this case LFTOOLS_REFSPEC is unused.
419 LFTOOLS_MODE=release # release | git | gerrit
420 LFTOOLS_REFSPEC=master
422 # Ensure we fail the job if any steps fail.
423 # DO NOT set -u as virtualenv's activate script has unbound variables
426 virtualenv --quiet "/tmp/v/lftools"
427 # shellcheck source=/tmp/v/lftools/bin/activate disable=SC1091
428 source "/tmp/v/lftools/bin/activate"
429 pip install --quiet --upgrade pip
431 case $LFTOOLS_MODE in
433 git clone https://gerrit.linuxfoundation.org/infra/releng/lftools.git /tmp/lftools
435 git fetch origin "$LFTOOLS_REFSPEC"
436 git checkout FETCH_HEAD
437 pip install --quiet --upgrade -r requirements.txt
438 pip install --quiet --upgrade -e .
443 pip install --quiet --upgrade git+https://gerrit.linuxfoundation.org/infra/releng/lftools.git@"$BRANCH"
447 if [[ $LFTOOLS_VERSION =~ ^[0-9] ]]; then
448 LFTOOLS_VERSION="==$LFTOOLS_VERSION"
451 pip install --quiet --upgrade "lftools${LFTOOLS_VERSION}"
457 # pipdeptree prints out a lot of information because lftools pulls in many
458 # dependencies. Let's only print it if we want to debug.
459 # echo "----> Pip Dependency Tree"
460 # pip install --quiet --upgrade pipdeptree
464 # SPDX-License-Identifier: EPL-1.0
465 ##############################################################################
466 # Copyright (c) 2017 The Linux Foundation and others.
468 # All rights reserved. This program and the accompanying materials
469 # are made available under the terms of the Eclipse Public License v1.0
470 # which accompanies this distribution, and is available at
471 # http://www.eclipse.org/legal/epl-v10.html
472 ##############################################################################
473 echo "---> logs-deploy.sh"
475 # Ensure we fail the job if any steps fail.
478 set -x # Trace commands for this script to make debugging easier.
480 ARCHIVE_ARTIFACTS="${ARCHIVE_ARTIFACTS:-}"
481 LOGS_SERVER="${LOGS_SERVER:-None}"
483 if [ "${LOGS_SERVER}" == 'None' ]
485 set +x # Disable trace since we no longer need it
487 echo "WARNING: Logging server not set"
489 NEXUS_URL="${NEXUSPROXY:-$NEXUS_URL}"
490 NEXUS_PATH="${SILO}/${JENKINS_HOSTNAME}/${JOB_NAME}/${BUILD_NUMBER}"
491 BUILD_URL="${BUILD_URL}"
493 lftools deploy archives -p "$ARCHIVE_ARTIFACTS" "$NEXUS_URL" "$NEXUS_PATH" "$WORKSPACE"
494 lftools deploy logs "$NEXUS_URL" "$NEXUS_PATH" "$BUILD_URL"
496 set +x # Disable trace since we no longer need it.
498 echo "Build logs: <a href=\"$LOGS_SERVER/$NEXUS_PATH\">$LOGS_SERVER/$NEXUS_PATH</a>"
501 </hudson.tasks.Shell>
504 # SPDX-License-Identifier: EPL-1.0
505 ##############################################################################
506 # Copyright (c) 2017 The Linux Foundation and others.
508 # All rights reserved. This program and the accompanying materials
509 # are made available under the terms of the Eclipse Public License v1.0
510 # which accompanies this distribution, and is available at
511 # http://www.eclipse.org/legal/epl-v10.html
512 ##############################################################################
514 # Clear log credential files
515 rm "$SETTINGS_FILE"
518 </hudson.tasks.Shell>
519 <hudson.plugins.descriptionsetter.DescriptionSetterBuilder>
520 <regexp>^Build logs: .*</regexp>
521 </hudson.plugins.descriptionsetter.DescriptionSetterBuilder>
523 <scriptOnlyIfSuccess>false</scriptOnlyIfSuccess>
524 <scriptOnlyIfFailure>false</scriptOnlyIfFailure>
525 <markBuildUnstable>false</markBuildUnstable>
526 </org.jenkinsci.plugins.postbuildscript.PostBuildScript>
527 <hudson.plugins.ws__cleanup.WsCleanup plugin="ws-cleanup">
529 <hudson.plugins.ws__cleanup.Pattern>
530 <pattern>**/*.jenkins-trigger</pattern>
532 </hudson.plugins.ws__cleanup.Pattern>
534 <deleteDirs>false</deleteDirs>
535 <cleanupMatrixParent>false</cleanupMatrixParent>
537 <cleanWhenSuccess>true</cleanWhenSuccess>
538 <cleanWhenUnstable>true</cleanWhenUnstable>
539 <cleanWhenFailure>true</cleanWhenFailure>
540 <cleanWhenNotBuilt>true</cleanWhenNotBuilt>
541 <cleanWhenAborted>true</cleanWhenAborted>
542 <notFailBuild>true</notFailBuild>
543 </hudson.plugins.ws__cleanup.WsCleanup>
546 <com.michelin.cio.hudson.plugins.maskpasswords.MaskPasswordsBuildWrapper/>
547 <hudson.plugins.build__timeout.BuildTimeoutWrapper>
548 <timeoutMinutes>10</timeoutMinutes>
549 <timeoutEnvVar>BUILD_TIMEOUT</timeoutEnvVar>
550 <failBuild>true</failBuild>
551 <writingDescription>false</writingDescription>
552 <timeoutPercentage>0</timeoutPercentage>
553 <timeoutMinutesElasticDefault>3</timeoutMinutesElasticDefault>
554 <timeoutType>absolute</timeoutType>
555 </hudson.plugins.build__timeout.BuildTimeoutWrapper>
556 <hudson.plugins.timestamper.TimestamperBuildWrapper/>
557 <com.cloudbees.jenkins.plugins.sshagent.SSHAgentBuildWrapper>
558 <user>test-credential</user>
559 </com.cloudbees.jenkins.plugins.sshagent.SSHAgentBuildWrapper>
560 <jenkins.plugins.openstack.compute.JCloudsOneOffSlave/>
561 <org.jenkinsci.plugins.configfiles.buildwrapper.ConfigFileBuildWrapper plugin="config-file-provider">
563 <org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
564 <fileId>npmrc</fileId>
565 <targetLocation>$HOME/.npmrc</targetLocation>
567 </org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
569 </org.jenkinsci.plugins.configfiles.buildwrapper.ConfigFileBuildWrapper>