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.
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>
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 <com.cloudbees.jenkins.GitHubPushTrigger>
116 </com.cloudbees.jenkins.GitHubPushTrigger>
117 <hudson.triggers.SCMTrigger>
119 <ignorePostCommitHooks>false</ignorePostCommitHooks>
120 </hudson.triggers.SCMTrigger>
121 <org.jenkinsci.plugins.ghprb.GhprbTrigger>
123 <adminlist>tykeal</adminlist>
124 <allowMembersOfWhitelistedOrgsAsAdmin>false</allowMembersOfWhitelistedOrgsAsAdmin>
128 <orgslist>example-org</orgslist>
130 <triggerPhrase>^remerge$</triggerPhrase>
131 <onlyTriggerPhrase>true</onlyTriggerPhrase>
132 <useGitHubHooks>true</useGitHubHooks>
133 <permitAll>false</permitAll>
134 <autoCloseFailedPullRequests>false</autoCloseFailedPullRequests>
136 <org.jenkinsci.plugins.ghprb.extensions.status.GhprbSimpleStatus>
137 <commitStatusContext>JJB Merge</commitStatusContext>
138 </org.jenkinsci.plugins.ghprb.extensions.status.GhprbSimpleStatus>
140 </org.jenkinsci.plugins.ghprb.GhprbTrigger>
143 <org.jenkinsci.plugins.configfiles.builder.ConfigFileBuildStep plugin="config-file-provider">
145 <org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
146 <fileId>jjbini</fileId>
147 <targetLocation>$HOME/.config/jenkins_jobs/jenkins_jobs.ini</targetLocation>
149 </org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
151 </org.jenkinsci.plugins.configfiles.builder.ConfigFileBuildStep>
154 # SPDX-License-Identifier: EPL-1.0
155 ##############################################################################
156 # Copyright (c) 2017 The Linux Foundation and others.
158 # All rights reserved. This program and the accompanying materials
159 # are made available under the terms of the Eclipse Public License v1.0
160 # which accompanies this distribution, and is available at
161 # http://www.eclipse.org/legal/epl-v10.html
162 ##############################################################################
163 echo "---> jjb-install.sh"
165 # Ensure we fail the job if any steps fail.
166 # DO NOT set -u as virtualenv's activate script has unbound variables
169 virtualenv "/tmp/v/jjb"
170 # shellcheck source=/tmp/v/jjb/bin/activate disable=SC1091
171 source "/tmp/v/jjb/bin/activate"
172 pip install --quiet --upgrade pip
173 pip install --quiet --upgrade pipdeptree
174 pip install --quiet --upgrade "jenkins-job-builder==$JJB_VERSION"
176 echo "----> Pip Dependency Tree"
180 # SPDX-License-Identifier: EPL-1.0
181 ##############################################################################
182 # Copyright (c) 2017 The Linux Foundation and others.
184 # All rights reserved. This program and the accompanying materials
185 # are made available under the terms of the Eclipse Public License v1.0
186 # which accompanies this distribution, and is available at
187 # http://www.eclipse.org/legal/epl-v10.html
188 ##############################################################################
189 echo "---> jjb-merge-job.sh"
191 # Ensure we fail the job if any steps fail.
194 jenkins-jobs update --recursive --delete-old --workers 4 --exclude jjb-test jjb
196 </hudson.tasks.Shell>
199 <org.jenkinsci.plugins.postbuildscript.PostBuildScript>
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 "---> sysstat.sh"
213 set +e # DON'T fail build if script fails.
215 OS=$(facter operatingsystem)
216 case "$OS" in
218 SYSSTAT_PATH="/var/log/sysstat"
220 # Dont run the script when systat is not enabled by default
221 if ! grep --quiet 'ENABLED="true"' "/etc/default/sysstat"; then
226 SYSSTAT_PATH="/var/log/sa"
234 SAR_DIR="$WORKSPACE/archives/sar-reports"
235 mkdir -p "$SAR_DIR"
236 cp "$SYSSTAT_PATH/"* "$_"
237 # convert sar data to ascii format
238 while IFS="" read -r s
240 [ -f "$s" ] && LC_TIME=POSIX sar -A -f "$s" > "$SAR_DIR/sar${s//[!0-9]/}"
241 done < <(find "$SYSSTAT_PATH" -name "sa[0-9]*" || true)
243 # DON'T fail build if script fails.
246 </hudson.tasks.Shell>
247 <org.jenkinsci.plugins.configfiles.builder.ConfigFileBuildStep plugin="config-file-provider">
249 <org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
250 <fileId>jenkins-log-archives-settings</fileId>
252 <variable>SETTINGS_FILE</variable>
253 </org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
255 </org.jenkinsci.plugins.configfiles.builder.ConfigFileBuildStep>
258 <propertiesContent>SERVER_ID=logs</propertiesContent>
263 # SPDX-License-Identifier: EPL-1.0
264 ##############################################################################
265 # Copyright (c) 2017 The Linux Foundation and others.
267 # All rights reserved. This program and the accompanying materials
268 # are made available under the terms of the Eclipse Public License v1.0
269 # which accompanies this distribution, and is available at
270 # http://www.eclipse.org/legal/epl-v10.html
271 ##############################################################################
272 echo "---> create-netrc.sh"
274 # Ensure we fail the job if any steps fail.
277 NEXUS_URL="${NEXUS_URL:-$NEXUSPROXY}"
278 CREDENTIAL=$(xmlstarlet sel -N "x=http://maven.apache.org/SETTINGS/1.0.0" \
279 -t -m "/x:settings/x:servers/x:server[x:id='${SERVER_ID}']" \
280 -v x:username -o ":" -v x:password \
281 "$SETTINGS_FILE")
283 machine=$(echo "$NEXUS_URL" | awk -F/ '{print $3}')
284 user=$(echo "$CREDENTIAL" | cut -f1 -d:)
285 pass=$(echo "$CREDENTIAL" | cut -f2 -d:)
287 echo "machine $machine login $user password $pass" > ~/.netrc
289 </hudson.tasks.Shell>
292 # SPDX-License-Identifier: EPL-1.0
293 ##############################################################################
294 # Copyright (c) 2017 The Linux Foundation and others.
296 # All rights reserved. This program and the accompanying materials
297 # are made available under the terms of the Eclipse Public License v1.0
298 # which accompanies this distribution, and is available at
299 # http://www.eclipse.org/legal/epl-v10.html
300 ##############################################################################
301 echo "---> lftools-install.sh"
303 # By default a released version of lftools should always be used.
304 # The purpose of the 2 variables below is so that lftools devs can test
305 # unreleased versions of lftools. There are 2 methods to install a dev version
308 # 1) gerrit patch: Used to test a patch that has not yet been merged.
309 # To do this set something like this:
310 # LFTOOLS_MODE=gerrit
311 # LFTOOLS_REFSPEC=refs/changes/96/5296/7
313 # 2) git branch: Used to install an lftools version from a specific branch.
314 # To use this set the variables as follows:
316 # LFTOOLS_REFSPEC=master
318 # 3) release : The intended use case and default setting.
319 # Set LFTOOLS_MODE=release, in this case LFTOOLS_REFSPEC is unused.
321 LFTOOLS_MODE=release # release | git | gerrit
322 LFTOOLS_REFSPEC=master
324 # Ensure we fail the job if any steps fail.
325 # DO NOT set -u as virtualenv's activate script has unbound variables
328 virtualenv --quiet "/tmp/v/lftools"
329 # shellcheck source=/tmp/v/lftools/bin/activate disable=SC1091
330 source "/tmp/v/lftools/bin/activate"
331 pip install --quiet --upgrade pip
333 case $LFTOOLS_MODE in
335 git clone https://gerrit.linuxfoundation.org/infra/releng/lftools.git /tmp/lftools
337 git fetch origin "$LFTOOLS_REFSPEC"
338 git checkout FETCH_HEAD
339 pip install --quiet --upgrade -r requirements.txt
340 pip install --quiet --upgrade -e .
345 pip install --quiet --upgrade git+https://gerrit.linuxfoundation.org/infra/releng/lftools.git@"$BRANCH"
349 pip install --quiet --upgrade "lftools<1.0.0"
353 # pipdeptree prints out a lot of information because lftools pulls in many
354 # dependencies. Let's only print it if we want to debug.
355 # echo "----> Pip Dependency Tree"
356 # pip install --quiet --upgrade pipdeptree
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 "---> logs-deploy.sh"
371 # Ensure we fail the job if any steps fail.
374 set -x # Trace commands for this script to make debugging easier.
376 ARCHIVE_ARTIFACTS="${ARCHIVE_ARTIFACTS:-}"
377 LOGS_SERVER="${LOGS_SERVER:-None}"
379 if [ "${LOGS_SERVER}" == 'None' ]
381 set +x # Disable trace since we no longer need it
383 echo "WARNING: Logging server not set"
385 NEXUS_URL="${NEXUS_URL:-$NEXUSPROXY}"
386 NEXUS_PATH="${SILO}/${JENKINS_HOSTNAME}/${JOB_NAME}/${BUILD_NUMBER}"
387 BUILD_URL="${BUILD_URL}"
389 lftools deploy archives -p "$ARCHIVE_ARTIFACTS" "$NEXUS_URL" "$NEXUS_PATH" "$WORKSPACE"
390 lftools deploy logs "$NEXUS_URL" "$NEXUS_PATH" "$BUILD_URL"
392 set +x # Disable trace since we no longer need it.
394 echo "Build logs: <a href=\"$LOGS_SERVER/$NEXUS_PATH\">$LOGS_SERVER/$NEXUS_PATH</a>"
397 </hudson.tasks.Shell>
400 # SPDX-License-Identifier: EPL-1.0
401 ##############################################################################
402 # Copyright (c) 2017 The Linux Foundation and others.
404 # All rights reserved. This program and the accompanying materials
405 # are made available under the terms of the Eclipse Public License v1.0
406 # which accompanies this distribution, and is available at
407 # http://www.eclipse.org/legal/epl-v10.html
408 ##############################################################################
410 # Clear log credential files
411 rm "$SETTINGS_FILE"
414 </hudson.tasks.Shell>
415 <hudson.plugins.descriptionsetter.DescriptionSetterBuilder>
416 <regexp>^Build logs: .*</regexp>
417 </hudson.plugins.descriptionsetter.DescriptionSetterBuilder>
419 <scriptOnlyIfSuccess>false</scriptOnlyIfSuccess>
420 <scriptOnlyIfFailure>false</scriptOnlyIfFailure>
421 <markBuildUnstable>false</markBuildUnstable>
422 </org.jenkinsci.plugins.postbuildscript.PostBuildScript>
423 <hudson.plugins.ws__cleanup.WsCleanup plugin="ws-cleanup">
425 <hudson.plugins.ws__cleanup.Pattern>
426 <pattern>**/*.jenkins-trigger</pattern>
428 </hudson.plugins.ws__cleanup.Pattern>
430 <deleteDirs>false</deleteDirs>
431 <cleanupMatrixParent>false</cleanupMatrixParent>
433 <cleanWhenSuccess>true</cleanWhenSuccess>
434 <cleanWhenUnstable>true</cleanWhenUnstable>
435 <cleanWhenFailure>true</cleanWhenFailure>
436 <cleanWhenNotBuilt>true</cleanWhenNotBuilt>
437 <cleanWhenAborted>true</cleanWhenAborted>
438 <notFailBuild>true</notFailBuild>
439 </hudson.plugins.ws__cleanup.WsCleanup>
442 <com.michelin.cio.hudson.plugins.maskpasswords.MaskPasswordsBuildWrapper/>
443 <hudson.plugins.build__timeout.BuildTimeoutWrapper>
444 <timeoutMinutes>10</timeoutMinutes>
445 <timeoutEnvVar>BUILD_TIMEOUT</timeoutEnvVar>
446 <failBuild>true</failBuild>
447 <writingDescription>false</writingDescription>
448 <timeoutPercentage>0</timeoutPercentage>
449 <timeoutMinutesElasticDefault>3</timeoutMinutesElasticDefault>
450 <timeoutType>absolute</timeoutType>
451 </hudson.plugins.build__timeout.BuildTimeoutWrapper>
452 <hudson.plugins.timestamper.TimestamperBuildWrapper/>
453 <com.cloudbees.jenkins.plugins.sshagent.SSHAgentBuildWrapper>
454 <user>test-credential</user>
455 </com.cloudbees.jenkins.plugins.sshagent.SSHAgentBuildWrapper>
456 <jenkins.plugins.openstack.compute.JCloudsOneOffSlave/>