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 <jenkins.model.BuildDiscarderProperty>
13 <strategy class="hudson.tasks.LogRotator">
14 <daysToKeep>1</daysToKeep>
15 <numToKeep>-1</numToKeep>
16 <artifactDaysToKeep>-1</artifactDaysToKeep>
17 <artifactNumToKeep>0</artifactNumToKeep>
19 </jenkins.model.BuildDiscarderProperty>
20 <hudson.model.ParametersDefinitionProperty>
21 <parameterDefinitions>
22 <hudson.model.StringParameterDefinition>
24 <description>Parameter to identify a Gerrit project. This is typically the
25 project repo path as exists in Gerrit.
26 For example: ofextensions/circuitsw
28 <defaultValue>releng/ciman</defaultValue>
29 </hudson.model.StringParameterDefinition>
30 <hudson.model.StringParameterDefinition>
32 <description>Stream is often set to the same name as 'branch' but can
33 sometimes be used as a name representing a project's release code
36 <defaultValue>master</defaultValue>
37 </hudson.model.StringParameterDefinition>
38 <hudson.model.StringParameterDefinition>
39 <name>GERRIT_PROJECT</name>
40 <description>Parameter to identify Gerrit project. This is typically the
41 project repo path as exists in Gerrit.
42 For example: ofextensions/circuitsw
44 Note that Gerrit will override this parameter automatically if a
45 job is triggered by Gerrit.
47 <defaultValue>releng/ciman</defaultValue>
48 </hudson.model.StringParameterDefinition>
49 <hudson.model.StringParameterDefinition>
50 <name>GERRIT_BRANCH</name>
51 <description>Parameter to identify a Gerrit branch.
53 Note that Gerrit will override this parameter automatically if a
54 job is triggered by Gerrit.
56 <defaultValue>master</defaultValue>
57 </hudson.model.StringParameterDefinition>
58 <hudson.model.StringParameterDefinition>
59 <name>GERRIT_REFSPEC</name>
60 <description>Parameter to identify a refspec when pulling from Gerrit.
62 Note that Gerrit will override this parameter automatically if a
63 job is triggered by Gerrit.
65 <defaultValue>refs/heads/master</defaultValue>
66 </hudson.model.StringParameterDefinition>
67 <hudson.model.StringParameterDefinition>
68 <name>LFTOOLS_VERSION</name>
69 <description>Version of lftools to install. Can be a specific version like
70 '0.6.0' or a PEP-440 definition.
71 https://www.python.org/dev/peps/pep-0440/
72 For example '<1.0.0' or '>=1.0.0,<2.0.0'.
74 <defaultValue><1.0.0</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>
84 <refspec>refs/heads/master</refspec>
85 <url>$GIT_URL/$GERRIT_PROJECT</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.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.GerritTrigger>
126 <com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.data.GerritProject>
127 <compareType>ANT</compareType>
128 <pattern>releng/ciman</pattern>
130 <com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.data.Branch>
131 <compareType>ANT</compareType>
132 <pattern>**/master</pattern>
133 </com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.data.Branch>
135 <disableStrictForbiddenFileVerification>false</disableStrictForbiddenFileVerification>
136 </com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.data.GerritProject>
139 <onSuccessful>false</onSuccessful>
140 <onFailed>false</onFailed>
141 <onUnstable>false</onUnstable>
142 <onNotBuilt>false</onNotBuilt>
144 <silentMode>false</silentMode>
145 <silentStartMode>false</silentStartMode>
146 <escapeQuotes>true</escapeQuotes>
147 <noNameAndEmailParameters>false</noNameAndEmailParameters>
148 <readableMessage>false</readableMessage>
149 <dependencyJobsNames/>
151 <dynamicTriggerConfiguration>False</dynamicTriggerConfiguration>
153 <allowTriggeringUnreviewedPatches>false</allowTriggeringUnreviewedPatches>
155 <com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.events.PluginCommentAddedContainsEvent>
156 <commentAddedCommentContains>jjb-deploy (?!\*+$).+$</commentAddedCommentContains>
157 </com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.events.PluginCommentAddedContainsEvent>
160 <buildFailureMessage/>
161 <buildSuccessfulMessage/>
162 <buildUnstableMessage/>
163 <buildNotBuiltMessage/>
164 <buildUnsuccessfulFilepath/>
166 <serverName>test-server</serverName>
167 </com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.GerritTrigger>
172 <propertiesContent>PIP_PACKAGES=jenkins-job-builder</propertiesContent>
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 # pip install packages into a virtualenv using the first listed package as venv name
188 # PIP_PACKAGES is a space separated list of pypi packages to install. The first
189 # listed package is used as the virtualenv directory name.
190 echo "---> pip-install.sh"
192 # Ensure we fail the job if any steps fail.
193 # DO NOT set -u as virtualenv's activate script has unbound variables
196 # Install git-review using virtualenv to the latest version that supports
197 # --reviewers option, available through pip install. Existing minion image has a
198 # version that does not have it.
199 virtualenv "/tmp/v/${PIP_PACKAGES%% *}"
200 # shellcheck source=/tmp/v/venv/bin/activate disable=SC1091
201 source "/tmp/v/${PIP_PACKAGES%% *}/bin/activate"
202 pip install --quiet --upgrade pip
203 pip install --quiet --upgrade pipdeptree
205 # PIP_PACKAGES needs to be passed through as a space separated list of packages
206 # shellcheck disable=SC2086
207 pip install --upgrade $PIP_PACKAGES
209 echo "----> Pip Dependency Tree"
212 </hudson.tasks.Shell>
213 <org.jenkinsci.plugins.configfiles.builder.ConfigFileBuildStep plugin="config-file-provider">
215 <org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
216 <fileId>jjbini-sandbox</fileId>
217 <targetLocation>$HOME/.config/jenkins_jobs/jenkins_jobs.ini</targetLocation>
219 </org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
221 </org.jenkinsci.plugins.configfiles.builder.ConfigFileBuildStep>
224 # SPDX-License-Identifier: EPL-1.0
225 ##############################################################################
226 # Copyright (c) 2017 The Linux Foundation and others.
228 # All rights reserved. This program and the accompanying materials
229 # are made available under the terms of the Eclipse Public License v1.0
230 # which accompanies this distribution, and is available at
231 # http://www.eclipse.org/legal/epl-v10.html
232 ##############################################################################
233 # Push a job to jenkins-sandbox via Gerrit / GitHub comment
234 # Comment Pattern: jjb-deploy JOB_NAME
235 # JOB_NAME: Can also include * wildcards too. Additional parameters are ignored.
236 echo "---> jjb-deploy-job.sh"
238 # Ensure we fail the job if any steps fail.
241 # shellcheck source=/tmp/v/jenkins-job-builder/bin/activate disable=SC1091
242 source "/tmp/v/jenkins-job-builder/bin/activate"
244 echo "-----> Fetching project"
245 git fetch origin "$GERRIT_REFSPEC" && git checkout FETCH_HEAD
247 # If not Gerrit Trigger than assume GitHub
248 COMMENT="${GERRIT_EVENT_COMMENT_TEXT:-$ghprbCommentBody}"
249 JOB_NAME=$(echo "$COMMENT" | grep jjb-deploy | awk '{print $2}')
251 # Strip all * characters to prevent pushing all jobs to Jenkins
252 if [ -z "${JOB_NAME//\*/}" ]; then
253 echo "ERROR: JOB_NAME cannot be empty or '*'."
257 jenkins-jobs update --recursive --workers 4 jjb/ "$JOB_NAME"
259 </hudson.tasks.Shell>
262 <org.jenkinsci.plugins.postbuildscript.PostBuildScript>
266 # SPDX-License-Identifier: EPL-1.0
267 ##############################################################################
268 # Copyright (c) 2017 The Linux Foundation and others.
270 # All rights reserved. This program and the accompanying materials
271 # are made available under the terms of the Eclipse Public License v1.0
272 # which accompanies this distribution, and is available at
273 # http://www.eclipse.org/legal/epl-v10.html
274 ##############################################################################
275 echo "---> sysstat.sh"
276 set +e # DON'T fail build if script fails.
278 OS=$(facter operatingsystem)
279 case "$OS" in
281 SYSSTAT_PATH="/var/log/sysstat"
283 # Dont run the script when systat is not enabled by default
284 if ! grep --quiet 'ENABLED="true"' "/etc/default/sysstat"; then
289 SYSSTAT_PATH="/var/log/sa"
297 SAR_DIR="$WORKSPACE/archives/sar-reports"
298 mkdir -p "$SAR_DIR"
299 cp "$SYSSTAT_PATH/"* "$_"
300 # convert sar data to ascii format
301 while IFS="" read -r s
303 [ -f "$s" ] && LC_TIME=POSIX sar -A -f "$s" > "$SAR_DIR/sar${s//[!0-9]/}"
304 done < <(find "$SYSSTAT_PATH" -name "sa[0-9]*" || true)
306 # DON'T fail build if script fails.
309 </hudson.tasks.Shell>
310 <org.jenkinsci.plugins.configfiles.builder.ConfigFileBuildStep plugin="config-file-provider">
312 <org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
313 <fileId>jenkins-log-archives-settings</fileId>
315 <variable>SETTINGS_FILE</variable>
316 </org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
318 </org.jenkinsci.plugins.configfiles.builder.ConfigFileBuildStep>
321 <propertiesContent>SERVER_ID=logs</propertiesContent>
326 # SPDX-License-Identifier: EPL-1.0
327 ##############################################################################
328 # Copyright (c) 2017 The Linux Foundation and others.
330 # All rights reserved. This program and the accompanying materials
331 # are made available under the terms of the Eclipse Public License v1.0
332 # which accompanies this distribution, and is available at
333 # http://www.eclipse.org/legal/epl-v10.html
334 ##############################################################################
335 echo "---> create-netrc.sh"
337 # Ensure we fail the job if any steps fail.
340 NEXUS_URL="${NEXUS_URL:-$NEXUSPROXY}"
341 CREDENTIAL=$(xmlstarlet sel -N "x=http://maven.apache.org/SETTINGS/1.0.0" \
342 -t -m "/x:settings/x:servers/x:server[x:id='${SERVER_ID}']" \
343 -v x:username -o ":" -v x:password \
344 "$SETTINGS_FILE")
346 machine=$(echo "$NEXUS_URL" | awk -F/ '{print $3}')
347 user=$(echo "$CREDENTIAL" | cut -f1 -d:)
348 pass=$(echo "$CREDENTIAL" | cut -f2 -d:)
350 echo "machine $machine login $user password $pass" > ~/.netrc
352 </hudson.tasks.Shell>
355 # SPDX-License-Identifier: EPL-1.0
356 ##############################################################################
357 # Copyright (c) 2017 The Linux Foundation and others.
359 # All rights reserved. This program and the accompanying materials
360 # are made available under the terms of the Eclipse Public License v1.0
361 # which accompanies this distribution, and is available at
362 # http://www.eclipse.org/legal/epl-v10.html
363 ##############################################################################
364 echo "---> lftools-install.sh"
366 # Script to install lftools via a version passed in via lf-infra-parameters
368 # Required parameters:
370 # LFTOOLS_VERSION: Passed in via lf-infra-parameters configuration. Can be
371 # set to a strict version number like '1.2.3' or using
372 # PEP-440 definitions.
376 # >=1.0.0,<2.0.0
378 # By default a released version of lftools should always be used.
379 # The purpose of the 2 variables below is so that lftools devs can test
380 # unreleased versions of lftools. There are 2 methods to install a dev version
383 # 1) gerrit patch: Used to test a patch that has not yet been merged.
384 # To do this set something like this:
385 # LFTOOLS_MODE=gerrit
386 # LFTOOLS_REFSPEC=refs/changes/96/5296/7
388 # 2) git branch: Used to install an lftools version from a specific branch.
389 # To use this set the variables as follows:
391 # LFTOOLS_REFSPEC=master
393 # 3) release : The intended use case and default setting.
394 # Set LFTOOLS_MODE=release, in this case LFTOOLS_REFSPEC is unused.
396 LFTOOLS_MODE=release # release | git | gerrit
397 LFTOOLS_REFSPEC=master
399 # Ensure we fail the job if any steps fail.
400 # DO NOT set -u as virtualenv's activate script has unbound variables
403 virtualenv --quiet "/tmp/v/lftools"
404 # shellcheck source=/tmp/v/lftools/bin/activate disable=SC1091
405 source "/tmp/v/lftools/bin/activate"
406 pip install --quiet --upgrade pip
408 case $LFTOOLS_MODE in
410 git clone https://gerrit.linuxfoundation.org/infra/releng/lftools.git /tmp/lftools
412 git fetch origin "$LFTOOLS_REFSPEC"
413 git checkout FETCH_HEAD
414 pip install --quiet --upgrade -r requirements.txt
415 pip install --quiet --upgrade -e .
420 pip install --quiet --upgrade git+https://gerrit.linuxfoundation.org/infra/releng/lftools.git@"$BRANCH"
424 if [[ $LFTOOLS_VERSION =~ ^[0-9] ]]; then
425 LFTOOLS_VERSION="==$LFTOOLS_VERSION"
428 pip install --quiet --upgrade "lftools${LFTOOLS_VERSION}"
434 # pipdeptree prints out a lot of information because lftools pulls in many
435 # dependencies. Let's only print it if we want to debug.
436 # echo "----> Pip Dependency Tree"
437 # pip install --quiet --upgrade pipdeptree
441 # SPDX-License-Identifier: EPL-1.0
442 ##############################################################################
443 # Copyright (c) 2017 The Linux Foundation and others.
445 # All rights reserved. This program and the accompanying materials
446 # are made available under the terms of the Eclipse Public License v1.0
447 # which accompanies this distribution, and is available at
448 # http://www.eclipse.org/legal/epl-v10.html
449 ##############################################################################
450 echo "---> logs-deploy.sh"
452 # Ensure we fail the job if any steps fail.
455 set -x # Trace commands for this script to make debugging easier.
457 ARCHIVE_ARTIFACTS="${ARCHIVE_ARTIFACTS:-}"
458 LOGS_SERVER="${LOGS_SERVER:-None}"
460 if [ "${LOGS_SERVER}" == 'None' ]
462 set +x # Disable trace since we no longer need it
464 echo "WARNING: Logging server not set"
466 NEXUS_URL="${NEXUS_URL:-$NEXUSPROXY}"
467 NEXUS_PATH="${SILO}/${JENKINS_HOSTNAME}/${JOB_NAME}/${BUILD_NUMBER}"
468 BUILD_URL="${BUILD_URL}"
470 lftools deploy archives -p "$ARCHIVE_ARTIFACTS" "$NEXUS_URL" "$NEXUS_PATH" "$WORKSPACE"
471 lftools deploy logs "$NEXUS_URL" "$NEXUS_PATH" "$BUILD_URL"
473 set +x # Disable trace since we no longer need it.
475 echo "Build logs: <a href=\"$LOGS_SERVER/$NEXUS_PATH\">$LOGS_SERVER/$NEXUS_PATH</a>"
478 </hudson.tasks.Shell>
481 # SPDX-License-Identifier: EPL-1.0
482 ##############################################################################
483 # Copyright (c) 2017 The Linux Foundation and others.
485 # All rights reserved. This program and the accompanying materials
486 # are made available under the terms of the Eclipse Public License v1.0
487 # which accompanies this distribution, and is available at
488 # http://www.eclipse.org/legal/epl-v10.html
489 ##############################################################################
491 # Clear log credential files
492 rm "$SETTINGS_FILE"
495 </hudson.tasks.Shell>
496 <hudson.plugins.descriptionsetter.DescriptionSetterBuilder>
497 <regexp>^Build logs: .*</regexp>
498 </hudson.plugins.descriptionsetter.DescriptionSetterBuilder>
500 <scriptOnlyIfSuccess>false</scriptOnlyIfSuccess>
501 <scriptOnlyIfFailure>false</scriptOnlyIfFailure>
502 <markBuildUnstable>false</markBuildUnstable>
503 </org.jenkinsci.plugins.postbuildscript.PostBuildScript>
504 <hudson.plugins.ws__cleanup.WsCleanup plugin="ws-cleanup">
506 <hudson.plugins.ws__cleanup.Pattern>
507 <pattern>**/*.jenkins-trigger</pattern>
509 </hudson.plugins.ws__cleanup.Pattern>
511 <deleteDirs>false</deleteDirs>
512 <cleanupMatrixParent>false</cleanupMatrixParent>
514 <cleanWhenSuccess>true</cleanWhenSuccess>
515 <cleanWhenUnstable>true</cleanWhenUnstable>
516 <cleanWhenFailure>true</cleanWhenFailure>
517 <cleanWhenNotBuilt>true</cleanWhenNotBuilt>
518 <cleanWhenAborted>true</cleanWhenAborted>
519 <notFailBuild>true</notFailBuild>
520 </hudson.plugins.ws__cleanup.WsCleanup>
523 <com.michelin.cio.hudson.plugins.maskpasswords.MaskPasswordsBuildWrapper/>
524 <hudson.plugins.build__timeout.BuildTimeoutWrapper>
525 <timeoutMinutes>5</timeoutMinutes>
526 <timeoutEnvVar>BUILD_TIMEOUT</timeoutEnvVar>
527 <failBuild>true</failBuild>
528 <writingDescription>false</writingDescription>
529 <timeoutPercentage>0</timeoutPercentage>
530 <timeoutMinutesElasticDefault>3</timeoutMinutesElasticDefault>
531 <timeoutType>absolute</timeoutType>
532 </hudson.plugins.build__timeout.BuildTimeoutWrapper>
533 <hudson.plugins.timestamper.TimestamperBuildWrapper/>
534 <com.cloudbees.jenkins.plugins.sshagent.SSHAgentBuildWrapper>
535 <user>test-credential</user>
536 </com.cloudbees.jenkins.plugins.sshagent.SSHAgentBuildWrapper>
537 <jenkins.plugins.openstack.compute.JCloudsOneOffSlave/>