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.
62 </hudson.model.StringParameterDefinition>
63 <hudson.model.StringParameterDefinition>
64 <name>MAVEN_OPTS</name>
65 <description>Maven Java opts. Example: -Xmx1024m -XX:MaxPermSize=256m
68 </hudson.model.StringParameterDefinition>
69 <hudson.model.StringParameterDefinition>
70 <name>MAVEN_PARAMS</name>
71 <description>Maven parameters to pass to the mvn command.
74 </hudson.model.StringParameterDefinition>
75 <hudson.model.StringParameterDefinition>
77 <description>Maven selector to be used by shell scripts</description>
78 <defaultValue>/w/tools/hudson.tasks.Maven_MavenInstallation/mvn33/bin/mvn</defaultValue>
79 </hudson.model.StringParameterDefinition>
80 <hudson.model.StringParameterDefinition>
81 <name>STAGING_PROFILE_ID</name>
82 <description>Nexus staging profile ID.
84 <defaultValue>uuddlrlrba</defaultValue>
85 </hudson.model.StringParameterDefinition>
86 </parameterDefinitions>
87 </hudson.model.ParametersDefinitionProperty>
89 <scm class="hudson.plugins.git.GitSCM">
90 <configVersion>2</configVersion>
92 <hudson.plugins.git.UserRemoteConfig>
94 <refspec>+refs/pull/*:refs/remotes/origin/pr/*</refspec>
95 <url>git@github.com:example-org/releng/ciman</url>
96 <credentialsId>test-credential</credentialsId>
97 </hudson.plugins.git.UserRemoteConfig>
100 <hudson.plugins.git.BranchSpec>
102 </hudson.plugins.git.BranchSpec>
105 <buildChooser class="hudson.plugins.git.util.DefaultBuildChooser"/>
106 <doGenerateSubmoduleConfigurations>false</doGenerateSubmoduleConfigurations>
107 <authorOrCommitter>false</authorOrCommitter>
108 <wipeOutWorkspace>true</wipeOutWorkspace>
109 <pruneBranches>false</pruneBranches>
110 <remotePoll>false</remotePoll>
111 <gitTool>Default</gitTool>
112 <submoduleCfg class="list"/>
117 <skipTag>true</skipTag>
119 <useShallowClone>false</useShallowClone>
120 <ignoreNotifyCommit>false</ignoreNotifyCommit>
122 <hudson.plugins.git.extensions.impl.SubmoduleOption>
123 <disableSubmodules>false</disableSubmodules>
124 <recursiveSubmodules>true</recursiveSubmodules>
125 <trackingSubmodules>false</trackingSubmodules>
127 <timeout>10</timeout>
128 </hudson.plugins.git.extensions.impl.SubmoduleOption>
129 <hudson.plugins.git.extensions.impl.WipeWorkspace/>
132 <triggers class="vector">
133 <hudson.triggers.TimerTrigger>
134 <spec>H H * * 6</spec>
135 </hudson.triggers.TimerTrigger>
139 <command>echo "quiet=on" > "$HOME/.wgetrc"</command>
140 </hudson.tasks.Shell>
142 <targets>--version</targets>
144 <mavenName>mvn33</mavenName>
145 <usePrivateRepository>false</usePrivateRepository>
146 <settings class="jenkins.mvn.DefaultSettingsProvider"/>
147 <globalSettings class="jenkins.mvn.DefaultGlobalSettingsProvider"/>
148 </hudson.tasks.Maven>
150 <command>rm "$HOME/.wgetrc"</command>
151 </hudson.tasks.Shell>
152 <org.jenkinsci.plugins.configfiles.builder.ConfigFileBuildStep plugin="config-file-provider">
154 <org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
155 <fileId>global-settings</fileId>
157 <variable>GLOBAL_SETTINGS_FILE</variable>
158 </org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
159 <org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
160 <fileId>aproject-settings</fileId>
162 <variable>SETTINGS_FILE</variable>
163 </org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
165 </org.jenkinsci.plugins.configfiles.builder.ConfigFileBuildStep>
168 # SPDX-License-Identifier: EPL-1.0
169 ##############################################################################
170 # Copyright (c) 2017 The Linux Foundation and others.
172 # All rights reserved. This program and the accompanying materials
173 # are made available under the terms of the Eclipse Public License v1.0
174 # which accompanies this distribution, and is available at
175 # http://www.eclipse.org/legal/epl-v10.html
176 ##############################################################################
178 # This file contains a list of variables that are generally useful in many
179 # scripts. It is meant to be sourced in other scripts so that the variables can
182 MAVEN_OPTIONS="$(echo --show-version \
185 -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn \
186 -Dmaven.repo.local=/tmp/r \
187 -Dorg.ops4j.pax.url.mvn.localRepository=/tmp/r)"
188 echo "$MAVEN_OPTIONS"
191 # SPDX-License-Identifier: EPL-1.0
192 ##############################################################################
193 # Copyright (c) 2017 The Linux Foundation and others.
195 # All rights reserved. This program and the accompanying materials
196 # are made available under the terms of the Eclipse Public License v1.0
197 # which accompanies this distribution, and is available at
198 # http://www.eclipse.org/legal/epl-v10.html
199 ##############################################################################
201 # This script builds a Maven project and deploys it into a staging repo which
202 # can be used to deploy elsewhere later eg. Nexus staging / snapshot repos.
204 # DO NOT enable -u because $MAVEN_PARAMS and $MAVEN_OPTIONS could be unbound.
205 # Ensure we fail the job if any steps fail.
211 # Disable SC2086 because we want to allow word splitting for $MAVEN_* parameters.
212 # shellcheck disable=SC2086
213 $MVN clean install dependency:tree com.sonatype.clm:clm-maven-plugin:index \
214 --global-settings "$GLOBAL_SETTINGS_FILE" \
215 --settings "$SETTINGS_FILE" \
216 -DaltDeploymentRepository=staging::default::file:"$WORKSPACE"/m2repo \
217 $MAVEN_PARAMS $MAVEN_OPTIONS
219 </hudson.tasks.Shell>
222 set +e # DO NOT cause build failure if any of the rm calls fail.
224 rm "$GLOBAL_SETTINGS_FILE" "$SETTINGS_FILE"
226 # In some cases we use the lf-provide-maven-settings macro to produce
227 # a "$HOME/.netrc" file containing credentials. Remove that file here
229 rm "$HOME/.netrc"
231 # DO NOT fail build if any of the above lines fail.
234 </hudson.tasks.Shell>
236 <command>find . -regex ".*karaf/target" | xargs rm -rf</command>
237 </hudson.tasks.Shell>
238 <com.sonatype.insight.ci.hudson.PreBuildScan plugin="sonatype-clm-ci">
239 <applicationSelectType>
241 <applicationId>github-maven</applicationId>
242 </applicationSelectType>
248 <failOnClmServerFailures>false</failOnClmServerFailures>
249 <stageId>build</stageId>
252 </com.sonatype.insight.ci.hudson.PreBuildScan>
255 <org.jenkinsci.plugins.postbuildscript.PostBuildScript>
259 # SPDX-License-Identifier: EPL-1.0
260 ##############################################################################
261 # Copyright (c) 2017 The Linux Foundation and others.
263 # All rights reserved. This program and the accompanying materials
264 # are made available under the terms of the Eclipse Public License v1.0
265 # which accompanies this distribution, and is available at
266 # http://www.eclipse.org/legal/epl-v10.html
267 ##############################################################################
268 echo "---> sysstat.sh"
269 set +e # DON'T fail build if script fails.
271 OS=$(facter operatingsystem)
272 case "$OS" in
274 SYSSTAT_PATH="/var/log/sysstat"
276 # Dont run the script when systat is not enabled by default
277 if ! grep --quiet 'ENABLED="true"' "/etc/default/sysstat"; then
282 SYSSTAT_PATH="/var/log/sa"
290 SAR_DIR="$WORKSPACE/archives/sar-reports"
291 mkdir -p "$SAR_DIR"
292 cp "$SYSSTAT_PATH/"* "$_"
293 # convert sar data to ascii format
294 while IFS="" read -r s
296 [ -f "$s" ] && LC_TIME=POSIX sar -A -f "$s" > "$SAR_DIR/sar${s//[!0-9]/}"
297 done < <(find "$SYSSTAT_PATH" -name "sa[0-9]*" || true)
299 # DON'T fail build if script fails.
302 </hudson.tasks.Shell>
303 <org.jenkinsci.plugins.configfiles.builder.ConfigFileBuildStep plugin="config-file-provider">
305 <org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
306 <fileId>jenkins-log-archives-settings</fileId>
308 <variable>SETTINGS_FILE</variable>
309 </org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
311 </org.jenkinsci.plugins.configfiles.builder.ConfigFileBuildStep>
314 <propertiesContent>SERVER_ID=logs</propertiesContent>
319 # SPDX-License-Identifier: EPL-1.0
320 ##############################################################################
321 # Copyright (c) 2017 The Linux Foundation and others.
323 # All rights reserved. This program and the accompanying materials
324 # are made available under the terms of the Eclipse Public License v1.0
325 # which accompanies this distribution, and is available at
326 # http://www.eclipse.org/legal/epl-v10.html
327 ##############################################################################
328 echo "---> create-netrc.sh"
330 # Ensure we fail the job if any steps fail.
333 NEXUS_URL="${NEXUS_URL:-$NEXUSPROXY}"
334 CREDENTIAL=$(xmlstarlet sel -N "x=http://maven.apache.org/SETTINGS/1.0.0" \
335 -t -m "/x:settings/x:servers/x:server[x:id='${SERVER_ID}']" \
336 -v x:username -o ":" -v x:password \
337 "$SETTINGS_FILE")
339 machine=$(echo "$NEXUS_URL" | awk -F/ '{print $3}')
340 user=$(echo "$CREDENTIAL" | cut -f1 -d:)
341 pass=$(echo "$CREDENTIAL" | cut -f2 -d:)
343 echo "machine $machine login $user password $pass" > ~/.netrc
345 </hudson.tasks.Shell>
348 # SPDX-License-Identifier: EPL-1.0
349 ##############################################################################
350 # Copyright (c) 2017 The Linux Foundation and others.
352 # All rights reserved. This program and the accompanying materials
353 # are made available under the terms of the Eclipse Public License v1.0
354 # which accompanies this distribution, and is available at
355 # http://www.eclipse.org/legal/epl-v10.html
356 ##############################################################################
357 echo "---> lftools-install.sh"
359 # Ensure we fail the job if any steps fail.
360 # DO NOT set -u as virtualenv's activate script has unbound variables
363 virtualenv --quiet "/tmp/v/lftools"
364 # shellcheck source=/tmp/v/lftools/bin/activate disable=SC1091
365 source "/tmp/v/lftools/bin/activate"
366 pip install --quiet --upgrade pip
367 pip install --quiet --upgrade "lftools<1.0.0"
369 # pipdeptree prints out a lot of information because lftools pulls in many
370 # dependencies. Let's only print it if we want to debug.
371 # echo "----> Pip Dependency Tree"
372 # pip install --quiet --upgrade pipdeptree
376 # SPDX-License-Identifier: EPL-1.0
377 ##############################################################################
378 # Copyright (c) 2017 The Linux Foundation and others.
380 # All rights reserved. This program and the accompanying materials
381 # are made available under the terms of the Eclipse Public License v1.0
382 # which accompanies this distribution, and is available at
383 # http://www.eclipse.org/legal/epl-v10.html
384 ##############################################################################
385 echo "---> logs-deploy.sh"
387 # Ensure we fail the job if any steps fail.
390 set -x # Trace commands for this script to make debugging easier.
392 ARCHIVE_ARTIFACTS="${ARCHIVE_ARTIFACTS:-}"
393 LOGS_SERVER="${LOGS_SERVER:-None}"
395 if [ "${LOGS_SERVER}" == 'None' ]
397 set +x # Disable trace since we no longer need it
399 echo "WARNING: Logging server not set"
401 NEXUS_URL="${NEXUS_URL:-$NEXUSPROXY}"
402 NEXUS_PATH="${SILO}/${JENKINS_HOSTNAME}/${JOB_NAME}/${BUILD_NUMBER}"
403 BUILD_URL="${BUILD_URL}"
405 lftools deploy archives -p "$ARCHIVE_ARTIFACTS" "$NEXUS_URL" "$NEXUS_PATH" "$WORKSPACE"
406 lftools deploy logs "$NEXUS_URL" "$NEXUS_PATH" "$BUILD_URL"
408 set +x # Disable trace since we no longer need it.
410 echo "Build logs: <a href=\"$LOGS_SERVER/$NEXUS_PATH\">$LOGS_SERVER/$NEXUS_PATH</a>"
413 </hudson.tasks.Shell>
416 # SPDX-License-Identifier: EPL-1.0
417 ##############################################################################
418 # Copyright (c) 2017 The Linux Foundation and others.
420 # All rights reserved. This program and the accompanying materials
421 # are made available under the terms of the Eclipse Public License v1.0
422 # which accompanies this distribution, and is available at
423 # http://www.eclipse.org/legal/epl-v10.html
424 ##############################################################################
426 # Clear log credential files
427 rm "$SETTINGS_FILE"
430 </hudson.tasks.Shell>
431 <hudson.plugins.descriptionsetter.DescriptionSetterBuilder>
432 <regexp>^Build logs: .*</regexp>
433 </hudson.plugins.descriptionsetter.DescriptionSetterBuilder>
435 <scriptOnlyIfSuccess>false</scriptOnlyIfSuccess>
436 <scriptOnlyIfFailure>false</scriptOnlyIfFailure>
437 <markBuildUnstable>false</markBuildUnstable>
438 </org.jenkinsci.plugins.postbuildscript.PostBuildScript>
439 <hudson.plugins.ws__cleanup.WsCleanup plugin="ws-cleanup">
441 <hudson.plugins.ws__cleanup.Pattern>
442 <pattern>**/*.jenkins-trigger</pattern>
444 </hudson.plugins.ws__cleanup.Pattern>
446 <deleteDirs>false</deleteDirs>
447 <cleanupMatrixParent>false</cleanupMatrixParent>
449 <cleanWhenSuccess>true</cleanWhenSuccess>
450 <cleanWhenUnstable>true</cleanWhenUnstable>
451 <cleanWhenFailure>true</cleanWhenFailure>
452 <cleanWhenNotBuilt>true</cleanWhenNotBuilt>
453 <cleanWhenAborted>true</cleanWhenAborted>
454 <notFailBuild>true</notFailBuild>
455 </hudson.plugins.ws__cleanup.WsCleanup>
458 <com.michelin.cio.hudson.plugins.maskpasswords.MaskPasswordsBuildWrapper/>
459 <hudson.plugins.build__timeout.BuildTimeoutWrapper>
460 <timeoutMinutes>15</timeoutMinutes>
461 <timeoutEnvVar>BUILD_TIMEOUT</timeoutEnvVar>
462 <failBuild>true</failBuild>
463 <writingDescription>false</writingDescription>
464 <timeoutPercentage>0</timeoutPercentage>
465 <timeoutMinutesElasticDefault>3</timeoutMinutesElasticDefault>
466 <timeoutType>absolute</timeoutType>
467 </hudson.plugins.build__timeout.BuildTimeoutWrapper>
468 <hudson.plugins.timestamper.TimestamperBuildWrapper/>
469 <com.cloudbees.jenkins.plugins.sshagent.SSHAgentBuildWrapper>
470 <user>test-credential</user>
471 </com.cloudbees.jenkins.plugins.sshagent.SSHAgentBuildWrapper>
472 <jenkins.plugins.openstack.compute.JCloudsOneOffSlave/>