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 <jenkins.model.BuildDiscarderProperty>
14 <strategy class="hudson.tasks.LogRotator">
15 <daysToKeep>30</daysToKeep>
16 <numToKeep>-1</numToKeep>
17 <artifactDaysToKeep>-1</artifactDaysToKeep>
18 <artifactNumToKeep>0</artifactNumToKeep>
20 </jenkins.model.BuildDiscarderProperty>
21 <hudson.model.ParametersDefinitionProperty>
22 <parameterDefinitions>
23 <hudson.model.StringParameterDefinition>
25 <description>Parameter to identify a Gerrit project. This is typically the
26 project repo path as exists in Gerrit.
27 For example: ofextensions/circuitsw
29 <defaultValue>releng/ciman</defaultValue>
30 </hudson.model.StringParameterDefinition>
31 <hudson.model.StringParameterDefinition>
33 <description>Stream is often set to the same name as 'branch' but can
34 sometimes be used as a name representing a project's release code
37 <defaultValue>master</defaultValue>
38 </hudson.model.StringParameterDefinition>
39 <hudson.model.StringParameterDefinition>
40 <name>GERRIT_PROJECT</name>
41 <description>Parameter to identify Gerrit project. This is typically the
42 project repo path as exists in Gerrit.
43 For example: ofextensions/circuitsw
45 Note that Gerrit will override this parameter automatically if a
46 job is triggered by Gerrit.
48 <defaultValue>releng/ciman</defaultValue>
49 </hudson.model.StringParameterDefinition>
50 <hudson.model.StringParameterDefinition>
51 <name>GERRIT_BRANCH</name>
52 <description>Parameter to identify a Gerrit branch.
54 Note that Gerrit will override this parameter automatically if a
55 job is triggered by Gerrit.
57 <defaultValue>master</defaultValue>
58 </hudson.model.StringParameterDefinition>
59 <hudson.model.StringParameterDefinition>
60 <name>GERRIT_REFSPEC</name>
61 <description>Parameter to identify a refspec when pulling from Gerrit.
63 Note that Gerrit will override this parameter automatically if a
64 job is triggered by Gerrit.
66 <defaultValue>refs/heads/master</defaultValue>
67 </hudson.model.StringParameterDefinition>
68 <hudson.model.StringParameterDefinition>
69 <name>LFTOOLS_VERSION</name>
70 <description>Version of lftools to install. Can be a specific version like
71 '0.6.0' or a PEP-440 definition.
72 https://www.python.org/dev/peps/pep-0440/
73 For example '<1.0.0' or '>=1.0.0,<2.0.0'.
75 <defaultValue><1.0.0</defaultValue>
76 </hudson.model.StringParameterDefinition>
77 <hudson.model.StringParameterDefinition>
79 <description>Maven selector to be used by shell scripts</description>
80 <defaultValue>/w/tools/hudson.tasks.Maven_MavenInstallation/mvn33</defaultValue>
81 </hudson.model.StringParameterDefinition>
82 <hudson.model.StringParameterDefinition>
83 <name>MAVEN_OPTS</name>
84 <description>Maven Java opts. Example: -Xmx1024m -XX:MaxPermSize=256m
87 </hudson.model.StringParameterDefinition>
88 <hudson.model.StringParameterDefinition>
89 <name>MAVEN_PARAMS</name>
90 <description>Maven parameters to pass to the mvn command.
93 </hudson.model.StringParameterDefinition>
94 <hudson.model.StringParameterDefinition>
96 <description>Maven selector to be used by shell scripts</description>
97 <defaultValue>/w/tools/hudson.tasks.Maven_MavenInstallation/mvn33/bin/mvn</defaultValue>
98 </hudson.model.StringParameterDefinition>
99 <hudson.model.StringParameterDefinition>
100 <name>STAGING_PROFILE_ID</name>
101 <description>Nexus staging profile ID.
103 <defaultValue>uuddlrlrba</defaultValue>
104 </hudson.model.StringParameterDefinition>
105 <hudson.model.StringParameterDefinition>
106 <name>ARCHIVE_ARTIFACTS</name>
107 <description>Artifacts to archive to the logs server.</description>
109 </hudson.model.StringParameterDefinition>
110 </parameterDefinitions>
111 </hudson.model.ParametersDefinitionProperty>
113 <scm class="hudson.plugins.git.GitSCM">
114 <configVersion>2</configVersion>
116 <hudson.plugins.git.UserRemoteConfig>
118 <refspec>$GERRIT_REFSPEC</refspec>
119 <url>$GIT_URL/$PROJECT</url>
120 <credentialsId>test-credential</credentialsId>
121 </hudson.plugins.git.UserRemoteConfig>
124 <hudson.plugins.git.BranchSpec>
125 <name>refs/heads/$GERRIT_BRANCH</name>
126 </hudson.plugins.git.BranchSpec>
129 <buildChooser class="hudson.plugins.git.util.DefaultBuildChooser"/>
130 <doGenerateSubmoduleConfigurations>false</doGenerateSubmoduleConfigurations>
131 <authorOrCommitter>false</authorOrCommitter>
132 <wipeOutWorkspace>true</wipeOutWorkspace>
133 <pruneBranches>false</pruneBranches>
134 <remotePoll>false</remotePoll>
135 <gitTool>Default</gitTool>
136 <submoduleCfg class="list"/>
141 <skipTag>true</skipTag>
143 <useShallowClone>false</useShallowClone>
144 <ignoreNotifyCommit>false</ignoreNotifyCommit>
146 <hudson.plugins.git.extensions.impl.SubmoduleOption>
147 <disableSubmodules>false</disableSubmodules>
148 <recursiveSubmodules>true</recursiveSubmodules>
149 <trackingSubmodules>false</trackingSubmodules>
151 <timeout>10</timeout>
152 </hudson.plugins.git.extensions.impl.SubmoduleOption>
153 <hudson.plugins.git.extensions.impl.WipeWorkspace/>
156 <triggers class="vector">
157 <hudson.triggers.TimerTrigger>
158 <spec>H H * * 6</spec>
159 </hudson.triggers.TimerTrigger>
163 <command>echo "quiet=on" > "$HOME/.wgetrc"</command>
164 </hudson.tasks.Shell>
166 <targets>--version</targets>
168 <mavenName>mvn33</mavenName>
169 <usePrivateRepository>false</usePrivateRepository>
170 <settings class="jenkins.mvn.DefaultSettingsProvider"/>
171 <globalSettings class="jenkins.mvn.DefaultGlobalSettingsProvider"/>
172 </hudson.tasks.Maven>
174 <command>rm "$HOME/.wgetrc"</command>
175 </hudson.tasks.Shell>
176 <org.jenkinsci.plugins.configfiles.builder.ConfigFileBuildStep plugin="config-file-provider">
178 <org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
179 <fileId>global-settings</fileId>
181 <variable>GLOBAL_SETTINGS_FILE</variable>
182 </org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
183 <org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
184 <fileId>gerrit-maven-project-settings</fileId>
186 <variable>SETTINGS_FILE</variable>
187 </org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
189 </org.jenkinsci.plugins.configfiles.builder.ConfigFileBuildStep>
192 # SPDX-License-Identifier: EPL-1.0
193 ##############################################################################
194 # Copyright (c) 2017 The Linux Foundation and others.
196 # All rights reserved. This program and the accompanying materials
197 # are made available under the terms of the Eclipse Public License v1.0
198 # which accompanies this distribution, and is available at
199 # http://www.eclipse.org/legal/epl-v10.html
200 ##############################################################################
202 # This file contains a list of variables that are generally useful in many
203 # scripts. It is meant to be sourced in other scripts so that the variables can
206 MAVEN_OPTIONS="$(echo --show-version \
209 -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn \
210 -Dmaven.repo.local=/tmp/r \
211 -Dorg.ops4j.pax.url.mvn.localRepository=/tmp/r)"
212 echo "$MAVEN_OPTIONS"
215 # SPDX-License-Identifier: EPL-1.0
216 ##############################################################################
217 # Copyright (c) 2017 The Linux Foundation and others.
219 # All rights reserved. This program and the accompanying materials
220 # are made available under the terms of the Eclipse Public License v1.0
221 # which accompanies this distribution, and is available at
222 # http://www.eclipse.org/legal/epl-v10.html
223 ##############################################################################
225 # This script builds a Maven project and deploys it into a staging repo which
226 # can be used to deploy elsewhere later eg. Nexus staging / snapshot repos.
228 # DO NOT enable -u because $MAVEN_PARAMS and $MAVEN_OPTIONS could be unbound.
229 # Ensure we fail the job if any steps fail.
235 # Disable SC2086 because we want to allow word splitting for $MAVEN_* parameters.
236 # shellcheck disable=SC2086
237 $MVN clean install dependency:tree com.sonatype.clm:clm-maven-plugin:index \
238 --global-settings "$GLOBAL_SETTINGS_FILE" \
239 --settings "$SETTINGS_FILE" \
240 -DaltDeploymentRepository=staging::default::file:"$WORKSPACE"/m2repo \
241 $MAVEN_PARAMS $MAVEN_OPTIONS
243 </hudson.tasks.Shell>
246 set +e # DO NOT cause build failure if any of the rm calls fail.
248 rm "$GLOBAL_SETTINGS_FILE" "$SETTINGS_FILE"
250 # In some cases we use the lf-provide-maven-settings macro to produce
251 # a "$HOME/.netrc" file containing credentials. Remove that file here
253 rm "$HOME/.netrc"
255 # DO NOT fail build if any of the above lines fail.
258 </hudson.tasks.Shell>
260 <command>find . -regex ".*karaf/target" | xargs rm -rf</command>
261 </hudson.tasks.Shell>
262 <com.sonatype.insight.ci.hudson.PreBuildScan plugin="sonatype-clm-ci">
263 <applicationSelectType>
265 <applicationId>gerrit-maven</applicationId>
266 </applicationSelectType>
272 <failOnClmServerFailures>false</failOnClmServerFailures>
273 <stageId>build</stageId>
276 </com.sonatype.insight.ci.hudson.PreBuildScan>
279 <org.jenkinsci.plugins.postbuildscript.PostBuildScript>
283 # SPDX-License-Identifier: EPL-1.0
284 ##############################################################################
285 # Copyright (c) 2017 The Linux Foundation and others.
287 # All rights reserved. This program and the accompanying materials
288 # are made available under the terms of the Eclipse Public License v1.0
289 # which accompanies this distribution, and is available at
290 # http://www.eclipse.org/legal/epl-v10.html
291 ##############################################################################
292 echo "---> sysstat.sh"
293 set +e # DON'T fail build if script fails.
295 OS=$(facter operatingsystem)
296 case "$OS" in
298 SYSSTAT_PATH="/var/log/sysstat"
300 # Dont run the script when systat is not enabled by default
301 if ! grep --quiet 'ENABLED="true"' "/etc/default/sysstat"; then
306 SYSSTAT_PATH="/var/log/sa"
314 SAR_DIR="$WORKSPACE/archives/sar-reports"
315 mkdir -p "$SAR_DIR"
316 cp "$SYSSTAT_PATH/"* "$_"
317 # convert sar data to ascii format
318 while IFS="" read -r sarfilenum
320 [ -f "$sarfilenum" ] && LC_TIME=POSIX sar -A -f "$sarfilenum" > "$SAR_DIR/sar${sarfilenum//[!0-9]/}"
321 done < <(find "$SYSSTAT_PATH" -name "sa[0-9]*" || true)
323 # DON'T fail build if script fails.
326 </hudson.tasks.Shell>
327 <org.jenkinsci.plugins.configfiles.builder.ConfigFileBuildStep plugin="config-file-provider">
329 <org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
330 <fileId>jenkins-log-archives-settings</fileId>
332 <variable>SETTINGS_FILE</variable>
333 </org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
335 </org.jenkinsci.plugins.configfiles.builder.ConfigFileBuildStep>
338 <propertiesContent>SERVER_ID=logs</propertiesContent>
343 # SPDX-License-Identifier: EPL-1.0
344 ##############################################################################
345 # Copyright (c) 2017 The Linux Foundation and others.
347 # All rights reserved. This program and the accompanying materials
348 # are made available under the terms of the Eclipse Public License v1.0
349 # which accompanies this distribution, and is available at
350 # http://www.eclipse.org/legal/epl-v10.html
351 ##############################################################################
352 echo "---> create-netrc.sh"
354 # Ensure we fail the job if any steps fail.
357 NEXUS_URL="${NEXUSPROXY:-$NEXUS_URL}"
358 CREDENTIAL=$(xmlstarlet sel -N "x=http://maven.apache.org/SETTINGS/1.0.0" \
359 -t -m "/x:settings/x:servers/x:server[x:id='${SERVER_ID}']" \
360 -v x:username -o ":" -v x:password \
361 "$SETTINGS_FILE")
363 machine=$(echo "$NEXUS_URL" | awk -F/ '{print $3}')
364 user=$(echo "$CREDENTIAL" | cut -f1 -d:)
365 pass=$(echo "$CREDENTIAL" | cut -f2 -d:)
367 echo "machine ${machine%:*} login $user password $pass" > ~/.netrc
369 </hudson.tasks.Shell>
372 # SPDX-License-Identifier: EPL-1.0
373 ##############################################################################
374 # Copyright (c) 2017 The Linux Foundation and others.
376 # All rights reserved. This program and the accompanying materials
377 # are made available under the terms of the Eclipse Public License v1.0
378 # which accompanies this distribution, and is available at
379 # http://www.eclipse.org/legal/epl-v10.html
380 ##############################################################################
381 echo "---> lftools-install.sh"
383 # Script to install lftools via a version passed in via lf-infra-parameters
385 # Required parameters:
387 # LFTOOLS_VERSION: Passed in via lf-infra-parameters configuration. Can be
388 # set to a strict version number like '1.2.3' or using
389 # PEP-440 definitions.
393 # >=1.0.0,<2.0.0
395 # By default a released version of lftools should always be used.
396 # The purpose of the 2 variables below is so that lftools devs can test
397 # unreleased versions of lftools. There are 2 methods to install a dev version
400 # 1) gerrit patch: Used to test a patch that has not yet been merged.
401 # To do this set something like this:
402 # LFTOOLS_MODE=gerrit
403 # LFTOOLS_REFSPEC=refs/changes/96/5296/7
405 # 2) git branch: Used to install an lftools version from a specific branch.
406 # To use this set the variables as follows:
408 # LFTOOLS_REFSPEC=master
410 # 3) release : The intended use case and default setting.
411 # Set LFTOOLS_MODE=release, in this case LFTOOLS_REFSPEC is unused.
413 LFTOOLS_MODE=release # release | git | gerrit
414 LFTOOLS_REFSPEC=master
416 # Ensure we fail the job if any steps fail.
417 # DO NOT set -u as virtualenv's activate script has unbound variables
420 virtualenv --quiet "/tmp/v/lftools"
421 # shellcheck source=/tmp/v/lftools/bin/activate disable=SC1091
422 source "/tmp/v/lftools/bin/activate"
423 pip install --quiet --upgrade pip
425 case $LFTOOLS_MODE in
427 git clone https://gerrit.linuxfoundation.org/infra/releng/lftools.git /tmp/lftools
429 git fetch origin "$LFTOOLS_REFSPEC"
430 git checkout FETCH_HEAD
431 pip install --quiet --upgrade -r requirements.txt
432 pip install --quiet --upgrade -e .
437 pip install --quiet --upgrade git+https://gerrit.linuxfoundation.org/infra/releng/lftools.git@"$BRANCH"
441 if [[ $LFTOOLS_VERSION =~ ^[0-9] ]]; then
442 LFTOOLS_VERSION="==$LFTOOLS_VERSION"
445 pip install --quiet --upgrade "lftools${LFTOOLS_VERSION}"
451 # pipdeptree prints out a lot of information because lftools pulls in many
452 # dependencies. Let's only print it if we want to debug.
453 # echo "----> Pip Dependency Tree"
454 # pip install --quiet --upgrade pipdeptree
458 # SPDX-License-Identifier: EPL-1.0
459 ##############################################################################
460 # Copyright (c) 2017 The Linux Foundation and others.
462 # All rights reserved. This program and the accompanying materials
463 # are made available under the terms of the Eclipse Public License v1.0
464 # which accompanies this distribution, and is available at
465 # http://www.eclipse.org/legal/epl-v10.html
466 ##############################################################################
467 echo "---> logs-deploy.sh"
469 # Ensure we fail the job if any steps fail.
472 set -x # Trace commands for this script to make debugging easier.
474 ARCHIVE_ARTIFACTS="${ARCHIVE_ARTIFACTS:-}"
475 LOGS_SERVER="${LOGS_SERVER:-None}"
477 if [ "${LOGS_SERVER}" == 'None' ]
479 set +x # Disable trace since we no longer need it
481 echo "WARNING: Logging server not set"
483 NEXUS_URL="${NEXUSPROXY:-$NEXUS_URL}"
484 NEXUS_PATH="${SILO}/${JENKINS_HOSTNAME}/${JOB_NAME}/${BUILD_NUMBER}"
485 BUILD_URL="${BUILD_URL}"
487 lftools deploy archives -p "$ARCHIVE_ARTIFACTS" "$NEXUS_URL" "$NEXUS_PATH" "$WORKSPACE"
488 lftools deploy logs "$NEXUS_URL" "$NEXUS_PATH" "$BUILD_URL"
490 set +x # Disable trace since we no longer need it.
492 echo "Build logs: <a href=\"$LOGS_SERVER/$NEXUS_PATH\">$LOGS_SERVER/$NEXUS_PATH</a>"
495 </hudson.tasks.Shell>
498 # SPDX-License-Identifier: EPL-1.0
499 ##############################################################################
500 # Copyright (c) 2017 The Linux Foundation and others.
502 # All rights reserved. This program and the accompanying materials
503 # are made available under the terms of the Eclipse Public License v1.0
504 # which accompanies this distribution, and is available at
505 # http://www.eclipse.org/legal/epl-v10.html
506 ##############################################################################
508 # Clear log credential files
509 rm "$SETTINGS_FILE"
512 </hudson.tasks.Shell>
513 <hudson.plugins.descriptionsetter.DescriptionSetterBuilder>
514 <regexp>^Build logs: .*</regexp>
515 </hudson.plugins.descriptionsetter.DescriptionSetterBuilder>
517 <scriptOnlyIfSuccess>false</scriptOnlyIfSuccess>
518 <scriptOnlyIfFailure>false</scriptOnlyIfFailure>
519 <markBuildUnstable>false</markBuildUnstable>
520 </org.jenkinsci.plugins.postbuildscript.PostBuildScript>
521 <hudson.plugins.ws__cleanup.WsCleanup plugin="ws-cleanup">
523 <hudson.plugins.ws__cleanup.Pattern>
524 <pattern>**/*.jenkins-trigger</pattern>
526 </hudson.plugins.ws__cleanup.Pattern>
528 <deleteDirs>false</deleteDirs>
529 <cleanupMatrixParent>false</cleanupMatrixParent>
531 <cleanWhenSuccess>true</cleanWhenSuccess>
532 <cleanWhenUnstable>true</cleanWhenUnstable>
533 <cleanWhenFailure>true</cleanWhenFailure>
534 <cleanWhenNotBuilt>true</cleanWhenNotBuilt>
535 <cleanWhenAborted>true</cleanWhenAborted>
536 <notFailBuild>true</notFailBuild>
537 </hudson.plugins.ws__cleanup.WsCleanup>
540 <com.michelin.cio.hudson.plugins.maskpasswords.MaskPasswordsBuildWrapper/>
541 <hudson.plugins.build__timeout.BuildTimeoutWrapper>
542 <timeoutMinutes>30</timeoutMinutes>
543 <timeoutEnvVar>BUILD_TIMEOUT</timeoutEnvVar>
544 <failBuild>true</failBuild>
545 <writingDescription>false</writingDescription>
546 <timeoutPercentage>0</timeoutPercentage>
547 <timeoutMinutesElasticDefault>3</timeoutMinutesElasticDefault>
548 <timeoutType>absolute</timeoutType>
549 </hudson.plugins.build__timeout.BuildTimeoutWrapper>
550 <hudson.plugins.timestamper.TimestamperBuildWrapper/>
551 <com.cloudbees.jenkins.plugins.sshagent.SSHAgentBuildWrapper>
552 <user>test-credential</user>
553 </com.cloudbees.jenkins.plugins.sshagent.SSHAgentBuildWrapper>
554 <jenkins.plugins.openstack.compute.JCloudsOneOffSlave/>
555 <org.jenkinsci.plugins.configfiles.buildwrapper.ConfigFileBuildWrapper plugin="config-file-provider">
557 <org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
558 <fileId>npmrc</fileId>
559 <targetLocation>$HOME/.npmrc</targetLocation>
561 </org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
563 </org.jenkinsci.plugins.configfiles.buildwrapper.ConfigFileBuildWrapper>