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>false</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>
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>
91 <name>refs/heads/master</name>
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 <com.cloudbees.jenkins.GitHubPushTrigger>
125 </com.cloudbees.jenkins.GitHubPushTrigger>
126 <hudson.triggers.SCMTrigger>
128 <ignorePostCommitHooks>false</ignorePostCommitHooks>
129 </hudson.triggers.SCMTrigger>
130 <org.jenkinsci.plugins.ghprb.GhprbTrigger>
132 <adminlist>tykeal</adminlist>
133 <allowMembersOfWhitelistedOrgsAsAdmin>false</allowMembersOfWhitelistedOrgsAsAdmin>
137 <orgslist>example-org</orgslist>
139 <triggerPhrase>^remerge$</triggerPhrase>
140 <onlyTriggerPhrase>true</onlyTriggerPhrase>
141 <useGitHubHooks>true</useGitHubHooks>
142 <permitAll>false</permitAll>
143 <autoCloseFailedPullRequests>false</autoCloseFailedPullRequests>
145 <org.jenkinsci.plugins.ghprb.extensions.status.GhprbSimpleStatus>
146 <commitStatusContext>JJB Merge</commitStatusContext>
147 </org.jenkinsci.plugins.ghprb.extensions.status.GhprbSimpleStatus>
149 </org.jenkinsci.plugins.ghprb.GhprbTrigger>
152 <org.jenkinsci.plugins.configfiles.builder.ConfigFileBuildStep plugin="config-file-provider">
154 <org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
155 <fileId>jjbini</fileId>
156 <targetLocation>$HOME/.config/jenkins_jobs/jenkins_jobs.ini</targetLocation>
158 </org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
160 </org.jenkinsci.plugins.configfiles.builder.ConfigFileBuildStep>
163 # SPDX-License-Identifier: EPL-1.0
164 ##############################################################################
165 # Copyright (c) 2017 The Linux Foundation and others.
167 # All rights reserved. This program and the accompanying materials
168 # are made available under the terms of the Eclipse Public License v1.0
169 # which accompanies this distribution, and is available at
170 # http://www.eclipse.org/legal/epl-v10.html
171 ##############################################################################
172 echo "---> jjb-install.sh"
174 # Ensure we fail the job if any steps fail.
175 # DO NOT set -u as virtualenv's activate script has unbound variables
178 virtualenv "/tmp/v/jjb"
179 # shellcheck source=/tmp/v/jjb/bin/activate disable=SC1091
180 source "/tmp/v/jjb/bin/activate"
181 pip install --quiet --upgrade pip
182 pip install --quiet --upgrade pipdeptree
183 pip install --quiet --upgrade "jenkins-job-builder==$JJB_VERSION"
185 echo "----> Pip Dependency Tree"
189 # SPDX-License-Identifier: EPL-1.0
190 ##############################################################################
191 # Copyright (c) 2017 The Linux Foundation and others.
193 # All rights reserved. This program and the accompanying materials
194 # are made available under the terms of the Eclipse Public License v1.0
195 # which accompanies this distribution, and is available at
196 # http://www.eclipse.org/legal/epl-v10.html
197 ##############################################################################
198 echo "---> jjb-merge-job.sh"
200 # Ensure we fail the job if any steps fail.
203 jenkins-jobs update --recursive --delete-old --workers 4 jjb/
205 </hudson.tasks.Shell>
208 <org.jenkinsci.plugins.postbuildscript.PostBuildScript>
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 "---> sysstat.sh"
222 set +e # DON'T fail build if script fails.
224 OS=$(facter operatingsystem)
225 case "$OS" in
227 SYSSTAT_PATH="/var/log/sysstat"
229 # Dont run the script when systat is not enabled by default
230 if ! grep --quiet 'ENABLED="true"' "/etc/default/sysstat"; then
235 SYSSTAT_PATH="/var/log/sa"
243 SAR_DIR="$WORKSPACE/archives/sar-reports"
244 mkdir -p "$SAR_DIR"
245 cp "$SYSSTAT_PATH/"* "$_"
246 # convert sar data to ascii format
247 while IFS="" read -r s
249 [ -f "$s" ] && LC_TIME=POSIX sar -A -f "$s" > "$SAR_DIR/sar${s//[!0-9]/}"
250 done < <(find "$SYSSTAT_PATH" -name "sa[0-9]*" || true)
252 # DON'T fail build if script fails.
255 </hudson.tasks.Shell>
256 <org.jenkinsci.plugins.configfiles.builder.ConfigFileBuildStep plugin="config-file-provider">
258 <org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
259 <fileId>jenkins-log-archives-settings</fileId>
261 <variable>SETTINGS_FILE</variable>
262 </org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
264 </org.jenkinsci.plugins.configfiles.builder.ConfigFileBuildStep>
267 <propertiesContent>SERVER_ID=logs</propertiesContent>
272 # SPDX-License-Identifier: EPL-1.0
273 ##############################################################################
274 # Copyright (c) 2017 The Linux Foundation and others.
276 # All rights reserved. This program and the accompanying materials
277 # are made available under the terms of the Eclipse Public License v1.0
278 # which accompanies this distribution, and is available at
279 # http://www.eclipse.org/legal/epl-v10.html
280 ##############################################################################
281 echo "---> create-netrc.sh"
283 # Ensure we fail the job if any steps fail.
286 NEXUS_URL="${NEXUSPROXY:-$NEXUS_URL}"
287 CREDENTIAL=$(xmlstarlet sel -N "x=http://maven.apache.org/SETTINGS/1.0.0" \
288 -t -m "/x:settings/x:servers/x:server[x:id='${SERVER_ID}']" \
289 -v x:username -o ":" -v x:password \
290 "$SETTINGS_FILE")
292 machine=$(echo "$NEXUS_URL" | awk -F/ '{print $3}')
293 user=$(echo "$CREDENTIAL" | cut -f1 -d:)
294 pass=$(echo "$CREDENTIAL" | cut -f2 -d:)
296 echo "machine ${machine%:*} login $user password $pass" > ~/.netrc
298 </hudson.tasks.Shell>
301 # SPDX-License-Identifier: EPL-1.0
302 ##############################################################################
303 # Copyright (c) 2017 The Linux Foundation and others.
305 # All rights reserved. This program and the accompanying materials
306 # are made available under the terms of the Eclipse Public License v1.0
307 # which accompanies this distribution, and is available at
308 # http://www.eclipse.org/legal/epl-v10.html
309 ##############################################################################
310 echo "---> lftools-install.sh"
312 # Script to install lftools via a version passed in via lf-infra-parameters
314 # Required parameters:
316 # LFTOOLS_VERSION: Passed in via lf-infra-parameters configuration. Can be
317 # set to a strict version number like '1.2.3' or using
318 # PEP-440 definitions.
322 # >=1.0.0,<2.0.0
324 # By default a released version of lftools should always be used.
325 # The purpose of the 2 variables below is so that lftools devs can test
326 # unreleased versions of lftools. There are 2 methods to install a dev version
329 # 1) gerrit patch: Used to test a patch that has not yet been merged.
330 # To do this set something like this:
331 # LFTOOLS_MODE=gerrit
332 # LFTOOLS_REFSPEC=refs/changes/96/5296/7
334 # 2) git branch: Used to install an lftools version from a specific branch.
335 # To use this set the variables as follows:
337 # LFTOOLS_REFSPEC=master
339 # 3) release : The intended use case and default setting.
340 # Set LFTOOLS_MODE=release, in this case LFTOOLS_REFSPEC is unused.
342 LFTOOLS_MODE=release # release | git | gerrit
343 LFTOOLS_REFSPEC=master
345 # Ensure we fail the job if any steps fail.
346 # DO NOT set -u as virtualenv's activate script has unbound variables
349 virtualenv --quiet "/tmp/v/lftools"
350 # shellcheck source=/tmp/v/lftools/bin/activate disable=SC1091
351 source "/tmp/v/lftools/bin/activate"
352 pip install --quiet --upgrade pip
354 case $LFTOOLS_MODE in
356 git clone https://gerrit.linuxfoundation.org/infra/releng/lftools.git /tmp/lftools
358 git fetch origin "$LFTOOLS_REFSPEC"
359 git checkout FETCH_HEAD
360 pip install --quiet --upgrade -r requirements.txt
361 pip install --quiet --upgrade -e .
366 pip install --quiet --upgrade git+https://gerrit.linuxfoundation.org/infra/releng/lftools.git@"$BRANCH"
370 if [[ $LFTOOLS_VERSION =~ ^[0-9] ]]; then
371 LFTOOLS_VERSION="==$LFTOOLS_VERSION"
374 pip install --quiet --upgrade "lftools${LFTOOLS_VERSION}"
380 # pipdeptree prints out a lot of information because lftools pulls in many
381 # dependencies. Let's only print it if we want to debug.
382 # echo "----> Pip Dependency Tree"
383 # pip install --quiet --upgrade pipdeptree
387 # SPDX-License-Identifier: EPL-1.0
388 ##############################################################################
389 # Copyright (c) 2017 The Linux Foundation and others.
391 # All rights reserved. This program and the accompanying materials
392 # are made available under the terms of the Eclipse Public License v1.0
393 # which accompanies this distribution, and is available at
394 # http://www.eclipse.org/legal/epl-v10.html
395 ##############################################################################
396 echo "---> logs-deploy.sh"
398 # Ensure we fail the job if any steps fail.
401 set -x # Trace commands for this script to make debugging easier.
403 ARCHIVE_ARTIFACTS="${ARCHIVE_ARTIFACTS:-}"
404 LOGS_SERVER="${LOGS_SERVER:-None}"
406 if [ "${LOGS_SERVER}" == 'None' ]
408 set +x # Disable trace since we no longer need it
410 echo "WARNING: Logging server not set"
412 NEXUS_URL="${NEXUSPROXY:-$NEXUS_URL}"
413 NEXUS_PATH="${SILO}/${JENKINS_HOSTNAME}/${JOB_NAME}/${BUILD_NUMBER}"
414 BUILD_URL="${BUILD_URL}"
416 lftools deploy archives -p "$ARCHIVE_ARTIFACTS" "$NEXUS_URL" "$NEXUS_PATH" "$WORKSPACE"
417 lftools deploy logs "$NEXUS_URL" "$NEXUS_PATH" "$BUILD_URL"
419 set +x # Disable trace since we no longer need it.
421 echo "Build logs: <a href=\"$LOGS_SERVER/$NEXUS_PATH\">$LOGS_SERVER/$NEXUS_PATH</a>"
424 </hudson.tasks.Shell>
427 # SPDX-License-Identifier: EPL-1.0
428 ##############################################################################
429 # Copyright (c) 2017 The Linux Foundation and others.
431 # All rights reserved. This program and the accompanying materials
432 # are made available under the terms of the Eclipse Public License v1.0
433 # which accompanies this distribution, and is available at
434 # http://www.eclipse.org/legal/epl-v10.html
435 ##############################################################################
437 # Clear log credential files
438 rm "$SETTINGS_FILE"
441 </hudson.tasks.Shell>
442 <hudson.plugins.descriptionsetter.DescriptionSetterBuilder>
443 <regexp>^Build logs: .*</regexp>
444 </hudson.plugins.descriptionsetter.DescriptionSetterBuilder>
446 <scriptOnlyIfSuccess>false</scriptOnlyIfSuccess>
447 <scriptOnlyIfFailure>false</scriptOnlyIfFailure>
448 <markBuildUnstable>false</markBuildUnstable>
449 </org.jenkinsci.plugins.postbuildscript.PostBuildScript>
450 <hudson.plugins.ws__cleanup.WsCleanup plugin="ws-cleanup">
452 <hudson.plugins.ws__cleanup.Pattern>
453 <pattern>**/*.jenkins-trigger</pattern>
455 </hudson.plugins.ws__cleanup.Pattern>
457 <deleteDirs>false</deleteDirs>
458 <cleanupMatrixParent>false</cleanupMatrixParent>
460 <cleanWhenSuccess>true</cleanWhenSuccess>
461 <cleanWhenUnstable>true</cleanWhenUnstable>
462 <cleanWhenFailure>true</cleanWhenFailure>
463 <cleanWhenNotBuilt>true</cleanWhenNotBuilt>
464 <cleanWhenAborted>true</cleanWhenAborted>
465 <notFailBuild>true</notFailBuild>
466 </hudson.plugins.ws__cleanup.WsCleanup>
469 <com.michelin.cio.hudson.plugins.maskpasswords.MaskPasswordsBuildWrapper/>
470 <hudson.plugins.build__timeout.BuildTimeoutWrapper>
471 <timeoutMinutes>10</timeoutMinutes>
472 <timeoutEnvVar>BUILD_TIMEOUT</timeoutEnvVar>
473 <failBuild>true</failBuild>
474 <writingDescription>false</writingDescription>
475 <timeoutPercentage>0</timeoutPercentage>
476 <timeoutMinutesElasticDefault>3</timeoutMinutesElasticDefault>
477 <timeoutType>absolute</timeoutType>
478 </hudson.plugins.build__timeout.BuildTimeoutWrapper>
479 <hudson.plugins.timestamper.TimestamperBuildWrapper/>
480 <com.cloudbees.jenkins.plugins.sshagent.SSHAgentBuildWrapper>
481 <user>test-credential</user>
482 </com.cloudbees.jenkins.plugins.sshagent.SSHAgentBuildWrapper>
483 <jenkins.plugins.openstack.compute.JCloudsOneOffSlave/>
484 <org.jenkinsci.plugins.configfiles.buildwrapper.ConfigFileBuildWrapper plugin="config-file-provider">
486 <org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
487 <fileId>npmrc</fileId>
488 <targetLocation>$HOME/.npmrc</targetLocation>
490 </org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
492 </org.jenkinsci.plugins.configfiles.buildwrapper.ConfigFileBuildWrapper>