1 <?xml version="1.0" encoding="utf-8"?>
5 <description><!-- Managed by Jenkins Job Builder --></description>
6 <keepDependencies>false</keepDependencies>
7 <blockBuildWhenDownstreamBuilding>false</blockBuildWhenDownstreamBuilding>
8 <blockBuildWhenUpstreamBuilding>false</blockBuildWhenUpstreamBuilding>
9 <concurrentBuild>false</concurrentBuild>
10 <assignedNode>build-vm</assignedNode>
11 <canRoam>false</canRoam>
13 <com.coravy.hudson.plugins.github.GithubProjectProperty>
14 <projectUrl>$GIT_URL/$PROJECT/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>MAVEN_OPTS</name>
74 <description>Maven Java opts. Example: -Xmx1024m -XX:MaxPermSize=256m
77 </hudson.model.StringParameterDefinition>
78 <hudson.model.StringParameterDefinition>
79 <name>MAVEN_PARAMS</name>
80 <description>Maven parameters to pass to the mvn command.
83 </hudson.model.StringParameterDefinition>
84 <hudson.model.StringParameterDefinition>
86 <description>Maven selector to be used by shell scripts</description>
87 <defaultValue>/w/tools/hudson.tasks.Maven_MavenInstallation/mvn33/bin/mvn</defaultValue>
88 </hudson.model.StringParameterDefinition>
89 <hudson.model.StringParameterDefinition>
90 <name>STAGING_PROFILE_ID</name>
91 <description>Nexus staging profile ID.
93 <defaultValue>uuddlrlrba</defaultValue>
94 </hudson.model.StringParameterDefinition>
95 </parameterDefinitions>
96 </hudson.model.ParametersDefinitionProperty>
98 <scm class="hudson.plugins.git.GitSCM">
99 <configVersion>2</configVersion>
101 <hudson.plugins.git.UserRemoteConfig>
103 <refspec>+refs/pull/*:refs/remotes/origin/pr/*</refspec>
104 <url>git@github.com:example-org/releng/ciman</url>
105 <credentialsId>test-credential</credentialsId>
106 </hudson.plugins.git.UserRemoteConfig>
109 <hudson.plugins.git.BranchSpec>
111 </hudson.plugins.git.BranchSpec>
114 <buildChooser class="hudson.plugins.git.util.DefaultBuildChooser"/>
115 <doGenerateSubmoduleConfigurations>false</doGenerateSubmoduleConfigurations>
116 <authorOrCommitter>false</authorOrCommitter>
117 <wipeOutWorkspace>true</wipeOutWorkspace>
118 <pruneBranches>false</pruneBranches>
119 <remotePoll>false</remotePoll>
120 <gitTool>Default</gitTool>
121 <submoduleCfg class="list"/>
126 <skipTag>true</skipTag>
128 <useShallowClone>false</useShallowClone>
129 <ignoreNotifyCommit>false</ignoreNotifyCommit>
131 <hudson.plugins.git.extensions.impl.SubmoduleOption>
132 <disableSubmodules>false</disableSubmodules>
133 <recursiveSubmodules>true</recursiveSubmodules>
134 <trackingSubmodules>false</trackingSubmodules>
136 <timeout>10</timeout>
137 </hudson.plugins.git.extensions.impl.SubmoduleOption>
138 <hudson.plugins.git.extensions.impl.WipeWorkspace/>
141 <triggers class="vector">
142 <hudson.triggers.TimerTrigger>
143 <spec>H H * * 6</spec>
144 </hudson.triggers.TimerTrigger>
148 <command>echo "quiet=on" > "$HOME/.wgetrc"</command>
149 </hudson.tasks.Shell>
151 <targets>--version</targets>
153 <mavenName>mvn33</mavenName>
154 <usePrivateRepository>false</usePrivateRepository>
155 <settings class="jenkins.mvn.DefaultSettingsProvider"/>
156 <globalSettings class="jenkins.mvn.DefaultGlobalSettingsProvider"/>
157 </hudson.tasks.Maven>
159 <command>rm "$HOME/.wgetrc"</command>
160 </hudson.tasks.Shell>
161 <org.jenkinsci.plugins.configfiles.builder.ConfigFileBuildStep plugin="config-file-provider">
163 <org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
164 <fileId>global-settings</fileId>
166 <variable>GLOBAL_SETTINGS_FILE</variable>
167 </org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
168 <org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
169 <fileId>aproject-settings</fileId>
171 <variable>SETTINGS_FILE</variable>
172 </org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
174 </org.jenkinsci.plugins.configfiles.builder.ConfigFileBuildStep>
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 ##############################################################################
187 # This file contains a list of variables that are generally useful in many
188 # scripts. It is meant to be sourced in other scripts so that the variables can
191 MAVEN_OPTIONS="$(echo --show-version \
194 -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn \
195 -Dmaven.repo.local=/tmp/r \
196 -Dorg.ops4j.pax.url.mvn.localRepository=/tmp/r)"
197 echo "$MAVEN_OPTIONS"
200 # SPDX-License-Identifier: EPL-1.0
201 ##############################################################################
202 # Copyright (c) 2017 The Linux Foundation and others.
204 # All rights reserved. This program and the accompanying materials
205 # are made available under the terms of the Eclipse Public License v1.0
206 # which accompanies this distribution, and is available at
207 # http://www.eclipse.org/legal/epl-v10.html
208 ##############################################################################
210 # This script builds a Maven project and deploys it into a staging repo which
211 # can be used to deploy elsewhere later eg. Nexus staging / snapshot repos.
213 # DO NOT enable -u because $MAVEN_PARAMS and $MAVEN_OPTIONS could be unbound.
214 # Ensure we fail the job if any steps fail.
220 # Disable SC2086 because we want to allow word splitting for $MAVEN_* parameters.
221 # shellcheck disable=SC2086
222 $MVN clean install dependency:tree com.sonatype.clm:clm-maven-plugin:index \
223 --global-settings "$GLOBAL_SETTINGS_FILE" \
224 --settings "$SETTINGS_FILE" \
225 -DaltDeploymentRepository=staging::default::file:"$WORKSPACE"/m2repo \
226 $MAVEN_PARAMS $MAVEN_OPTIONS
228 </hudson.tasks.Shell>
231 set +e # DO NOT cause build failure if any of the rm calls fail.
233 rm "$GLOBAL_SETTINGS_FILE" "$SETTINGS_FILE"
235 # In some cases we use the lf-provide-maven-settings macro to produce
236 # a "$HOME/.netrc" file containing credentials. Remove that file here
238 rm "$HOME/.netrc"
240 # DO NOT fail build if any of the above lines fail.
243 </hudson.tasks.Shell>
245 <command>find . -regex ".*karaf/target" | xargs rm -rf</command>
246 </hudson.tasks.Shell>
247 <com.sonatype.insight.ci.hudson.PreBuildScan plugin="sonatype-clm-ci">
248 <applicationSelectType>
250 <applicationId>github-maven</applicationId>
251 </applicationSelectType>
257 <failOnClmServerFailures>false</failOnClmServerFailures>
258 <stageId>build</stageId>
261 </com.sonatype.insight.ci.hudson.PreBuildScan>
264 <org.jenkinsci.plugins.postbuildscript.PostBuildScript>
268 # SPDX-License-Identifier: EPL-1.0
269 ##############################################################################
270 # Copyright (c) 2017 The Linux Foundation and others.
272 # All rights reserved. This program and the accompanying materials
273 # are made available under the terms of the Eclipse Public License v1.0
274 # which accompanies this distribution, and is available at
275 # http://www.eclipse.org/legal/epl-v10.html
276 ##############################################################################
277 echo "---> sysstat.sh"
278 set +e # DON'T fail build if script fails.
280 OS=$(facter operatingsystem)
281 case "$OS" in
283 SYSSTAT_PATH="/var/log/sysstat"
285 # Dont run the script when systat is not enabled by default
286 if ! grep --quiet 'ENABLED="true"' "/etc/default/sysstat"; then
291 SYSSTAT_PATH="/var/log/sa"
299 SAR_DIR="$WORKSPACE/archives/sar-reports"
300 mkdir -p "$SAR_DIR"
301 cp "$SYSSTAT_PATH/"* "$_"
302 # convert sar data to ascii format
303 while IFS="" read -r s
305 [ -f "$s" ] && LC_TIME=POSIX sar -A -f "$s" > "$SAR_DIR/sar${s//[!0-9]/}"
306 done < <(find "$SYSSTAT_PATH" -name "sa[0-9]*" || true)
308 # DON'T fail build if script fails.
311 </hudson.tasks.Shell>
312 <org.jenkinsci.plugins.configfiles.builder.ConfigFileBuildStep plugin="config-file-provider">
314 <org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
315 <fileId>jenkins-log-archives-settings</fileId>
317 <variable>SETTINGS_FILE</variable>
318 </org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
320 </org.jenkinsci.plugins.configfiles.builder.ConfigFileBuildStep>
323 <propertiesContent>SERVER_ID=logs</propertiesContent>
328 # SPDX-License-Identifier: EPL-1.0
329 ##############################################################################
330 # Copyright (c) 2017 The Linux Foundation and others.
332 # All rights reserved. This program and the accompanying materials
333 # are made available under the terms of the Eclipse Public License v1.0
334 # which accompanies this distribution, and is available at
335 # http://www.eclipse.org/legal/epl-v10.html
336 ##############################################################################
337 echo "---> create-netrc.sh"
339 # Ensure we fail the job if any steps fail.
342 NEXUS_URL="${NEXUS_URL:-$NEXUSPROXY}"
343 CREDENTIAL=$(xmlstarlet sel -N "x=http://maven.apache.org/SETTINGS/1.0.0" \
344 -t -m "/x:settings/x:servers/x:server[x:id='${SERVER_ID}']" \
345 -v x:username -o ":" -v x:password \
346 "$SETTINGS_FILE")
348 machine=$(echo "$NEXUS_URL" | awk -F/ '{print $3}')
349 user=$(echo "$CREDENTIAL" | cut -f1 -d:)
350 pass=$(echo "$CREDENTIAL" | cut -f2 -d:)
352 echo "machine $machine login $user password $pass" > ~/.netrc
354 </hudson.tasks.Shell>
357 # SPDX-License-Identifier: EPL-1.0
358 ##############################################################################
359 # Copyright (c) 2017 The Linux Foundation and others.
361 # All rights reserved. This program and the accompanying materials
362 # are made available under the terms of the Eclipse Public License v1.0
363 # which accompanies this distribution, and is available at
364 # http://www.eclipse.org/legal/epl-v10.html
365 ##############################################################################
366 echo "---> lftools-install.sh"
368 # Script to install lftools via a version passed in via lf-infra-parameters
370 # Required parameters:
372 # LFTOOLS_VERSION: Passed in via lf-infra-parameters configuration. Can be
373 # set to a strict version number like '1.2.3' or using
374 # PEP-440 definitions.
378 # >=1.0.0,<2.0.0
380 # By default a released version of lftools should always be used.
381 # The purpose of the 2 variables below is so that lftools devs can test
382 # unreleased versions of lftools. There are 2 methods to install a dev version
385 # 1) gerrit patch: Used to test a patch that has not yet been merged.
386 # To do this set something like this:
387 # LFTOOLS_MODE=gerrit
388 # LFTOOLS_REFSPEC=refs/changes/96/5296/7
390 # 2) git branch: Used to install an lftools version from a specific branch.
391 # To use this set the variables as follows:
393 # LFTOOLS_REFSPEC=master
395 # 3) release : The intended use case and default setting.
396 # Set LFTOOLS_MODE=release, in this case LFTOOLS_REFSPEC is unused.
398 LFTOOLS_MODE=release # release | git | gerrit
399 LFTOOLS_REFSPEC=master
401 # Ensure we fail the job if any steps fail.
402 # DO NOT set -u as virtualenv's activate script has unbound variables
405 virtualenv --quiet "/tmp/v/lftools"
406 # shellcheck source=/tmp/v/lftools/bin/activate disable=SC1091
407 source "/tmp/v/lftools/bin/activate"
408 pip install --quiet --upgrade pip
410 case $LFTOOLS_MODE in
412 git clone https://gerrit.linuxfoundation.org/infra/releng/lftools.git /tmp/lftools
414 git fetch origin "$LFTOOLS_REFSPEC"
415 git checkout FETCH_HEAD
416 pip install --quiet --upgrade -r requirements.txt
417 pip install --quiet --upgrade -e .
422 pip install --quiet --upgrade git+https://gerrit.linuxfoundation.org/infra/releng/lftools.git@"$BRANCH"
426 if [[ $LFTOOLS_VERSION =~ ^[0-9] ]]; then
427 LFTOOLS_VERSION="==$LFTOOLS_VERSION"
430 pip install --quiet --upgrade "lftools${LFTOOLS_VERSION}"
436 # pipdeptree prints out a lot of information because lftools pulls in many
437 # dependencies. Let's only print it if we want to debug.
438 # echo "----> Pip Dependency Tree"
439 # pip install --quiet --upgrade pipdeptree
443 # SPDX-License-Identifier: EPL-1.0
444 ##############################################################################
445 # Copyright (c) 2017 The Linux Foundation and others.
447 # All rights reserved. This program and the accompanying materials
448 # are made available under the terms of the Eclipse Public License v1.0
449 # which accompanies this distribution, and is available at
450 # http://www.eclipse.org/legal/epl-v10.html
451 ##############################################################################
452 echo "---> logs-deploy.sh"
454 # Ensure we fail the job if any steps fail.
457 set -x # Trace commands for this script to make debugging easier.
459 ARCHIVE_ARTIFACTS="${ARCHIVE_ARTIFACTS:-}"
460 LOGS_SERVER="${LOGS_SERVER:-None}"
462 if [ "${LOGS_SERVER}" == 'None' ]
464 set +x # Disable trace since we no longer need it
466 echo "WARNING: Logging server not set"
468 NEXUS_URL="${NEXUS_URL:-$NEXUSPROXY}"
469 NEXUS_PATH="${SILO}/${JENKINS_HOSTNAME}/${JOB_NAME}/${BUILD_NUMBER}"
470 BUILD_URL="${BUILD_URL}"
472 lftools deploy archives -p "$ARCHIVE_ARTIFACTS" "$NEXUS_URL" "$NEXUS_PATH" "$WORKSPACE"
473 lftools deploy logs "$NEXUS_URL" "$NEXUS_PATH" "$BUILD_URL"
475 set +x # Disable trace since we no longer need it.
477 echo "Build logs: <a href=\"$LOGS_SERVER/$NEXUS_PATH\">$LOGS_SERVER/$NEXUS_PATH</a>"
480 </hudson.tasks.Shell>
483 # SPDX-License-Identifier: EPL-1.0
484 ##############################################################################
485 # Copyright (c) 2017 The Linux Foundation and others.
487 # All rights reserved. This program and the accompanying materials
488 # are made available under the terms of the Eclipse Public License v1.0
489 # which accompanies this distribution, and is available at
490 # http://www.eclipse.org/legal/epl-v10.html
491 ##############################################################################
493 # Clear log credential files
494 rm "$SETTINGS_FILE"
497 </hudson.tasks.Shell>
498 <hudson.plugins.descriptionsetter.DescriptionSetterBuilder>
499 <regexp>^Build logs: .*</regexp>
500 </hudson.plugins.descriptionsetter.DescriptionSetterBuilder>
502 <scriptOnlyIfSuccess>false</scriptOnlyIfSuccess>
503 <scriptOnlyIfFailure>false</scriptOnlyIfFailure>
504 <markBuildUnstable>false</markBuildUnstable>
505 </org.jenkinsci.plugins.postbuildscript.PostBuildScript>
506 <hudson.plugins.ws__cleanup.WsCleanup plugin="ws-cleanup">
508 <hudson.plugins.ws__cleanup.Pattern>
509 <pattern>**/*.jenkins-trigger</pattern>
511 </hudson.plugins.ws__cleanup.Pattern>
513 <deleteDirs>false</deleteDirs>
514 <cleanupMatrixParent>false</cleanupMatrixParent>
516 <cleanWhenSuccess>true</cleanWhenSuccess>
517 <cleanWhenUnstable>true</cleanWhenUnstable>
518 <cleanWhenFailure>true</cleanWhenFailure>
519 <cleanWhenNotBuilt>true</cleanWhenNotBuilt>
520 <cleanWhenAborted>true</cleanWhenAborted>
521 <notFailBuild>true</notFailBuild>
522 </hudson.plugins.ws__cleanup.WsCleanup>
525 <com.michelin.cio.hudson.plugins.maskpasswords.MaskPasswordsBuildWrapper/>
526 <hudson.plugins.build__timeout.BuildTimeoutWrapper>
527 <timeoutMinutes>15</timeoutMinutes>
528 <timeoutEnvVar>BUILD_TIMEOUT</timeoutEnvVar>
529 <failBuild>true</failBuild>
530 <writingDescription>false</writingDescription>
531 <timeoutPercentage>0</timeoutPercentage>
532 <timeoutMinutesElasticDefault>3</timeoutMinutesElasticDefault>
533 <timeoutType>absolute</timeoutType>
534 </hudson.plugins.build__timeout.BuildTimeoutWrapper>
535 <hudson.plugins.timestamper.TimestamperBuildWrapper/>
536 <com.cloudbees.jenkins.plugins.sshagent.SSHAgentBuildWrapper>
537 <user>test-credential</user>
538 </com.cloudbees.jenkins.plugins.sshagent.SSHAgentBuildWrapper>
539 <jenkins.plugins.openstack.compute.JCloudsOneOffSlave/>