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>$GIT_URL/$GERRIT_PROJECT/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>
64 <description>Path to directory containing tox.ini file.
67 </hudson.model.StringParameterDefinition>
68 <hudson.model.StringParameterDefinition>
70 <description>Tox environments to run build against.
74 </hudson.model.StringParameterDefinition>
75 </parameterDefinitions>
76 </hudson.model.ParametersDefinitionProperty>
78 <scm class="hudson.plugins.git.GitSCM">
79 <configVersion>2</configVersion>
81 <hudson.plugins.git.UserRemoteConfig>
83 <refspec>+refs/pull/*:refs/remotes/origin/pr/*</refspec>
84 <url>git@github.com:example-org/releng/ciman</url>
85 <credentialsId>test-credential</credentialsId>
86 </hudson.plugins.git.UserRemoteConfig>
89 <hudson.plugins.git.BranchSpec>
91 </hudson.plugins.git.BranchSpec>
94 <buildChooser class="hudson.plugins.git.util.DefaultBuildChooser"/>
95 <doGenerateSubmoduleConfigurations>false</doGenerateSubmoduleConfigurations>
96 <authorOrCommitter>false</authorOrCommitter>
97 <wipeOutWorkspace>true</wipeOutWorkspace>
98 <pruneBranches>false</pruneBranches>
99 <remotePoll>false</remotePoll>
100 <gitTool>Default</gitTool>
101 <submoduleCfg class="list"/>
106 <skipTag>true</skipTag>
108 <useShallowClone>false</useShallowClone>
109 <ignoreNotifyCommit>false</ignoreNotifyCommit>
111 <hudson.plugins.git.extensions.impl.SubmoduleOption>
112 <disableSubmodules>false</disableSubmodules>
113 <recursiveSubmodules>true</recursiveSubmodules>
114 <trackingSubmodules>false</trackingSubmodules>
116 <timeout>10</timeout>
117 </hudson.plugins.git.extensions.impl.SubmoduleOption>
118 <hudson.plugins.git.extensions.impl.WipeWorkspace/>
121 <triggers class="vector">
122 <org.jenkinsci.plugins.ghprb.GhprbTrigger>
125 <allowMembersOfWhitelistedOrgsAsAdmin>false</allowMembersOfWhitelistedOrgsAsAdmin>
129 <triggerPhrase>^recheck$</triggerPhrase>
130 <onlyTriggerPhrase>false</onlyTriggerPhrase>
131 <useGitHubHooks>true</useGitHubHooks>
132 <permitAll>true</permitAll>
133 <autoCloseFailedPullRequests>false</autoCloseFailedPullRequests>
135 <org.jenkinsci.plugins.ghprb.extensions.status.GhprbSimpleStatus>
136 <commitStatusContext>JJB Verify</commitStatusContext>
137 </org.jenkinsci.plugins.ghprb.extensions.status.GhprbSimpleStatus>
139 </org.jenkinsci.plugins.ghprb.GhprbTrigger>
144 # SPDX-License-Identifier: EPL-1.0
145 ##############################################################################
146 # Copyright (c) 2017 The Linux Foundation and others.
148 # All rights reserved. This program and the accompanying materials
149 # are made available under the terms of the Eclipse Public License v1.0
150 # which accompanies this distribution, and is available at
151 # http://www.eclipse.org/legal/epl-v10.html
152 ##############################################################################
153 echo "---> lftools-install.sh"
155 # By default a released version of lftools should always be used.
156 # The purpose of the 2 variables below is so that lftools devs can test
157 # unreleased versions of lftools. There are 2 methods to install a dev version
160 # 1) gerrit patch: Used to test a patch that has not yet been merged.
161 # To do this set something like this:
162 # LFTOOLS_MODE=gerrit
163 # LFTOOLS_REFSPEC=refs/changes/96/5296/7
165 # 2) git branch: Used to install an lftools version from a specific branch.
166 # To use this set the variables as follows:
168 # LFTOOLS_REFSPEC=master
170 # 3) release : The intended use case and default setting.
171 # Set LFTOOLS_MODE=release, in this case LFTOOLS_REFSPEC is unused.
173 LFTOOLS_MODE=release # release | git | gerrit
174 LFTOOLS_REFSPEC=master
176 # Ensure we fail the job if any steps fail.
177 # DO NOT set -u as virtualenv's activate script has unbound variables
180 virtualenv --quiet "/tmp/v/lftools"
181 # shellcheck source=/tmp/v/lftools/bin/activate disable=SC1091
182 source "/tmp/v/lftools/bin/activate"
183 pip install --quiet --upgrade pip
185 case $LFTOOLS_MODE in
187 git clone https://gerrit.linuxfoundation.org/infra/releng/lftools.git /tmp/lftools
189 git fetch origin "$LFTOOLS_REFSPEC"
190 git checkout FETCH_HEAD
191 pip install --quiet --upgrade -r requirements.txt
192 pip install --quiet --upgrade -e .
197 pip install --quiet --upgrade git+https://gerrit.linuxfoundation.org/infra/releng/lftools.git@"$BRANCH"
201 pip install --quiet --upgrade "lftools<1.0.0"
205 # pipdeptree prints out a lot of information because lftools pulls in many
206 # dependencies. Let's only print it if we want to debug.
207 # echo "----> Pip Dependency Tree"
208 # pip install --quiet --upgrade pipdeptree
211 </hudson.tasks.Shell>
214 # SPDX-License-Identifier: EPL-1.0
215 ##############################################################################
216 # Copyright (c) 2017 The Linux Foundation and others.
218 # All rights reserved. This program and the accompanying materials
219 # are made available under the terms of the Eclipse Public License v1.0
220 # which accompanies this distribution, and is available at
221 # http://www.eclipse.org/legal/epl-v10.html
222 ##############################################################################
223 echo "---> tox-install.sh"
225 # Ensure we fail the job if any steps fail.
226 # DO NOT set -u as virtualenv's activate script has unbound variables
229 virtualenv --quiet "/tmp/v/tox"
230 # shellcheck source=/tmp/v/tox/bin/activate disable=SC1091
231 source "/tmp/v/tox/bin/activate"
232 pip install --quiet --upgrade pip
233 pip install --quiet --upgrade pipdeptree
234 pip install --quiet --upgrade tox argparse
236 echo "----> Pip Dependency Tree"
240 # SPDX-License-Identifier: EPL-1.0
241 ##############################################################################
242 # Copyright (c) 2017 The Linux Foundation and others.
244 # All rights reserved. This program and the accompanying materials
245 # are made available under the terms of the Eclipse Public License v1.0
246 # which accompanies this distribution, and is available at
247 # http://www.eclipse.org/legal/epl-v10.html
248 ##############################################################################
249 echo "---> tox-install.sh"
251 # Ensure we fail the job if any steps fail.
252 # DO NOT set -u as virtualenv's activate script has unbound variables
255 cd "$WORKSPACE/$TOX_DIR"
257 if [ -n "$TOX_ENVS" ];
259 tox -e "$TOX_ENVS"
264 </hudson.tasks.Shell>
267 <org.jenkinsci.plugins.postbuildscript.PostBuildScript>
271 # SPDX-License-Identifier: EPL-1.0
272 ##############################################################################
273 # Copyright (c) 2017 The Linux Foundation and others.
275 # All rights reserved. This program and the accompanying materials
276 # are made available under the terms of the Eclipse Public License v1.0
277 # which accompanies this distribution, and is available at
278 # http://www.eclipse.org/legal/epl-v10.html
279 ##############################################################################
280 echo "---> sysstat.sh"
281 set +e # DON'T fail build if script fails.
283 OS=$(facter operatingsystem)
284 case "$OS" in
286 SYSSTAT_PATH="/var/log/sysstat"
288 # Dont run the script when systat is not enabled by default
289 if ! grep --quiet 'ENABLED="true"' "/etc/default/sysstat"; then
294 SYSSTAT_PATH="/var/log/sa"
302 SAR_DIR="$WORKSPACE/archives/sar-reports"
303 mkdir -p "$SAR_DIR"
304 cp "$SYSSTAT_PATH/"* "$_"
305 # convert sar data to ascii format
306 while IFS="" read -r s
308 [ -f "$s" ] && LC_TIME=POSIX sar -A -f "$s" > "$SAR_DIR/sar${s//[!0-9]/}"
309 done < <(find "$SYSSTAT_PATH" -name "sa[0-9]*" || true)
311 # DON'T fail build if script fails.
314 </hudson.tasks.Shell>
315 <org.jenkinsci.plugins.configfiles.builder.ConfigFileBuildStep plugin="config-file-provider">
317 <org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
318 <fileId>jenkins-log-archives-settings</fileId>
320 <variable>SETTINGS_FILE</variable>
321 </org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
323 </org.jenkinsci.plugins.configfiles.builder.ConfigFileBuildStep>
326 <propertiesContent>SERVER_ID=logs</propertiesContent>
331 # SPDX-License-Identifier: EPL-1.0
332 ##############################################################################
333 # Copyright (c) 2017 The Linux Foundation and others.
335 # All rights reserved. This program and the accompanying materials
336 # are made available under the terms of the Eclipse Public License v1.0
337 # which accompanies this distribution, and is available at
338 # http://www.eclipse.org/legal/epl-v10.html
339 ##############################################################################
340 echo "---> create-netrc.sh"
342 # Ensure we fail the job if any steps fail.
345 NEXUS_URL="${NEXUS_URL:-$NEXUSPROXY}"
346 CREDENTIAL=$(xmlstarlet sel -N "x=http://maven.apache.org/SETTINGS/1.0.0" \
347 -t -m "/x:settings/x:servers/x:server[x:id='${SERVER_ID}']" \
348 -v x:username -o ":" -v x:password \
349 "$SETTINGS_FILE")
351 machine=$(echo "$NEXUS_URL" | awk -F/ '{print $3}')
352 user=$(echo "$CREDENTIAL" | cut -f1 -d:)
353 pass=$(echo "$CREDENTIAL" | cut -f2 -d:)
355 echo "machine $machine login $user password $pass" > ~/.netrc
357 </hudson.tasks.Shell>
360 # SPDX-License-Identifier: EPL-1.0
361 ##############################################################################
362 # Copyright (c) 2017 The Linux Foundation and others.
364 # All rights reserved. This program and the accompanying materials
365 # are made available under the terms of the Eclipse Public License v1.0
366 # which accompanies this distribution, and is available at
367 # http://www.eclipse.org/legal/epl-v10.html
368 ##############################################################################
369 echo "---> lftools-install.sh"
371 # By default a released version of lftools should always be used.
372 # The purpose of the 2 variables below is so that lftools devs can test
373 # unreleased versions of lftools. There are 2 methods to install a dev version
376 # 1) gerrit patch: Used to test a patch that has not yet been merged.
377 # To do this set something like this:
378 # LFTOOLS_MODE=gerrit
379 # LFTOOLS_REFSPEC=refs/changes/96/5296/7
381 # 2) git branch: Used to install an lftools version from a specific branch.
382 # To use this set the variables as follows:
384 # LFTOOLS_REFSPEC=master
386 # 3) release : The intended use case and default setting.
387 # Set LFTOOLS_MODE=release, in this case LFTOOLS_REFSPEC is unused.
389 LFTOOLS_MODE=release # release | git | gerrit
390 LFTOOLS_REFSPEC=master
392 # Ensure we fail the job if any steps fail.
393 # DO NOT set -u as virtualenv's activate script has unbound variables
396 virtualenv --quiet "/tmp/v/lftools"
397 # shellcheck source=/tmp/v/lftools/bin/activate disable=SC1091
398 source "/tmp/v/lftools/bin/activate"
399 pip install --quiet --upgrade pip
401 case $LFTOOLS_MODE in
403 git clone https://gerrit.linuxfoundation.org/infra/releng/lftools.git /tmp/lftools
405 git fetch origin "$LFTOOLS_REFSPEC"
406 git checkout FETCH_HEAD
407 pip install --quiet --upgrade -r requirements.txt
408 pip install --quiet --upgrade -e .
413 pip install --quiet --upgrade git+https://gerrit.linuxfoundation.org/infra/releng/lftools.git@"$BRANCH"
417 pip install --quiet --upgrade "lftools<1.0.0"
421 # pipdeptree prints out a lot of information because lftools pulls in many
422 # dependencies. Let's only print it if we want to debug.
423 # echo "----> Pip Dependency Tree"
424 # pip install --quiet --upgrade pipdeptree
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 "---> logs-deploy.sh"
439 # Ensure we fail the job if any steps fail.
442 set -x # Trace commands for this script to make debugging easier.
444 ARCHIVE_ARTIFACTS="${ARCHIVE_ARTIFACTS:-}"
445 LOGS_SERVER="${LOGS_SERVER:-None}"
447 if [ "${LOGS_SERVER}" == 'None' ]
449 set +x # Disable trace since we no longer need it
451 echo "WARNING: Logging server not set"
453 NEXUS_URL="${NEXUS_URL:-$NEXUSPROXY}"
454 NEXUS_PATH="${SILO}/${JENKINS_HOSTNAME}/${JOB_NAME}/${BUILD_NUMBER}"
455 BUILD_URL="${BUILD_URL}"
457 lftools deploy archives -p "$ARCHIVE_ARTIFACTS" "$NEXUS_URL" "$NEXUS_PATH" "$WORKSPACE"
458 lftools deploy logs "$NEXUS_URL" "$NEXUS_PATH" "$BUILD_URL"
460 set +x # Disable trace since we no longer need it.
462 echo "Build logs: <a href=\"$LOGS_SERVER/$NEXUS_PATH\">$LOGS_SERVER/$NEXUS_PATH</a>"
465 </hudson.tasks.Shell>
468 # SPDX-License-Identifier: EPL-1.0
469 ##############################################################################
470 # Copyright (c) 2017 The Linux Foundation and others.
472 # All rights reserved. This program and the accompanying materials
473 # are made available under the terms of the Eclipse Public License v1.0
474 # which accompanies this distribution, and is available at
475 # http://www.eclipse.org/legal/epl-v10.html
476 ##############################################################################
478 # Clear log credential files
479 rm "$SETTINGS_FILE"
482 </hudson.tasks.Shell>
483 <hudson.plugins.descriptionsetter.DescriptionSetterBuilder>
484 <regexp>^Build logs: .*</regexp>
485 </hudson.plugins.descriptionsetter.DescriptionSetterBuilder>
487 <scriptOnlyIfSuccess>false</scriptOnlyIfSuccess>
488 <scriptOnlyIfFailure>false</scriptOnlyIfFailure>
489 <markBuildUnstable>false</markBuildUnstable>
490 </org.jenkinsci.plugins.postbuildscript.PostBuildScript>
491 <hudson.plugins.ws__cleanup.WsCleanup plugin="ws-cleanup">
493 <hudson.plugins.ws__cleanup.Pattern>
494 <pattern>**/*.jenkins-trigger</pattern>
496 </hudson.plugins.ws__cleanup.Pattern>
498 <deleteDirs>false</deleteDirs>
499 <cleanupMatrixParent>false</cleanupMatrixParent>
501 <cleanWhenSuccess>true</cleanWhenSuccess>
502 <cleanWhenUnstable>true</cleanWhenUnstable>
503 <cleanWhenFailure>true</cleanWhenFailure>
504 <cleanWhenNotBuilt>true</cleanWhenNotBuilt>
505 <cleanWhenAborted>true</cleanWhenAborted>
506 <notFailBuild>true</notFailBuild>
507 </hudson.plugins.ws__cleanup.WsCleanup>
510 <com.michelin.cio.hudson.plugins.maskpasswords.MaskPasswordsBuildWrapper/>
511 <hudson.plugins.build__timeout.BuildTimeoutWrapper>
512 <timeoutMinutes>10</timeoutMinutes>
513 <timeoutEnvVar>BUILD_TIMEOUT</timeoutEnvVar>
514 <failBuild>true</failBuild>
515 <writingDescription>false</writingDescription>
516 <timeoutPercentage>0</timeoutPercentage>
517 <timeoutMinutesElasticDefault>3</timeoutMinutesElasticDefault>
518 <timeoutType>absolute</timeoutType>
519 </hudson.plugins.build__timeout.BuildTimeoutWrapper>
520 <hudson.plugins.timestamper.TimestamperBuildWrapper/>
521 <com.cloudbees.jenkins.plugins.sshagent.SSHAgentBuildWrapper>
522 <user>test-credential</user>
523 </com.cloudbees.jenkins.plugins.sshagent.SSHAgentBuildWrapper>
524 <jenkins.plugins.openstack.compute.JCloudsOneOffSlave/>