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.
61 </hudson.model.StringParameterDefinition>
62 <hudson.model.StringParameterDefinition>
63 <name>JJB_VERSION</name>
64 <description>Jenkins Job Builder version to download and install.</description>
65 <defaultValue>1.6.2</defaultValue>
66 </hudson.model.StringParameterDefinition>
67 </parameterDefinitions>
68 </hudson.model.ParametersDefinitionProperty>
70 <scm class="hudson.plugins.git.GitSCM">
71 <configVersion>2</configVersion>
73 <hudson.plugins.git.UserRemoteConfig>
75 <refspec>+refs/pull/*:refs/remotes/origin/pr/*</refspec>
76 <url>git@github.com:example-org/releng/ciman</url>
77 <credentialsId>test-credential</credentialsId>
78 </hudson.plugins.git.UserRemoteConfig>
81 <hudson.plugins.git.BranchSpec>
83 </hudson.plugins.git.BranchSpec>
86 <buildChooser class="hudson.plugins.git.util.DefaultBuildChooser"/>
87 <doGenerateSubmoduleConfigurations>false</doGenerateSubmoduleConfigurations>
88 <authorOrCommitter>false</authorOrCommitter>
89 <wipeOutWorkspace>true</wipeOutWorkspace>
90 <pruneBranches>false</pruneBranches>
91 <remotePoll>false</remotePoll>
92 <gitTool>Default</gitTool>
93 <submoduleCfg class="list"/>
98 <skipTag>true</skipTag>
100 <useShallowClone>false</useShallowClone>
101 <ignoreNotifyCommit>false</ignoreNotifyCommit>
103 <hudson.plugins.git.extensions.impl.SubmoduleOption>
104 <disableSubmodules>false</disableSubmodules>
105 <recursiveSubmodules>true</recursiveSubmodules>
106 <trackingSubmodules>false</trackingSubmodules>
108 <timeout>10</timeout>
109 </hudson.plugins.git.extensions.impl.SubmoduleOption>
110 <hudson.plugins.git.extensions.impl.WipeWorkspace/>
113 <triggers class="vector">
114 <org.jenkinsci.plugins.ghprb.GhprbTrigger>
117 <allowMembersOfWhitelistedOrgsAsAdmin>false</allowMembersOfWhitelistedOrgsAsAdmin>
121 <triggerPhrase>^recheck$</triggerPhrase>
122 <onlyTriggerPhrase>false</onlyTriggerPhrase>
123 <useGitHubHooks>true</useGitHubHooks>
124 <permitAll>true</permitAll>
125 <autoCloseFailedPullRequests>false</autoCloseFailedPullRequests>
127 <org.jenkinsci.plugins.ghprb.extensions.status.GhprbSimpleStatus>
128 <commitStatusContext>JJB Verify</commitStatusContext>
129 </org.jenkinsci.plugins.ghprb.extensions.status.GhprbSimpleStatus>
131 </org.jenkinsci.plugins.ghprb.GhprbTrigger>
134 <org.jenkinsci.plugins.configfiles.builder.ConfigFileBuildStep plugin="config-file-provider">
136 <org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
137 <fileId>jjbini</fileId>
138 <targetLocation>$HOME/.config/jenkins_jobs/jenkins_jobs.ini</targetLocation>
140 </org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
142 </org.jenkinsci.plugins.configfiles.builder.ConfigFileBuildStep>
145 # SPDX-License-Identifier: EPL-1.0
146 ##############################################################################
147 # Copyright (c) 2017 The Linux Foundation and others.
149 # All rights reserved. This program and the accompanying materials
150 # are made available under the terms of the Eclipse Public License v1.0
151 # which accompanies this distribution, and is available at
152 # http://www.eclipse.org/legal/epl-v10.html
153 ##############################################################################
155 # This script will make sure that there are no JIRA URLs in the commit
156 # message. JIRA URLs will break the its-jira plugin
158 # Ensure we fail the job if any steps fail.
159 # Do not treat undefined variables as errors as in this case we are allowed
160 # to have JIRA_URL undefined
164 if [ -n "${JIRA_URL}" ];
166 BASE_URL=$(echo $JIRA_URL | awk -F'/' '{print $3}')
167 JIRA_LINK=$(git rev-list --format=%B --max-count=1 HEAD | grep -io "http[s]*://$BASE_URL/" || true)
168 if [[ ! -z "$JIRA_LINK" ]]
170 echo 'Remove JIRA URLs from commit message'
171 echo 'Add jira references as: Issue: <JIRAKEY>-<ISSUE#>, instead of URLs'
177 # SPDX-License-Identifier: EPL-1.0
178 ##############################################################################
179 # Copyright (c) 2017 The Linux Foundation and others.
181 # All rights reserved. This program and the accompanying materials
182 # are made available under the terms of the Eclipse Public License v1.0
183 # which accompanies this distribution, and is available at
184 # http://www.eclipse.org/legal/epl-v10.html
185 ##############################################################################
186 echo "---> jjb-install.sh"
188 # Ensure we fail the job if any steps fail.
189 # DO NOT set -u as virtualenv's activate script has unbound variables
192 virtualenv "/tmp/v/jjb"
193 # shellcheck source=/tmp/v/jjb/bin/activate disable=SC1091
194 source "/tmp/v/jjb/bin/activate"
195 pip install --quiet --upgrade pip
196 pip install --quiet --upgrade pipdeptree
197 pip install --quiet --upgrade "jenkins-job-builder==$JJB_VERSION"
199 echo "----> Pip Dependency Tree"
203 # SPDX-License-Identifier: EPL-1.0
204 ##############################################################################
205 # Copyright (c) 2017 The Linux Foundation and others.
207 # All rights reserved. This program and the accompanying materials
208 # are made available under the terms of the Eclipse Public License v1.0
209 # which accompanies this distribution, and is available at
210 # http://www.eclipse.org/legal/epl-v10.html
211 ##############################################################################
212 echo "---> jjb-verify-job.sh"
214 # Ensure we fail the job if any steps fail.
217 jenkins-jobs -l DEBUG test --recursive -o archives/job-configs --exclude jjb-test jjb
219 # Sort job output into sub-directories. On large Jenkins systems that have
220 # many jobs archiving so many files into the same directory makes NGINX return
221 # the directory list slow.
222 pushd archives/job-configs
225 if [[ $(ls "$letter"* > /dev/null 2>&1) -eq 0 ]]
227 mkdir "$letter"
228 find . -maxdepth 1 -type f -name "$letter*" -exec mv {} "$letter" \;
234 # SPDX-License-Identifier: EPL-1.0
235 ##############################################################################
236 # Copyright (c) 2015 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-check-unicode.sh"
245 if LC_ALL=C grep -r '[^[:print:][:space:]]' jjb/; then
246 echo "Found files containing non-ascii characters."
250 echo "All files are ASCII only"
252 </hudson.tasks.Shell>
255 # SPDX-License-Identifier: EPL-1.0
256 ##############################################################################
257 # Copyright (c) 2016 The Linux Foundation and others.
259 # All rights reserved. This program and the accompanying materials
260 # are made available under the terms of the Eclipse Public License v1.0
261 # which accompanies this distribution, and is available at
262 # http://www.eclipse.org/legal/epl-v10.html
263 ##############################################################################
264 echo "---> gpg-verify-git-signature.sh"
266 if git log --show-signature -1 | grep -E -q 'gpg: Signature made.*key ID'; then
267 echo "Git commit is GPG signed."
269 echo "WARNING: GPG signature missing for the commit."
272 # Do NOT fail the job for unsigned commits
275 </hudson.tasks.Shell>
278 <org.jenkinsci.plugins.postbuildscript.PostBuildScript>
282 # SPDX-License-Identifier: EPL-1.0
283 ##############################################################################
284 # Copyright (c) 2017 The Linux Foundation and others.
286 # All rights reserved. This program and the accompanying materials
287 # are made available under the terms of the Eclipse Public License v1.0
288 # which accompanies this distribution, and is available at
289 # http://www.eclipse.org/legal/epl-v10.html
290 ##############################################################################
291 echo "---> sysstat.sh"
292 set +e # DON'T fail build if script fails.
294 OS=$(facter operatingsystem)
295 case "$OS" in
297 SYSSTAT_PATH="/var/log/sysstat"
299 # Dont run the script when systat is not enabled by default
300 if ! grep --quiet 'ENABLED="true"' "/etc/default/sysstat"; then
305 SYSSTAT_PATH="/var/log/sa"
313 SAR_DIR="$WORKSPACE/archives/sar-reports"
314 mkdir -p "$SAR_DIR"
315 cp "$SYSSTAT_PATH/"* "$_"
316 # convert sar data to ascii format
317 while IFS="" read -r s
319 [ -f "$s" ] && LC_TIME=POSIX sar -A -f "$s" > "$SAR_DIR/sar${s//[!0-9]/}"
320 done < <(find "$SYSSTAT_PATH" -name "sa[0-9]*" || true)
322 # DON'T fail build if script fails.
325 </hudson.tasks.Shell>
326 <org.jenkinsci.plugins.configfiles.builder.ConfigFileBuildStep plugin="config-file-provider">
328 <org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
329 <fileId>jenkins-log-archives-settings</fileId>
331 <variable>SETTINGS_FILE</variable>
332 </org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
334 </org.jenkinsci.plugins.configfiles.builder.ConfigFileBuildStep>
337 <propertiesContent>SERVER_ID=logs</propertiesContent>
342 # SPDX-License-Identifier: EPL-1.0
343 ##############################################################################
344 # Copyright (c) 2017 The Linux Foundation and others.
346 # All rights reserved. This program and the accompanying materials
347 # are made available under the terms of the Eclipse Public License v1.0
348 # which accompanies this distribution, and is available at
349 # http://www.eclipse.org/legal/epl-v10.html
350 ##############################################################################
351 echo "---> create-netrc.sh"
353 # Ensure we fail the job if any steps fail.
356 NEXUS_URL="${NEXUS_URL:-$NEXUSPROXY}"
357 CREDENTIAL=$(xmlstarlet sel -N "x=http://maven.apache.org/SETTINGS/1.0.0" \
358 -t -m "/x:settings/x:servers/x:server[x:id='${SERVER_ID}']" \
359 -v x:username -o ":" -v x:password \
360 "$SETTINGS_FILE")
362 machine=$(echo "$NEXUS_URL" | awk -F/ '{print $3}')
363 user=$(echo "$CREDENTIAL" | cut -f1 -d:)
364 pass=$(echo "$CREDENTIAL" | cut -f2 -d:)
366 echo "machine $machine login $user password $pass" > ~/.netrc
368 </hudson.tasks.Shell>
371 # SPDX-License-Identifier: EPL-1.0
372 ##############################################################################
373 # Copyright (c) 2017 The Linux Foundation and others.
375 # All rights reserved. This program and the accompanying materials
376 # are made available under the terms of the Eclipse Public License v1.0
377 # which accompanies this distribution, and is available at
378 # http://www.eclipse.org/legal/epl-v10.html
379 ##############################################################################
380 echo "---> lftools-install.sh"
382 # Ensure we fail the job if any steps fail.
383 # DO NOT set -u as virtualenv's activate script has unbound variables
386 virtualenv --quiet "/tmp/v/lftools"
387 # shellcheck source=/tmp/v/lftools/bin/activate disable=SC1091
388 source "/tmp/v/lftools/bin/activate"
389 pip install --quiet --upgrade pip
390 pip install --quiet --upgrade "lftools<1.0.0"
392 # pipdeptree prints out a lot of information because lftools pulls in many
393 # dependencies. Let's only print it if we want to debug.
394 # echo "----> Pip Dependency Tree"
395 # pip install --quiet --upgrade pipdeptree
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 "---> logs-deploy.sh"
410 # Ensure we fail the job if any steps fail.
413 set -x # Trace commands for this script to make debugging easier.
415 ARCHIVE_ARTIFACTS="${ARCHIVE_ARTIFACTS:-}"
416 LOGS_SERVER="${LOGS_SERVER:-None}"
418 if [ "${LOGS_SERVER}" == 'None' ]
420 set +x # Disable trace since we no longer need it
422 echo "WARNING: Logging server not set"
424 NEXUS_URL="${NEXUS_URL:-$NEXUSPROXY}"
425 NEXUS_PATH="${SILO}/${JENKINS_HOSTNAME}/${JOB_NAME}/${BUILD_NUMBER}"
426 BUILD_URL="${BUILD_URL}"
428 lftools deploy archives -p "$ARCHIVE_ARTIFACTS" "$NEXUS_URL" "$NEXUS_PATH" "$WORKSPACE"
429 lftools deploy logs "$NEXUS_URL" "$NEXUS_PATH" "$BUILD_URL"
431 set +x # Disable trace since we no longer need it.
433 echo "Build logs: <a href=\"$LOGS_SERVER/$NEXUS_PATH\">$LOGS_SERVER/$NEXUS_PATH</a>"
436 </hudson.tasks.Shell>
439 # SPDX-License-Identifier: EPL-1.0
440 ##############################################################################
441 # Copyright (c) 2017 The Linux Foundation and others.
443 # All rights reserved. This program and the accompanying materials
444 # are made available under the terms of the Eclipse Public License v1.0
445 # which accompanies this distribution, and is available at
446 # http://www.eclipse.org/legal/epl-v10.html
447 ##############################################################################
449 # Clear log credential files
450 rm "$SETTINGS_FILE"
453 </hudson.tasks.Shell>
454 <hudson.plugins.descriptionsetter.DescriptionSetterBuilder>
455 <regexp>^Build logs: .*</regexp>
456 </hudson.plugins.descriptionsetter.DescriptionSetterBuilder>
458 <scriptOnlyIfSuccess>false</scriptOnlyIfSuccess>
459 <scriptOnlyIfFailure>false</scriptOnlyIfFailure>
460 <markBuildUnstable>false</markBuildUnstable>
461 </org.jenkinsci.plugins.postbuildscript.PostBuildScript>
462 <hudson.plugins.ws__cleanup.WsCleanup plugin="ws-cleanup">
464 <hudson.plugins.ws__cleanup.Pattern>
465 <pattern>**/*.jenkins-trigger</pattern>
467 </hudson.plugins.ws__cleanup.Pattern>
469 <deleteDirs>false</deleteDirs>
470 <cleanupMatrixParent>false</cleanupMatrixParent>
472 <cleanWhenSuccess>true</cleanWhenSuccess>
473 <cleanWhenUnstable>true</cleanWhenUnstable>
474 <cleanWhenFailure>true</cleanWhenFailure>
475 <cleanWhenNotBuilt>true</cleanWhenNotBuilt>
476 <cleanWhenAborted>true</cleanWhenAborted>
477 <notFailBuild>true</notFailBuild>
478 </hudson.plugins.ws__cleanup.WsCleanup>
481 <com.michelin.cio.hudson.plugins.maskpasswords.MaskPasswordsBuildWrapper/>
482 <hudson.plugins.build__timeout.BuildTimeoutWrapper>
483 <timeoutMinutes>10</timeoutMinutes>
484 <timeoutEnvVar>BUILD_TIMEOUT</timeoutEnvVar>
485 <failBuild>true</failBuild>
486 <writingDescription>false</writingDescription>
487 <timeoutPercentage>0</timeoutPercentage>
488 <timeoutMinutesElasticDefault>3</timeoutMinutesElasticDefault>
489 <timeoutType>absolute</timeoutType>
490 </hudson.plugins.build__timeout.BuildTimeoutWrapper>
491 <hudson.plugins.timestamper.TimestamperBuildWrapper/>
492 <com.cloudbees.jenkins.plugins.sshagent.SSHAgentBuildWrapper>
493 <user>test-credential</user>
494 </com.cloudbees.jenkins.plugins.sshagent.SSHAgentBuildWrapper>
495 <jenkins.plugins.openstack.compute.JCloudsOneOffSlave/>