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 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>
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>
92 <name>refs/heads/master</name>
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 <com.cloudbees.jenkins.GitHubPushTrigger>
120 </com.cloudbees.jenkins.GitHubPushTrigger>
121 <hudson.triggers.SCMTrigger>
123 <ignorePostCommitHooks>false</ignorePostCommitHooks>
124 </hudson.triggers.SCMTrigger>
125 <org.jenkinsci.plugins.ghprb.GhprbTrigger>
127 <adminlist>tykeal</adminlist>
128 <allowMembersOfWhitelistedOrgsAsAdmin>false</allowMembersOfWhitelistedOrgsAsAdmin>
132 <orgslist>example-org</orgslist>
136 <triggerPhrase>^remerge$</triggerPhrase>
138 <onlyTriggerPhrase>true</onlyTriggerPhrase>
139 <useGitHubHooks>true</useGitHubHooks>
140 <permitAll>false</permitAll>
141 <autoCloseFailedPullRequests>false</autoCloseFailedPullRequests>
143 <org.jenkinsci.plugins.ghprb.extensions.status.GhprbSimpleStatus>
144 <commitStatusContext>JJB Merge</commitStatusContext>
145 </org.jenkinsci.plugins.ghprb.extensions.status.GhprbSimpleStatus>
147 </org.jenkinsci.plugins.ghprb.GhprbTrigger>
150 <org.jenkinsci.plugins.configfiles.builder.ConfigFileBuildStep plugin="config-file-provider">
152 <org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
153 <fileId>jjbini</fileId>
154 <targetLocation>$HOME/.config/jenkins_jobs/jenkins_jobs.ini</targetLocation>
156 </org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
158 </org.jenkinsci.plugins.configfiles.builder.ConfigFileBuildStep>
161 # SPDX-License-Identifier: EPL-1.0
162 ##############################################################################
163 # Copyright (c) 2017 The Linux Foundation and others.
165 # All rights reserved. This program and the accompanying materials
166 # are made available under the terms of the Eclipse Public License v1.0
167 # which accompanies this distribution, and is available at
168 # http://www.eclipse.org/legal/epl-v10.html
169 ##############################################################################
170 echo "---> jjb-install.sh"
172 # Ensure we fail the job if any steps fail.
173 # DO NOT set -u as virtualenv's activate script has unbound variables
176 virtualenv "/tmp/v/jjb"
177 # shellcheck source=/tmp/v/jjb/bin/activate disable=SC1091
178 source "/tmp/v/jjb/bin/activate"
179 pip install --quiet --upgrade pip
180 pip install --quiet --upgrade pipdeptree
181 pip install --quiet --upgrade "jenkins-job-builder==$JJB_VERSION"
183 echo "----> Pip Dependency Tree"
187 # SPDX-License-Identifier: EPL-1.0
188 ##############################################################################
189 # Copyright (c) 2017 The Linux Foundation and others.
191 # All rights reserved. This program and the accompanying materials
192 # are made available under the terms of the Eclipse Public License v1.0
193 # which accompanies this distribution, and is available at
194 # http://www.eclipse.org/legal/epl-v10.html
195 ##############################################################################
196 echo "---> jjb-merge-job.sh"
198 # Ensure we fail the job if any steps fail.
201 jenkins-jobs update --recursive --delete-old --workers 4 jjb/
203 </hudson.tasks.Shell>
206 <org.jenkinsci.plugins.postbuildscript.PostBuildScript>
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 "---> sysstat.sh"
220 set +e # DON'T fail build if script fails.
222 OS=$(facter operatingsystem)
223 case "$OS" in
225 SYSSTAT_PATH="/var/log/sysstat"
227 # Dont run the script when systat is not enabled by default
228 if ! grep --quiet 'ENABLED="true"' "/etc/default/sysstat"; then
233 SYSSTAT_PATH="/var/log/sa"
241 SAR_DIR="$WORKSPACE/archives/sar-reports"
242 mkdir -p "$SAR_DIR"
243 cp "$SYSSTAT_PATH/"* "$_"
244 # convert sar data to ascii format
245 while IFS="" read -r sarfilenum
247 [ -f "$sarfilenum" ] && LC_TIME=POSIX sar -A -f "$sarfilenum" > "$SAR_DIR/sar${sarfilenum//[!0-9]/}"
248 done < <(find "$SYSSTAT_PATH" -name "sa[0-9]*" || true)
250 # DON'T fail build if script fails.
253 </hudson.tasks.Shell>
254 <org.jenkinsci.plugins.configfiles.builder.ConfigFileBuildStep plugin="config-file-provider">
256 <org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
257 <fileId>jenkins-log-archives-settings</fileId>
259 <variable>SETTINGS_FILE</variable>
260 </org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
262 </org.jenkinsci.plugins.configfiles.builder.ConfigFileBuildStep>
265 <propertiesContent>SERVER_ID=logs</propertiesContent>
270 # SPDX-License-Identifier: EPL-1.0
271 ##############################################################################
272 # Copyright (c) 2017 The Linux Foundation and others.
274 # All rights reserved. This program and the accompanying materials
275 # are made available under the terms of the Eclipse Public License v1.0
276 # which accompanies this distribution, and is available at
277 # http://www.eclipse.org/legal/epl-v10.html
278 ##############################################################################
279 echo "---> create-netrc.sh"
281 # Ensure we fail the job if any steps fail.
284 NEXUS_URL="${NEXUSPROXY:-$NEXUS_URL}"
285 CREDENTIAL=$(xmlstarlet sel -N "x=http://maven.apache.org/SETTINGS/1.0.0" \
286 -t -m "/x:settings/x:servers/x:server[x:id='${SERVER_ID}']" \
287 -v x:username -o ":" -v x:password \
288 "$SETTINGS_FILE")
290 machine=$(echo "$NEXUS_URL" | awk -F/ '{print $3}')
291 user=$(echo "$CREDENTIAL" | cut -f1 -d:)
292 pass=$(echo "$CREDENTIAL" | cut -f2 -d:)
294 echo "machine ${machine%:*} login $user password $pass" > ~/.netrc
296 </hudson.tasks.Shell>
299 # SPDX-License-Identifier: EPL-1.0
300 ##############################################################################
301 # Copyright (c) 2017 The Linux Foundation and others.
303 # All rights reserved. This program and the accompanying materials
304 # are made available under the terms of the Eclipse Public License v1.0
305 # which accompanies this distribution, and is available at
306 # http://www.eclipse.org/legal/epl-v10.html
307 ##############################################################################
308 echo "---> lftools-install.sh"
310 # Script to install lftools via a version passed in via lf-infra-parameters
312 # Required parameters:
314 # LFTOOLS_VERSION: Passed in via lf-infra-parameters configuration. Can be
315 # set to a strict version number like '1.2.3' or using
316 # PEP-440 definitions.
320 # >=1.0.0,<2.0.0
322 # By default a released version of lftools should always be used.
323 # The purpose of the 2 variables below is so that lftools devs can test
324 # unreleased versions of lftools. There are 2 methods to install a dev version
327 # 1) gerrit patch: Used to test a patch that has not yet been merged.
328 # To do this set something like this:
329 # LFTOOLS_MODE=gerrit
330 # LFTOOLS_REFSPEC=refs/changes/96/5296/7
332 # 2) git branch: Used to install an lftools version from a specific branch.
333 # To use this set the variables as follows:
335 # LFTOOLS_REFSPEC=master
337 # 3) release : The intended use case and default setting.
338 # Set LFTOOLS_MODE=release, in this case LFTOOLS_REFSPEC is unused.
340 LFTOOLS_MODE=release # release | git | gerrit
341 LFTOOLS_REFSPEC=master
343 # Ensure we fail the job if any steps fail.
344 # DO NOT set -u as virtualenv's activate script has unbound variables
347 virtualenv --quiet "/tmp/v/lftools"
348 # shellcheck source=/tmp/v/lftools/bin/activate disable=SC1091
349 source "/tmp/v/lftools/bin/activate"
350 pip install --quiet --upgrade pip
352 case $LFTOOLS_MODE in
354 git clone https://gerrit.linuxfoundation.org/infra/releng/lftools.git /tmp/lftools
356 git fetch origin "$LFTOOLS_REFSPEC"
357 git checkout FETCH_HEAD
358 pip install --quiet --upgrade -r requirements.txt
359 pip install --quiet --upgrade -e .
364 pip install --quiet --upgrade git+https://gerrit.linuxfoundation.org/infra/releng/lftools.git@"$BRANCH"
368 if [[ $LFTOOLS_VERSION =~ ^[0-9] ]]; then
369 LFTOOLS_VERSION="==$LFTOOLS_VERSION"
372 pip install --quiet --upgrade "lftools${LFTOOLS_VERSION}"
378 # pipdeptree prints out a lot of information because lftools pulls in many
379 # dependencies. Let's only print it if we want to debug.
380 # echo "----> Pip Dependency Tree"
381 # pip install --quiet --upgrade pipdeptree
385 # SPDX-License-Identifier: EPL-1.0
386 ##############################################################################
387 # Copyright (c) 2017 The Linux Foundation and others.
389 # All rights reserved. This program and the accompanying materials
390 # are made available under the terms of the Eclipse Public License v1.0
391 # which accompanies this distribution, and is available at
392 # http://www.eclipse.org/legal/epl-v10.html
393 ##############################################################################
394 echo "---> logs-deploy.sh"
396 # Ensure we fail the job if any steps fail.
399 set -x # Trace commands for this script to make debugging easier.
401 ARCHIVE_ARTIFACTS="${ARCHIVE_ARTIFACTS:-}"
402 LOGS_SERVER="${LOGS_SERVER:-None}"
404 if [ "${LOGS_SERVER}" == 'None' ]
406 set +x # Disable trace since we no longer need it
408 echo "WARNING: Logging server not set"
410 NEXUS_URL="${NEXUSPROXY:-$NEXUS_URL}"
411 NEXUS_PATH="${SILO}/${JENKINS_HOSTNAME}/${JOB_NAME}/${BUILD_NUMBER}"
412 BUILD_URL="${BUILD_URL}"
414 lftools deploy archives -p "$ARCHIVE_ARTIFACTS" "$NEXUS_URL" "$NEXUS_PATH" "$WORKSPACE"
415 lftools deploy logs "$NEXUS_URL" "$NEXUS_PATH" "$BUILD_URL"
417 set +x # Disable trace since we no longer need it.
419 echo "Build logs: <a href=\"$LOGS_SERVER/$NEXUS_PATH\">$LOGS_SERVER/$NEXUS_PATH</a>"
422 </hudson.tasks.Shell>
425 # SPDX-License-Identifier: EPL-1.0
426 ##############################################################################
427 # Copyright (c) 2017 The Linux Foundation and others.
429 # All rights reserved. This program and the accompanying materials
430 # are made available under the terms of the Eclipse Public License v1.0
431 # which accompanies this distribution, and is available at
432 # http://www.eclipse.org/legal/epl-v10.html
433 ##############################################################################
435 # Clear log credential files
436 rm "$SETTINGS_FILE"
439 </hudson.tasks.Shell>
440 <hudson.plugins.descriptionsetter.DescriptionSetterBuilder>
441 <regexp>^Build logs: .*</regexp>
442 </hudson.plugins.descriptionsetter.DescriptionSetterBuilder>
444 <scriptOnlyIfSuccess>false</scriptOnlyIfSuccess>
445 <scriptOnlyIfFailure>false</scriptOnlyIfFailure>
446 <markBuildUnstable>false</markBuildUnstable>
447 </org.jenkinsci.plugins.postbuildscript.PostBuildScript>
448 <hudson.plugins.ws__cleanup.WsCleanup plugin="ws-cleanup">
450 <hudson.plugins.ws__cleanup.Pattern>
451 <pattern>**/*.jenkins-trigger</pattern>
453 </hudson.plugins.ws__cleanup.Pattern>
455 <deleteDirs>false</deleteDirs>
456 <cleanupMatrixParent>false</cleanupMatrixParent>
458 <cleanWhenSuccess>true</cleanWhenSuccess>
459 <cleanWhenUnstable>true</cleanWhenUnstable>
460 <cleanWhenFailure>true</cleanWhenFailure>
461 <cleanWhenNotBuilt>true</cleanWhenNotBuilt>
462 <cleanWhenAborted>true</cleanWhenAborted>
463 <notFailBuild>true</notFailBuild>
464 </hudson.plugins.ws__cleanup.WsCleanup>
467 <com.michelin.cio.hudson.plugins.maskpasswords.MaskPasswordsBuildWrapper/>
468 <hudson.plugins.build__timeout.BuildTimeoutWrapper>
469 <timeoutMinutes>10</timeoutMinutes>
470 <timeoutEnvVar>BUILD_TIMEOUT</timeoutEnvVar>
471 <failBuild>true</failBuild>
472 <writingDescription>false</writingDescription>
473 <timeoutPercentage>0</timeoutPercentage>
474 <timeoutMinutesElasticDefault>3</timeoutMinutesElasticDefault>
475 <timeoutType>absolute</timeoutType>
476 </hudson.plugins.build__timeout.BuildTimeoutWrapper>
477 <hudson.plugins.timestamper.TimestamperBuildWrapper/>
478 <com.cloudbees.jenkins.plugins.sshagent.SSHAgentBuildWrapper>
479 <user>test-credential</user>
480 </com.cloudbees.jenkins.plugins.sshagent.SSHAgentBuildWrapper>
481 <jenkins.plugins.openstack.compute.JCloudsOneOffSlave/>
482 <org.jenkinsci.plugins.configfiles.buildwrapper.ConfigFileBuildWrapper plugin="config-file-provider">
484 <org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
485 <fileId>npmrc</fileId>
486 <targetLocation>$HOME/.npmrc</targetLocation>
488 </org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
490 </org.jenkinsci.plugins.configfiles.buildwrapper.ConfigFileBuildWrapper>