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>
74 <description>Maven selector to be used by shell scripts</description>
75 <defaultValue>/w/tools/hudson.tasks.Maven_MavenInstallation/mvn33</defaultValue>
76 </hudson.model.StringParameterDefinition>
77 <hudson.model.StringParameterDefinition>
78 <name>MAVEN_OPTS</name>
79 <description>Maven Java opts. Example: -Xmx1024m -XX:MaxPermSize=256m
82 </hudson.model.StringParameterDefinition>
83 <hudson.model.StringParameterDefinition>
84 <name>MAVEN_PARAMS</name>
85 <description>Maven parameters to pass to the mvn command.
88 </hudson.model.StringParameterDefinition>
89 <hudson.model.StringParameterDefinition>
91 <description>Maven selector to be used by shell scripts</description>
92 <defaultValue>/w/tools/hudson.tasks.Maven_MavenInstallation/mvn33/bin/mvn</defaultValue>
93 </hudson.model.StringParameterDefinition>
94 <hudson.model.StringParameterDefinition>
95 <name>STAGING_PROFILE_ID</name>
96 <description>Nexus staging profile ID.
98 <defaultValue>uuddlrlrba</defaultValue>
99 </hudson.model.StringParameterDefinition>
100 <hudson.model.StringParameterDefinition>
101 <name>ARCHIVE_ARTIFACTS</name>
102 <description>Artifacts to archive to the logs server.</description>
104 </hudson.model.StringParameterDefinition>
105 </parameterDefinitions>
106 </hudson.model.ParametersDefinitionProperty>
108 <scm class="hudson.plugins.git.GitSCM">
109 <configVersion>2</configVersion>
111 <hudson.plugins.git.UserRemoteConfig>
114 <url>git@github.com:example-org/releng/ciman</url>
115 <credentialsId>test-credential</credentialsId>
116 </hudson.plugins.git.UserRemoteConfig>
119 <hudson.plugins.git.BranchSpec>
120 <name>refs/heads/master</name>
121 </hudson.plugins.git.BranchSpec>
124 <buildChooser class="hudson.plugins.git.util.DefaultBuildChooser"/>
125 <doGenerateSubmoduleConfigurations>false</doGenerateSubmoduleConfigurations>
126 <authorOrCommitter>false</authorOrCommitter>
127 <wipeOutWorkspace>true</wipeOutWorkspace>
128 <pruneBranches>false</pruneBranches>
129 <remotePoll>false</remotePoll>
130 <gitTool>Default</gitTool>
131 <submoduleCfg class="list"/>
136 <skipTag>true</skipTag>
138 <useShallowClone>false</useShallowClone>
139 <ignoreNotifyCommit>false</ignoreNotifyCommit>
141 <hudson.plugins.git.extensions.impl.SubmoduleOption>
142 <disableSubmodules>false</disableSubmodules>
143 <recursiveSubmodules>true</recursiveSubmodules>
144 <trackingSubmodules>false</trackingSubmodules>
146 <timeout>10</timeout>
147 </hudson.plugins.git.extensions.impl.SubmoduleOption>
148 <hudson.plugins.git.extensions.impl.WipeWorkspace/>
151 <triggers class="vector">
152 <hudson.triggers.TimerTrigger>
153 <spec>H H * * 6</spec>
154 </hudson.triggers.TimerTrigger>
158 <command>echo "quiet=on" > "$HOME/.wgetrc"</command>
159 </hudson.tasks.Shell>
161 <targets>--version</targets>
163 <mavenName>mvn33</mavenName>
164 <usePrivateRepository>false</usePrivateRepository>
165 <settings class="jenkins.mvn.DefaultSettingsProvider"/>
166 <globalSettings class="jenkins.mvn.DefaultGlobalSettingsProvider"/>
167 </hudson.tasks.Maven>
169 <command>rm "$HOME/.wgetrc"</command>
170 </hudson.tasks.Shell>
171 <org.jenkinsci.plugins.configfiles.builder.ConfigFileBuildStep plugin="config-file-provider">
173 <org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
174 <fileId>global-settings</fileId>
176 <variable>GLOBAL_SETTINGS_FILE</variable>
177 </org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
178 <org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
179 <fileId>aproject-settings</fileId>
181 <variable>SETTINGS_FILE</variable>
182 </org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
184 </org.jenkinsci.plugins.configfiles.builder.ConfigFileBuildStep>
187 # SPDX-License-Identifier: EPL-1.0
188 ##############################################################################
189 # Copyright (c) 2017 The Linux Foundation and others.
191 # All rights reserved. This program and the accompanying materials
192 # are made available under the terms of the Eclipse Public License v1.0
193 # which accompanies this distribution, and is available at
194 # http://www.eclipse.org/legal/epl-v10.html
195 ##############################################################################
197 # This file contains a list of variables that are generally useful in many
198 # scripts. It is meant to be sourced in other scripts so that the variables can
201 MAVEN_OPTIONS="$(echo --show-version \
204 -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn \
205 -Dmaven.repo.local=/tmp/r \
206 -Dorg.ops4j.pax.url.mvn.localRepository=/tmp/r)"
207 echo "$MAVEN_OPTIONS"
210 # SPDX-License-Identifier: EPL-1.0
211 ##############################################################################
212 # Copyright (c) 2017 The Linux Foundation and others.
214 # All rights reserved. This program and the accompanying materials
215 # are made available under the terms of the Eclipse Public License v1.0
216 # which accompanies this distribution, and is available at
217 # http://www.eclipse.org/legal/epl-v10.html
218 ##############################################################################
220 # This script builds a Maven project and deploys it into a staging repo which
221 # can be used to deploy elsewhere later eg. Nexus staging / snapshot repos.
223 # DO NOT enable -u because $MAVEN_PARAMS and $MAVEN_OPTIONS could be unbound.
224 # Ensure we fail the job if any steps fail.
230 # Disable SC2086 because we want to allow word splitting for $MAVEN_* parameters.
231 # shellcheck disable=SC2086
232 $MVN clean install dependency:tree com.sonatype.clm:clm-maven-plugin:index \
233 --global-settings "$GLOBAL_SETTINGS_FILE" \
234 --settings "$SETTINGS_FILE" \
235 -DaltDeploymentRepository=staging::default::file:"$WORKSPACE"/m2repo \
236 $MAVEN_PARAMS $MAVEN_OPTIONS
238 </hudson.tasks.Shell>
241 set +e # DO NOT cause build failure if any of the rm calls fail.
243 rm "$GLOBAL_SETTINGS_FILE" "$SETTINGS_FILE"
245 # In some cases we use the lf-provide-maven-settings macro to produce
246 # a "$HOME/.netrc" file containing credentials. Remove that file here
248 rm "$HOME/.netrc"
250 # DO NOT fail build if any of the above lines fail.
253 </hudson.tasks.Shell>
255 <command>find . -regex ".*karaf/target" | xargs rm -rf</command>
256 </hudson.tasks.Shell>
257 <com.sonatype.insight.ci.hudson.PreBuildScan plugin="sonatype-clm-ci">
258 <applicationSelectType>
260 <applicationId>github-maven</applicationId>
261 </applicationSelectType>
267 <failOnClmServerFailures>false</failOnClmServerFailures>
268 <stageId>build</stageId>
271 </com.sonatype.insight.ci.hudson.PreBuildScan>
274 <org.jenkinsci.plugins.postbuildscript.PostBuildScript>
278 # SPDX-License-Identifier: EPL-1.0
279 ##############################################################################
280 # Copyright (c) 2017 The Linux Foundation and others.
282 # All rights reserved. This program and the accompanying materials
283 # are made available under the terms of the Eclipse Public License v1.0
284 # which accompanies this distribution, and is available at
285 # http://www.eclipse.org/legal/epl-v10.html
286 ##############################################################################
287 echo "---> sysstat.sh"
288 set +e # DON'T fail build if script fails.
290 OS=$(facter operatingsystem)
291 case "$OS" in
293 SYSSTAT_PATH="/var/log/sysstat"
295 # Dont run the script when systat is not enabled by default
296 if ! grep --quiet 'ENABLED="true"' "/etc/default/sysstat"; then
301 SYSSTAT_PATH="/var/log/sa"
309 SAR_DIR="$WORKSPACE/archives/sar-reports"
310 mkdir -p "$SAR_DIR"
311 cp "$SYSSTAT_PATH/"* "$_"
312 # convert sar data to ascii format
313 while IFS="" read -r s
315 [ -f "$s" ] && LC_TIME=POSIX sar -A -f "$s" > "$SAR_DIR/sar${s//[!0-9]/}"
316 done < <(find "$SYSSTAT_PATH" -name "sa[0-9]*" || true)
318 # DON'T fail build if script fails.
321 </hudson.tasks.Shell>
322 <org.jenkinsci.plugins.configfiles.builder.ConfigFileBuildStep plugin="config-file-provider">
324 <org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
325 <fileId>jenkins-log-archives-settings</fileId>
327 <variable>SETTINGS_FILE</variable>
328 </org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
330 </org.jenkinsci.plugins.configfiles.builder.ConfigFileBuildStep>
333 <propertiesContent>SERVER_ID=logs</propertiesContent>
338 # SPDX-License-Identifier: EPL-1.0
339 ##############################################################################
340 # Copyright (c) 2017 The Linux Foundation and others.
342 # All rights reserved. This program and the accompanying materials
343 # are made available under the terms of the Eclipse Public License v1.0
344 # which accompanies this distribution, and is available at
345 # http://www.eclipse.org/legal/epl-v10.html
346 ##############################################################################
347 echo "---> create-netrc.sh"
349 # Ensure we fail the job if any steps fail.
352 NEXUS_URL="${NEXUSPROXY:-$NEXUS_URL}"
353 CREDENTIAL=$(xmlstarlet sel -N "x=http://maven.apache.org/SETTINGS/1.0.0" \
354 -t -m "/x:settings/x:servers/x:server[x:id='${SERVER_ID}']" \
355 -v x:username -o ":" -v x:password \
356 "$SETTINGS_FILE")
358 machine=$(echo "$NEXUS_URL" | awk -F/ '{print $3}')
359 user=$(echo "$CREDENTIAL" | cut -f1 -d:)
360 pass=$(echo "$CREDENTIAL" | cut -f2 -d:)
362 echo "machine ${machine%:*} login $user password $pass" > ~/.netrc
364 </hudson.tasks.Shell>
367 # SPDX-License-Identifier: EPL-1.0
368 ##############################################################################
369 # Copyright (c) 2017 The Linux Foundation and others.
371 # All rights reserved. This program and the accompanying materials
372 # are made available under the terms of the Eclipse Public License v1.0
373 # which accompanies this distribution, and is available at
374 # http://www.eclipse.org/legal/epl-v10.html
375 ##############################################################################
376 echo "---> lftools-install.sh"
378 # Script to install lftools via a version passed in via lf-infra-parameters
380 # Required parameters:
382 # LFTOOLS_VERSION: Passed in via lf-infra-parameters configuration. Can be
383 # set to a strict version number like '1.2.3' or using
384 # PEP-440 definitions.
388 # >=1.0.0,<2.0.0
390 # By default a released version of lftools should always be used.
391 # The purpose of the 2 variables below is so that lftools devs can test
392 # unreleased versions of lftools. There are 2 methods to install a dev version
395 # 1) gerrit patch: Used to test a patch that has not yet been merged.
396 # To do this set something like this:
397 # LFTOOLS_MODE=gerrit
398 # LFTOOLS_REFSPEC=refs/changes/96/5296/7
400 # 2) git branch: Used to install an lftools version from a specific branch.
401 # To use this set the variables as follows:
403 # LFTOOLS_REFSPEC=master
405 # 3) release : The intended use case and default setting.
406 # Set LFTOOLS_MODE=release, in this case LFTOOLS_REFSPEC is unused.
408 LFTOOLS_MODE=release # release | git | gerrit
409 LFTOOLS_REFSPEC=master
411 # Ensure we fail the job if any steps fail.
412 # DO NOT set -u as virtualenv's activate script has unbound variables
415 virtualenv --quiet "/tmp/v/lftools"
416 # shellcheck source=/tmp/v/lftools/bin/activate disable=SC1091
417 source "/tmp/v/lftools/bin/activate"
418 pip install --quiet --upgrade pip
420 case $LFTOOLS_MODE in
422 git clone https://gerrit.linuxfoundation.org/infra/releng/lftools.git /tmp/lftools
424 git fetch origin "$LFTOOLS_REFSPEC"
425 git checkout FETCH_HEAD
426 pip install --quiet --upgrade -r requirements.txt
427 pip install --quiet --upgrade -e .
432 pip install --quiet --upgrade git+https://gerrit.linuxfoundation.org/infra/releng/lftools.git@"$BRANCH"
436 if [[ $LFTOOLS_VERSION =~ ^[0-9] ]]; then
437 LFTOOLS_VERSION="==$LFTOOLS_VERSION"
440 pip install --quiet --upgrade "lftools${LFTOOLS_VERSION}"
446 # pipdeptree prints out a lot of information because lftools pulls in many
447 # dependencies. Let's only print it if we want to debug.
448 # echo "----> Pip Dependency Tree"
449 # pip install --quiet --upgrade pipdeptree
453 # SPDX-License-Identifier: EPL-1.0
454 ##############################################################################
455 # Copyright (c) 2017 The Linux Foundation and others.
457 # All rights reserved. This program and the accompanying materials
458 # are made available under the terms of the Eclipse Public License v1.0
459 # which accompanies this distribution, and is available at
460 # http://www.eclipse.org/legal/epl-v10.html
461 ##############################################################################
462 echo "---> logs-deploy.sh"
464 # Ensure we fail the job if any steps fail.
467 set -x # Trace commands for this script to make debugging easier.
469 ARCHIVE_ARTIFACTS="${ARCHIVE_ARTIFACTS:-}"
470 LOGS_SERVER="${LOGS_SERVER:-None}"
472 if [ "${LOGS_SERVER}" == 'None' ]
474 set +x # Disable trace since we no longer need it
476 echo "WARNING: Logging server not set"
478 NEXUS_URL="${NEXUSPROXY:-$NEXUS_URL}"
479 NEXUS_PATH="${SILO}/${JENKINS_HOSTNAME}/${JOB_NAME}/${BUILD_NUMBER}"
480 BUILD_URL="${BUILD_URL}"
482 lftools deploy archives -p "$ARCHIVE_ARTIFACTS" "$NEXUS_URL" "$NEXUS_PATH" "$WORKSPACE"
483 lftools deploy logs "$NEXUS_URL" "$NEXUS_PATH" "$BUILD_URL"
485 set +x # Disable trace since we no longer need it.
487 echo "Build logs: <a href=\"$LOGS_SERVER/$NEXUS_PATH\">$LOGS_SERVER/$NEXUS_PATH</a>"
490 </hudson.tasks.Shell>
493 # SPDX-License-Identifier: EPL-1.0
494 ##############################################################################
495 # Copyright (c) 2017 The Linux Foundation and others.
497 # All rights reserved. This program and the accompanying materials
498 # are made available under the terms of the Eclipse Public License v1.0
499 # which accompanies this distribution, and is available at
500 # http://www.eclipse.org/legal/epl-v10.html
501 ##############################################################################
503 # Clear log credential files
504 rm "$SETTINGS_FILE"
507 </hudson.tasks.Shell>
508 <hudson.plugins.descriptionsetter.DescriptionSetterBuilder>
509 <regexp>^Build logs: .*</regexp>
510 </hudson.plugins.descriptionsetter.DescriptionSetterBuilder>
512 <scriptOnlyIfSuccess>false</scriptOnlyIfSuccess>
513 <scriptOnlyIfFailure>false</scriptOnlyIfFailure>
514 <markBuildUnstable>false</markBuildUnstable>
515 </org.jenkinsci.plugins.postbuildscript.PostBuildScript>
516 <hudson.plugins.ws__cleanup.WsCleanup plugin="ws-cleanup">
518 <hudson.plugins.ws__cleanup.Pattern>
519 <pattern>**/*.jenkins-trigger</pattern>
521 </hudson.plugins.ws__cleanup.Pattern>
523 <deleteDirs>false</deleteDirs>
524 <cleanupMatrixParent>false</cleanupMatrixParent>
526 <cleanWhenSuccess>true</cleanWhenSuccess>
527 <cleanWhenUnstable>true</cleanWhenUnstable>
528 <cleanWhenFailure>true</cleanWhenFailure>
529 <cleanWhenNotBuilt>true</cleanWhenNotBuilt>
530 <cleanWhenAborted>true</cleanWhenAborted>
531 <notFailBuild>true</notFailBuild>
532 </hudson.plugins.ws__cleanup.WsCleanup>
535 <com.michelin.cio.hudson.plugins.maskpasswords.MaskPasswordsBuildWrapper/>
536 <hudson.plugins.build__timeout.BuildTimeoutWrapper>
537 <timeoutMinutes>15</timeoutMinutes>
538 <timeoutEnvVar>BUILD_TIMEOUT</timeoutEnvVar>
539 <failBuild>true</failBuild>
540 <writingDescription>false</writingDescription>
541 <timeoutPercentage>0</timeoutPercentage>
542 <timeoutMinutesElasticDefault>3</timeoutMinutesElasticDefault>
543 <timeoutType>absolute</timeoutType>
544 </hudson.plugins.build__timeout.BuildTimeoutWrapper>
545 <hudson.plugins.timestamper.TimestamperBuildWrapper/>
546 <com.cloudbees.jenkins.plugins.sshagent.SSHAgentBuildWrapper>
547 <user>test-credential</user>
548 </com.cloudbees.jenkins.plugins.sshagent.SSHAgentBuildWrapper>
549 <jenkins.plugins.openstack.compute.JCloudsOneOffSlave/>
550 <org.jenkinsci.plugins.configfiles.buildwrapper.ConfigFileBuildWrapper plugin="config-file-provider">
552 <org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
553 <fileId>npmrc</fileId>
554 <targetLocation>$HOME/.npmrc</targetLocation>
556 </org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
558 </org.jenkinsci.plugins.configfiles.buildwrapper.ConfigFileBuildWrapper>