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>
94 <doGenerateSubmoduleConfigurations>false</doGenerateSubmoduleConfigurations>
95 <remotePoll>false</remotePoll>
96 <gitTool>Default</gitTool>
97 <submoduleCfg class="list"/>
102 <hudson.plugins.git.extensions.impl.BuildChooserSetting>
103 <buildChooser class="hudson.plugins.git.util.DefaultBuildChooser"/>
104 </hudson.plugins.git.extensions.impl.BuildChooserSetting>
105 <hudson.plugins.git.extensions.impl.SubmoduleOption>
106 <disableSubmodules>false</disableSubmodules>
107 <recursiveSubmodules>true</recursiveSubmodules>
108 <trackingSubmodules>false</trackingSubmodules>
109 <parentCredentials>false</parentCredentials>
111 <timeout>10</timeout>
112 </hudson.plugins.git.extensions.impl.SubmoduleOption>
113 <hudson.plugins.git.extensions.impl.WipeWorkspace/>
116 <triggers class="vector">
117 <com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.GerritTrigger>
120 <com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.data.GerritProject>
121 <compareType>ANT</compareType>
122 <pattern>releng/ciman</pattern>
124 <com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.data.Branch>
125 <compareType>ANT</compareType>
126 <pattern>**/master</pattern>
127 </com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.data.Branch>
129 <disableStrictForbiddenFileVerification>false</disableStrictForbiddenFileVerification>
130 </com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.data.GerritProject>
133 <onSuccessful>false</onSuccessful>
134 <onFailed>false</onFailed>
135 <onUnstable>false</onUnstable>
136 <onNotBuilt>false</onNotBuilt>
138 <silentMode>false</silentMode>
139 <silentStartMode>false</silentStartMode>
140 <escapeQuotes>true</escapeQuotes>
141 <noNameAndEmailParameters>false</noNameAndEmailParameters>
142 <readableMessage>false</readableMessage>
143 <dependencyJobsNames/>
145 <dynamicTriggerConfiguration>False</dynamicTriggerConfiguration>
147 <allowTriggeringUnreviewedPatches>false</allowTriggeringUnreviewedPatches>
149 <com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.events.PluginCommentAddedContainsEvent>
150 <commentAddedCommentContains>jjb-deploy (?!\*+$).+$</commentAddedCommentContains>
151 </com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.events.PluginCommentAddedContainsEvent>
154 <buildFailureMessage/>
155 <buildSuccessfulMessage/>
156 <buildUnstableMessage/>
157 <buildNotBuiltMessage/>
158 <buildUnsuccessfulFilepath/>
160 <serverName>test-server</serverName>
161 </com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.GerritTrigger>
166 <propertiesContent>PIP_PACKAGES=jenkins-job-builder</propertiesContent>
171 # SPDX-License-Identifier: EPL-1.0
172 ##############################################################################
173 # Copyright (c) 2017 The Linux Foundation and others.
175 # All rights reserved. This program and the accompanying materials
176 # are made available under the terms of the Eclipse Public License v1.0
177 # which accompanies this distribution, and is available at
178 # http://www.eclipse.org/legal/epl-v10.html
179 ##############################################################################
180 # pip install packages into a virtualenv using the first listed package as venv name
182 # PIP_PACKAGES is a space separated list of pypi packages to install. The first
183 # listed package is used as the virtualenv directory name.
184 echo "---> pip-install.sh"
186 # Ensure we fail the job if any steps fail.
187 # DO NOT set -u as virtualenv's activate script has unbound variables
190 # Install git-review using virtualenv to the latest version that supports
191 # --reviewers option, available through pip install. Existing minion image has a
192 # version that does not have it.
193 virtualenv "/tmp/v/${PIP_PACKAGES%% *}"
194 # shellcheck source=/tmp/v/venv/bin/activate disable=SC1091
195 source "/tmp/v/${PIP_PACKAGES%% *}/bin/activate"
196 pip install --quiet --upgrade pip
197 pip install --quiet --upgrade pipdeptree
199 # PIP_PACKAGES needs to be passed through as a space separated list of packages
200 # shellcheck disable=SC2086
201 pip install --upgrade $PIP_PACKAGES
203 echo "----> Pip Dependency Tree"
206 </hudson.tasks.Shell>
207 <org.jenkinsci.plugins.configfiles.builder.ConfigFileBuildStep plugin="config-file-provider">
209 <org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
210 <fileId>jjbini-sandbox</fileId>
211 <targetLocation>$HOME/.config/jenkins_jobs/jenkins_jobs.ini</targetLocation>
213 </org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
215 </org.jenkinsci.plugins.configfiles.builder.ConfigFileBuildStep>
218 # SPDX-License-Identifier: EPL-1.0
219 ##############################################################################
220 # Copyright (c) 2017 The Linux Foundation and others.
222 # All rights reserved. This program and the accompanying materials
223 # are made available under the terms of the Eclipse Public License v1.0
224 # which accompanies this distribution, and is available at
225 # http://www.eclipse.org/legal/epl-v10.html
226 ##############################################################################
227 # Push a job to jenkins-sandbox via Gerrit / GitHub comment
228 # Comment Pattern: jjb-deploy JOB_NAME
229 # JOB_NAME: Can also include * wildcards too. Additional parameters are ignored.
230 echo "---> jjb-deploy-job.sh"
232 # Ensure we fail the job if any steps fail.
235 # shellcheck source=/tmp/v/jenkins-job-builder/bin/activate disable=SC1091
236 source "/tmp/v/jenkins-job-builder/bin/activate"
238 echo "-----> Fetching project"
239 git fetch origin "$GERRIT_REFSPEC" && git checkout FETCH_HEAD
241 # If not Gerrit Trigger than assume GitHub
242 COMMENT="${GERRIT_EVENT_COMMENT_TEXT:-$ghprbCommentBody}"
243 JOB_NAME=$(echo "$COMMENT" | grep jjb-deploy | awk '{print $2}')
245 # Strip all * characters to prevent pushing all jobs to Jenkins
246 if [ -z "${JOB_NAME//\*/}" ]; then
247 echo "ERROR: JOB_NAME cannot be empty or '*'."
251 jenkins-jobs update --recursive --workers 4 jjb/ "$JOB_NAME"
253 </hudson.tasks.Shell>
256 <org.jenkinsci.plugins.postbuildscript.PostBuildScript>
260 # SPDX-License-Identifier: EPL-1.0
261 ##############################################################################
262 # Copyright (c) 2017 The Linux Foundation and others.
264 # All rights reserved. This program and the accompanying materials
265 # are made available under the terms of the Eclipse Public License v1.0
266 # which accompanies this distribution, and is available at
267 # http://www.eclipse.org/legal/epl-v10.html
268 ##############################################################################
269 echo "---> sysstat.sh"
270 set +e # DON'T fail build if script fails.
272 OS=$(facter operatingsystem)
273 case "$OS" in
275 SYSSTAT_PATH="/var/log/sysstat"
277 # Dont run the script when systat is not enabled by default
278 if ! grep --quiet 'ENABLED="true"' "/etc/default/sysstat"; then
283 SYSSTAT_PATH="/var/log/sa"
291 SAR_DIR="$WORKSPACE/archives/sar-reports"
292 mkdir -p "$SAR_DIR"
293 cp "$SYSSTAT_PATH/"* "$_"
294 # convert sar data to ascii format
295 while IFS="" read -r sarfilenum
297 [ -f "$sarfilenum" ] && LC_TIME=POSIX sar -A -f "$sarfilenum" > "$SAR_DIR/sar${sarfilenum//[!0-9]/}"
298 done < <(find "$SYSSTAT_PATH" -name "sa[0-9]*" || true)
300 # DON'T fail build if script fails.
303 </hudson.tasks.Shell>
304 <org.jenkinsci.plugins.configfiles.builder.ConfigFileBuildStep plugin="config-file-provider">
306 <org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
307 <fileId>jenkins-log-archives-settings</fileId>
309 <variable>SETTINGS_FILE</variable>
310 </org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
312 </org.jenkinsci.plugins.configfiles.builder.ConfigFileBuildStep>
315 <propertiesContent>SERVER_ID=logs</propertiesContent>
320 # SPDX-License-Identifier: EPL-1.0
321 ##############################################################################
322 # Copyright (c) 2017 The Linux Foundation and others.
324 # All rights reserved. This program and the accompanying materials
325 # are made available under the terms of the Eclipse Public License v1.0
326 # which accompanies this distribution, and is available at
327 # http://www.eclipse.org/legal/epl-v10.html
328 ##############################################################################
329 echo "---> create-netrc.sh"
331 # Ensure we fail the job if any steps fail.
334 NEXUS_URL="${NEXUSPROXY:-$NEXUS_URL}"
335 CREDENTIAL=$(xmlstarlet sel -N "x=http://maven.apache.org/SETTINGS/1.0.0" \
336 -t -m "/x:settings/x:servers/x:server[x:id='${SERVER_ID}']" \
337 -v x:username -o ":" -v x:password \
338 "$SETTINGS_FILE")
340 machine=$(echo "$NEXUS_URL" | awk -F/ '{print $3}')
341 user=$(echo "$CREDENTIAL" | cut -f1 -d:)
342 pass=$(echo "$CREDENTIAL" | cut -f2 -d:)
344 echo "machine ${machine%:*} login $user password $pass" > ~/.netrc
346 </hudson.tasks.Shell>
349 # SPDX-License-Identifier: EPL-1.0
350 ##############################################################################
351 # Copyright (c) 2017 The Linux Foundation and others.
353 # All rights reserved. This program and the accompanying materials
354 # are made available under the terms of the Eclipse Public License v1.0
355 # which accompanies this distribution, and is available at
356 # http://www.eclipse.org/legal/epl-v10.html
357 ##############################################################################
358 echo "---> lftools-install.sh"
360 # Script to install lftools via a version passed in via lf-infra-parameters
362 # Required parameters:
364 # LFTOOLS_VERSION: Passed in via lf-infra-parameters configuration. Can be
365 # set to a strict version number like '1.2.3' or using
366 # PEP-440 definitions.
370 # >=1.0.0,<2.0.0
372 # By default a released version of lftools should always be used.
373 # The purpose of the 2 variables below is so that lftools devs can test
374 # unreleased versions of lftools. There are 2 methods to install a dev version
377 # 1) gerrit patch: Used to test a patch that has not yet been merged.
378 # To do this set something like this:
379 # LFTOOLS_MODE=gerrit
380 # LFTOOLS_REFSPEC=refs/changes/96/5296/7
382 # 2) git branch: Used to install an lftools version from a specific branch.
383 # To use this set the variables as follows:
385 # LFTOOLS_REFSPEC=master
387 # 3) release : The intended use case and default setting.
388 # Set LFTOOLS_MODE=release, in this case LFTOOLS_REFSPEC is unused.
390 LFTOOLS_MODE=release # release | git | gerrit
391 LFTOOLS_REFSPEC=master
393 # Ensure we fail the job if any steps fail.
394 # DO NOT set -u as virtualenv's activate script has unbound variables
397 virtualenv --quiet "/tmp/v/lftools"
398 # shellcheck source=/tmp/v/lftools/bin/activate disable=SC1091
399 source "/tmp/v/lftools/bin/activate"
400 pip install --quiet --upgrade pip
402 case $LFTOOLS_MODE in
404 git clone https://gerrit.linuxfoundation.org/infra/releng/lftools.git /tmp/lftools
406 git fetch origin "$LFTOOLS_REFSPEC"
407 git checkout FETCH_HEAD
408 pip install --quiet --upgrade -r requirements.txt
409 pip install --quiet --upgrade -e .
414 pip install --quiet --upgrade git+https://gerrit.linuxfoundation.org/infra/releng/lftools.git@"$BRANCH"
418 if [[ $LFTOOLS_VERSION =~ ^[0-9] ]]; then
419 LFTOOLS_VERSION="==$LFTOOLS_VERSION"
422 pip install --quiet --upgrade "lftools${LFTOOLS_VERSION}"
428 # pipdeptree prints out a lot of information because lftools pulls in many
429 # dependencies. Let's only print it if we want to debug.
430 # echo "----> Pip Dependency Tree"
431 # pip install --quiet --upgrade pipdeptree
435 # SPDX-License-Identifier: EPL-1.0
436 ##############################################################################
437 # Copyright (c) 2017 The Linux Foundation and others.
439 # All rights reserved. This program and the accompanying materials
440 # are made available under the terms of the Eclipse Public License v1.0
441 # which accompanies this distribution, and is available at
442 # http://www.eclipse.org/legal/epl-v10.html
443 ##############################################################################
444 echo "---> logs-deploy.sh"
446 # Ensure we fail the job if any steps fail.
449 set -x # Trace commands for this script to make debugging easier.
451 ARCHIVE_ARTIFACTS="${ARCHIVE_ARTIFACTS:-}"
452 LOGS_SERVER="${LOGS_SERVER:-None}"
454 if [ "${LOGS_SERVER}" == 'None' ]
456 set +x # Disable trace since we no longer need it
458 echo "WARNING: Logging server not set"
460 NEXUS_URL="${NEXUSPROXY:-$NEXUS_URL}"
461 NEXUS_PATH="${SILO}/${JENKINS_HOSTNAME}/${JOB_NAME}/${BUILD_NUMBER}"
462 BUILD_URL="${BUILD_URL}"
464 lftools deploy archives -p "$ARCHIVE_ARTIFACTS" "$NEXUS_URL" "$NEXUS_PATH" "$WORKSPACE"
465 lftools deploy logs "$NEXUS_URL" "$NEXUS_PATH" "$BUILD_URL"
467 set +x # Disable trace since we no longer need it.
469 echo "Build logs: <a href=\"$LOGS_SERVER/$NEXUS_PATH\">$LOGS_SERVER/$NEXUS_PATH</a>"
472 </hudson.tasks.Shell>
475 # SPDX-License-Identifier: EPL-1.0
476 ##############################################################################
477 # Copyright (c) 2017 The Linux Foundation and others.
479 # All rights reserved. This program and the accompanying materials
480 # are made available under the terms of the Eclipse Public License v1.0
481 # which accompanies this distribution, and is available at
482 # http://www.eclipse.org/legal/epl-v10.html
483 ##############################################################################
485 # Clear log credential files
486 rm "$SETTINGS_FILE"
489 </hudson.tasks.Shell>
490 <hudson.plugins.descriptionsetter.DescriptionSetterBuilder>
491 <regexp>^Build logs: .*</regexp>
492 </hudson.plugins.descriptionsetter.DescriptionSetterBuilder>
494 <scriptOnlyIfSuccess>false</scriptOnlyIfSuccess>
495 <scriptOnlyIfFailure>false</scriptOnlyIfFailure>
496 <markBuildUnstable>false</markBuildUnstable>
497 </org.jenkinsci.plugins.postbuildscript.PostBuildScript>
498 <hudson.plugins.ws__cleanup.WsCleanup plugin="ws-cleanup">
500 <hudson.plugins.ws__cleanup.Pattern>
501 <pattern>**/*.jenkins-trigger</pattern>
503 </hudson.plugins.ws__cleanup.Pattern>
505 <deleteDirs>false</deleteDirs>
506 <cleanupMatrixParent>false</cleanupMatrixParent>
508 <cleanWhenSuccess>true</cleanWhenSuccess>
509 <cleanWhenUnstable>true</cleanWhenUnstable>
510 <cleanWhenFailure>true</cleanWhenFailure>
511 <cleanWhenNotBuilt>true</cleanWhenNotBuilt>
512 <cleanWhenAborted>true</cleanWhenAborted>
513 <notFailBuild>true</notFailBuild>
514 </hudson.plugins.ws__cleanup.WsCleanup>
517 <com.michelin.cio.hudson.plugins.maskpasswords.MaskPasswordsBuildWrapper/>
518 <hudson.plugins.build__timeout.BuildTimeoutWrapper>
519 <timeoutMinutes>5</timeoutMinutes>
520 <timeoutEnvVar>BUILD_TIMEOUT</timeoutEnvVar>
521 <failBuild>true</failBuild>
522 <writingDescription>false</writingDescription>
523 <timeoutPercentage>0</timeoutPercentage>
524 <timeoutMinutesElasticDefault>3</timeoutMinutesElasticDefault>
525 <timeoutType>absolute</timeoutType>
526 </hudson.plugins.build__timeout.BuildTimeoutWrapper>
527 <hudson.plugins.timestamper.TimestamperBuildWrapper/>
528 <com.cloudbees.jenkins.plugins.sshagent.SSHAgentBuildWrapper>
529 <user>test-credential</user>
530 </com.cloudbees.jenkins.plugins.sshagent.SSHAgentBuildWrapper>
531 <jenkins.plugins.openstack.compute.JCloudsOneOffSlave/>
532 <org.jenkinsci.plugins.configfiles.buildwrapper.ConfigFileBuildWrapper plugin="config-file-provider">
534 <org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
535 <fileId>npmrc</fileId>
536 <targetLocation>$HOME/.npmrc</targetLocation>
538 </org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
540 </org.jenkinsci.plugins.configfiles.buildwrapper.ConfigFileBuildWrapper>