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/>
134 <command>mkdir -p $WORKSPACE/target/classes $WORKSPACE/jacoco/classes</command>
135 </hudson.tasks.Shell>
137 <command>echo "quiet=on" > "$HOME/.wgetrc"</command>
138 </hudson.tasks.Shell>
140 <targets>--version</targets>
142 <mavenName>mvn33</mavenName>
143 <usePrivateRepository>false</usePrivateRepository>
144 <settings class="jenkins.mvn.DefaultSettingsProvider"/>
145 <globalSettings class="jenkins.mvn.DefaultGlobalSettingsProvider"/>
146 </hudson.tasks.Maven>
148 <command>rm "$HOME/.wgetrc"</command>
149 </hudson.tasks.Shell>
150 <org.jenkinsci.plugins.configfiles.builder.ConfigFileBuildStep plugin="config-file-provider">
152 <org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
153 <fileId>global-settings</fileId>
155 <variable>GLOBAL_SETTINGS_FILE</variable>
156 </org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
157 <org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
158 <fileId>aproject-settings</fileId>
160 <variable>SETTINGS_FILE</variable>
161 </org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
163 </org.jenkinsci.plugins.configfiles.builder.ConfigFileBuildStep>
166 <propertiesContent>SERVER_ID=opendaylight-staging</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 echo "---> create-netrc.sh"
182 # Ensure we fail the job if any steps fail.
185 NEXUS_URL="${NEXUS_URL:-$NEXUSPROXY}"
186 CREDENTIAL=$(xmlstarlet sel -N "x=http://maven.apache.org/SETTINGS/1.0.0" \
187 -t -m "/x:settings/x:servers/x:server[x:id='${SERVER_ID}']" \
188 -v x:username -o ":" -v x:password \
189 "$SETTINGS_FILE")
191 machine=$(echo "$NEXUS_URL" | awk -F/ '{print $3}')
192 user=$(echo "$CREDENTIAL" | cut -f1 -d:)
193 pass=$(echo "$CREDENTIAL" | cut -f2 -d:)
195 echo "machine $machine login $user password $pass" > ~/.netrc
197 </hudson.tasks.Shell>
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 ##############################################################################
209 echo "---> lftools-install.sh"
211 # Ensure we fail the job if any steps fail.
212 # DO NOT set -u as virtualenv's activate script has unbound variables
215 virtualenv --quiet "/tmp/v/lftools"
216 # shellcheck source=/tmp/v/lftools/bin/activate disable=SC1091
217 source "/tmp/v/lftools/bin/activate"
218 pip install --quiet --upgrade pip
219 pip install --quiet --upgrade "lftools<1.0.0"
221 # pipdeptree prints out a lot of information because lftools pulls in many
222 # dependencies. Let's only print it if we want to debug.
223 # echo "----> Pip Dependency Tree"
224 # pip install --quiet --upgrade pipdeptree
228 # SPDX-License-Identifier: EPL-1.0
229 ##############################################################################
230 # Copyright (c) 2017 The Linux Foundation and others.
232 # All rights reserved. This program and the accompanying materials
233 # are made available under the terms of the Eclipse Public License v1.0
234 # which accompanies this distribution, and is available at
235 # http://www.eclipse.org/legal/epl-v10.html
236 ##############################################################################
238 # This file contains a list of variables that are generally useful in many
239 # scripts. It is meant to be sourced in other scripts so that the variables can
242 MAVEN_OPTIONS="$(echo --show-version \
245 -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn \
246 -Dmaven.repo.local=/tmp/r \
247 -Dorg.ops4j.pax.url.mvn.localRepository=/tmp/r)"
248 echo "$MAVEN_OPTIONS"
251 # SPDX-License-Identifier: EPL-1.0
252 ##############################################################################
253 # Copyright (c) 2017 The Linux Foundation and others.
255 # All rights reserved. This program and the accompanying materials
256 # are made available under the terms of the Eclipse Public License v1.0
257 # which accompanies this distribution, and is available at
258 # http://www.eclipse.org/legal/epl-v10.html
259 ##############################################################################
261 # This script removes the -SNAPSHOT from a project to prepare it for release.
263 PATCH_DIR="$WORKSPACE/archives/patches"
264 mkdir -p "$PATCH_DIR"
266 # Ensure we fail the job if any steps fail.
269 echo "$PROJECT" "$(git rev-parse --verify HEAD)" | tee -a "$PATCH_DIR/taglist.log"
271 # Strip -SNAPSHOT from version to prepare release.
272 find . -name "*.xml" -print0 | xargs -0 sed -i 's/-SNAPSHOT//g'
274 git commit -am "Release $PROJECT"
275 git format-patch --stdout "origin/$GERRIT_BRANCH" > "$PATCH_DIR/${PROJECT//\//-}.patch"
276 git bundle create "$PATCH_DIR/${PROJECT//\//-}.bundle" "origin/${GERRIT_BRANCH}..HEAD"
279 # SPDX-License-Identifier: EPL-1.0
280 ##############################################################################
281 # Copyright (c) 2017 The Linux Foundation and others.
283 # All rights reserved. This program and the accompanying materials
284 # are made available under the terms of the Eclipse Public License v1.0
285 # which accompanies this distribution, and is available at
286 # http://www.eclipse.org/legal/epl-v10.html
287 ##############################################################################
289 # This script builds a Maven project and deploys it into a staging repo which
290 # can be used to deploy elsewhere later eg. Nexus staging / snapshot repos.
292 # DO NOT enable -u because $MAVEN_PARAMS and $MAVEN_OPTIONS could be unbound.
293 # Ensure we fail the job if any steps fail.
299 # Disable SC2086 because we want to allow word splitting for $MAVEN_* parameters.
300 # shellcheck disable=SC2086
302 --global-settings "$GLOBAL_SETTINGS_FILE" \
303 --settings "$SETTINGS_FILE" \
304 -DaltDeploymentRepository=staging::default::file:"$WORKSPACE"/m2repo \
305 $MAVEN_PARAMS $MAVEN_OPTIONS
308 # SPDX-License-Identifier: EPL-1.0
309 ##############################################################################
310 # Copyright (c) 2017 The Linux Foundation and others.
312 # All rights reserved. This program and the accompanying materials
313 # are made available under the terms of the Eclipse Public License v1.0
314 # which accompanies this distribution, and is available at
315 # http://www.eclipse.org/legal/epl-v10.html
316 ##############################################################################
318 # This script publishes artifacts to a staging repo in Nexus.
320 # $WORKSPACE/m2repo : Exists and used to deploy the staging repository.
321 # $NEXUS_URL : Jenkins global variable should be defined.
322 # $STAGING_PROFILE_ID : Provided by a job parameter.
324 # Ensure we fail the job if any steps fail.
327 TMP_FILE="$(mktemp)"
328 lftools deploy nexus-stage "$NEXUS_URL" "$STAGING_PROFILE_ID" "$WORKSPACE/m2repo" | tee "$TMP_FILE"
329 staging_repo=$(sed -n -e 's/Staging repository \(.*\) created\./\1/p' "$TMP_FILE")
331 # Store repo info to a file in archives
332 mkdir -p "$WORKSPACE/archives"
333 echo "$staging_repo" > "$WORKSPACE/archives/staging-repo.txt"
336 rm "$TMP_FILE"
338 </hudson.tasks.Shell>
341 set +e # DO NOT cause build failure if any of the rm calls fail.
343 rm "$GLOBAL_SETTINGS_FILE" "$SETTINGS_FILE"
345 # In some cases we use the lf-provide-maven-settings macro to produce
346 # a "$HOME/.netrc" file containing credentials. Remove that file here
348 rm "$HOME/.netrc"
350 # DO NOT fail build if any of the above lines fail.
353 </hudson.tasks.Shell>
356 <org.jenkinsci.plugins.postbuildscript.PostBuildScript>
360 # SPDX-License-Identifier: EPL-1.0
361 ##############################################################################
362 # Copyright (c) 2017 The Linux Foundation and others.
364 # All rights reserved. This program and the accompanying materials
365 # are made available under the terms of the Eclipse Public License v1.0
366 # which accompanies this distribution, and is available at
367 # http://www.eclipse.org/legal/epl-v10.html
368 ##############################################################################
369 echo "---> sysstat.sh"
370 set +e # DON'T fail build if script fails.
372 OS=$(facter operatingsystem)
373 case "$OS" in
375 SYSSTAT_PATH="/var/log/sysstat"
377 # Dont run the script when systat is not enabled by default
378 if ! grep --quiet 'ENABLED="true"' "/etc/default/sysstat"; then
383 SYSSTAT_PATH="/var/log/sa"
391 SAR_DIR="$WORKSPACE/archives/sar-reports"
392 mkdir -p "$SAR_DIR"
393 cp "$SYSSTAT_PATH/"* "$_"
394 # convert sar data to ascii format
395 while IFS="" read -r s
397 [ -f "$s" ] && LC_TIME=POSIX sar -A -f "$s" > "$SAR_DIR/sar${s//[!0-9]/}"
398 done < <(find "$SYSSTAT_PATH" -name "sa[0-9]*" || true)
400 # DON'T fail build if script fails.
403 </hudson.tasks.Shell>
404 <org.jenkinsci.plugins.configfiles.builder.ConfigFileBuildStep plugin="config-file-provider">
406 <org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
407 <fileId>jenkins-log-archives-settings</fileId>
409 <variable>SETTINGS_FILE</variable>
410 </org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
412 </org.jenkinsci.plugins.configfiles.builder.ConfigFileBuildStep>
415 <propertiesContent>SERVER_ID=logs</propertiesContent>
420 # SPDX-License-Identifier: EPL-1.0
421 ##############################################################################
422 # Copyright (c) 2017 The Linux Foundation and others.
424 # All rights reserved. This program and the accompanying materials
425 # are made available under the terms of the Eclipse Public License v1.0
426 # which accompanies this distribution, and is available at
427 # http://www.eclipse.org/legal/epl-v10.html
428 ##############################################################################
429 echo "---> create-netrc.sh"
431 # Ensure we fail the job if any steps fail.
434 NEXUS_URL="${NEXUS_URL:-$NEXUSPROXY}"
435 CREDENTIAL=$(xmlstarlet sel -N "x=http://maven.apache.org/SETTINGS/1.0.0" \
436 -t -m "/x:settings/x:servers/x:server[x:id='${SERVER_ID}']" \
437 -v x:username -o ":" -v x:password \
438 "$SETTINGS_FILE")
440 machine=$(echo "$NEXUS_URL" | awk -F/ '{print $3}')
441 user=$(echo "$CREDENTIAL" | cut -f1 -d:)
442 pass=$(echo "$CREDENTIAL" | cut -f2 -d:)
444 echo "machine $machine login $user password $pass" > ~/.netrc
446 </hudson.tasks.Shell>
449 # SPDX-License-Identifier: EPL-1.0
450 ##############################################################################
451 # Copyright (c) 2017 The Linux Foundation and others.
453 # All rights reserved. This program and the accompanying materials
454 # are made available under the terms of the Eclipse Public License v1.0
455 # which accompanies this distribution, and is available at
456 # http://www.eclipse.org/legal/epl-v10.html
457 ##############################################################################
458 echo "---> lftools-install.sh"
460 # Ensure we fail the job if any steps fail.
461 # DO NOT set -u as virtualenv's activate script has unbound variables
464 virtualenv --quiet "/tmp/v/lftools"
465 # shellcheck source=/tmp/v/lftools/bin/activate disable=SC1091
466 source "/tmp/v/lftools/bin/activate"
467 pip install --quiet --upgrade pip
468 pip install --quiet --upgrade "lftools<1.0.0"
470 # pipdeptree prints out a lot of information because lftools pulls in many
471 # dependencies. Let's only print it if we want to debug.
472 # echo "----> Pip Dependency Tree"
473 # pip install --quiet --upgrade pipdeptree
477 # SPDX-License-Identifier: EPL-1.0
478 ##############################################################################
479 # Copyright (c) 2017 The Linux Foundation and others.
481 # All rights reserved. This program and the accompanying materials
482 # are made available under the terms of the Eclipse Public License v1.0
483 # which accompanies this distribution, and is available at
484 # http://www.eclipse.org/legal/epl-v10.html
485 ##############################################################################
486 echo "---> logs-deploy.sh"
488 # Ensure we fail the job if any steps fail.
491 set -x # Trace commands for this script to make debugging easier.
493 ARCHIVE_ARTIFACTS="${ARCHIVE_ARTIFACTS:-}"
494 LOGS_SERVER="${LOGS_SERVER:-None}"
496 if [ "${LOGS_SERVER}" == 'None' ]
498 set +x # Disable trace since we no longer need it
500 echo "WARNING: Logging server not set"
502 NEXUS_URL="${NEXUS_URL:-$NEXUSPROXY}"
503 NEXUS_PATH="${SILO}/${JENKINS_HOSTNAME}/${JOB_NAME}/${BUILD_NUMBER}"
504 BUILD_URL="${BUILD_URL}"
506 lftools deploy archives -p "$ARCHIVE_ARTIFACTS" "$NEXUS_URL" "$NEXUS_PATH" "$WORKSPACE"
507 lftools deploy logs "$NEXUS_URL" "$NEXUS_PATH" "$BUILD_URL"
509 set +x # Disable trace since we no longer need it.
511 echo "Build logs: <a href=\"$LOGS_SERVER/$NEXUS_PATH\">$LOGS_SERVER/$NEXUS_PATH</a>"
514 </hudson.tasks.Shell>
517 # SPDX-License-Identifier: EPL-1.0
518 ##############################################################################
519 # Copyright (c) 2017 The Linux Foundation and others.
521 # All rights reserved. This program and the accompanying materials
522 # are made available under the terms of the Eclipse Public License v1.0
523 # which accompanies this distribution, and is available at
524 # http://www.eclipse.org/legal/epl-v10.html
525 ##############################################################################
527 # Clear log credential files
528 rm "$SETTINGS_FILE"
531 </hudson.tasks.Shell>
532 <hudson.plugins.descriptionsetter.DescriptionSetterBuilder>
533 <regexp>^Build logs: .*</regexp>
534 </hudson.plugins.descriptionsetter.DescriptionSetterBuilder>
536 <scriptOnlyIfSuccess>false</scriptOnlyIfSuccess>
537 <scriptOnlyIfFailure>false</scriptOnlyIfFailure>
538 <markBuildUnstable>false</markBuildUnstable>
539 </org.jenkinsci.plugins.postbuildscript.PostBuildScript>
540 <hudson.plugins.ws__cleanup.WsCleanup plugin="ws-cleanup">
542 <hudson.plugins.ws__cleanup.Pattern>
543 <pattern>**/*.jenkins-trigger</pattern>
545 </hudson.plugins.ws__cleanup.Pattern>
547 <deleteDirs>false</deleteDirs>
548 <cleanupMatrixParent>false</cleanupMatrixParent>
550 <cleanWhenSuccess>true</cleanWhenSuccess>
551 <cleanWhenUnstable>true</cleanWhenUnstable>
552 <cleanWhenFailure>true</cleanWhenFailure>
553 <cleanWhenNotBuilt>true</cleanWhenNotBuilt>
554 <cleanWhenAborted>true</cleanWhenAborted>
555 <notFailBuild>true</notFailBuild>
556 </hudson.plugins.ws__cleanup.WsCleanup>
559 <com.michelin.cio.hudson.plugins.maskpasswords.MaskPasswordsBuildWrapper/>
560 <hudson.plugins.build__timeout.BuildTimeoutWrapper>
561 <timeoutMinutes>30</timeoutMinutes>
562 <timeoutEnvVar>BUILD_TIMEOUT</timeoutEnvVar>
563 <failBuild>true</failBuild>
564 <writingDescription>false</writingDescription>
565 <timeoutPercentage>0</timeoutPercentage>
566 <timeoutMinutesElasticDefault>3</timeoutMinutesElasticDefault>
567 <timeoutType>absolute</timeoutType>
568 </hudson.plugins.build__timeout.BuildTimeoutWrapper>
569 <hudson.plugins.timestamper.TimestamperBuildWrapper/>
570 <com.cloudbees.jenkins.plugins.sshagent.SSHAgentBuildWrapper>
571 <user>test-credential</user>
572 </com.cloudbees.jenkins.plugins.sshagent.SSHAgentBuildWrapper>
573 <jenkins.plugins.openstack.compute.JCloudsOneOffSlave/>