4 name: opendaylight-infra-properties
7 days-to-keep: '{build-days-to-keep}'
9 artifact-days-to-keep: -1
10 artifact-num-to-keep: 5
13 name: opendaylight-infra-parameters
18 description: 'Parameter to identify an ODL Gerrit project'
20 name: ARCHIVE_ARTIFACTS
23 **/target/surefire-reports/*-output.txt
25 **/target/feature/feature.xml
27 description: 'Space separated glob patterns for artifacts to archive into logs.opendaylight.org'
31 description: "GERRIT_PROJECT parameter if not given by trigger"
35 description: "JJB configured GERRIT_BRANCH parameter"
39 description: "GERRIT_REFSPEC parameter if not given by trigger"
42 default: '$JOB_NAME-$BUILD_NUMBER'
43 description: "Used by Heat to generate a unique stack & vm name"
51 description: 'Tag in Git to checkout'
54 name: controller-version-parameter
58 default: '{odl_version}'
59 description: 'Controller version (for use with openstacks networking_odl project)'
62 name: patches-to-build-parameter
65 name: PATCHES_TO_BUILD
67 description: 'csv list of patches in project:changeset format to build distribution with'
70 name: distribution-branch-to-build-parameter
73 name: DISTRIBUTION_BRANCH_TO_BUILD
75 description: 'distribution repo branch to build with'
83 description: 'Nexus staging profile id'
86 name: stage-id-parameter
89 name: STAGING_PROFILE_ID
91 description: 'Nexus staging profile id'
98 default: '/w/tools/hudson.tasks.Maven_MavenInstallation/{maven-version}/bin/mvn'
99 description: 'Maven selector to be used by shell scripts'
105 credentials-id: 'opendaylight-jenkins-ssh'
114 name: git-scm-with-submodules
117 credentials-id: 'opendaylight-jenkins-ssh'
121 - 'refs/heads/{branch}'
128 name: gerrit-trigger-scm
131 credentials-id: 'opendaylight-jenkins-ssh'
135 - 'origin/$GERRIT_BRANCH'
137 choosing-strategy: '{choosing-strategy}'
147 # This is a single macro to use for all jobs who vote on every (relevant) patch set.
148 # Only 'recheck' trigger word is supported, it always triggers the full set of relevant jobs,
149 # in order to prevent Jenkins from starting only a subset and still voting Verified+1.
151 # server: name of gerrit server to listen to
152 # project: pattern to match triggering projects
153 # branch: triggering branch name
154 # files: pattern to match triggering filepaths
156 name: gerrit-trigger-patch-submitted
159 server-name: '{server}'
161 - patchset-created-event:
163 exclude-trivial-rebase: false
164 exclude-no-code-change: false
165 - draft-published-event
166 - comment-added-contains-event:
167 comment-contains-value: recheck
169 - project-compare-type: ANT
170 project-pattern: '{project}'
172 - branch-compare-type: ANT
173 branch-pattern: '**/{branch}'
178 # TODO: Unify argument names across gerrit-trigger-* macros.
180 name: gerrit-trigger-patch-merged
183 server-name: '{server-name}'
185 - change-merged-event
186 - comment-added-contains-event:
187 comment-contains-value: 'remerge'
189 - project-compare-type: 'ANT'
190 project-pattern: '{name}'
192 - branch-compare-type: 'ANT'
193 branch-pattern: '**/{branch}'
199 # Force Jenkins always vote the values it should already have voted
200 # during the prior verify phase
202 gerrit-build-started-verified-value: 1
203 gerrit-build-successful-verified-value: 1
204 gerrit-build-failed-verified-value: 1
205 gerrit-build-unstable-verified-value: 1
206 gerrit-build-notbuilt-verified-value: 1
207 gerrit-build-started-codereview-value: 0
208 gerrit-build-successful-codereview-value: 0
209 gerrit-build-failed-codereview-value: 0
210 gerrit-build-unstable-codereview-value: 0
211 gerrit-build-notbuilt-codereview-value: 0
213 # TODO: Unify argument names across gerrit-trigger-* macros.
215 name: gerrit-trigger-patch-sonar
218 server-name: '{server-name}'
220 - comment-added-contains-event:
221 comment-contains-value: 'run-sonar'
223 - project-compare-type: 'ANT'
224 project-pattern: '{name}'
226 - branch-compare-type: 'ANT'
227 branch-pattern: '**/master'
235 name: archive-artifacts
238 artifacts: '{artifacts}'
244 name: email-notification
247 recipients: '{email-recipients}'
249 content-type: default
250 subject: '{email-prefix} $PROJECT_NAME - Build # $BUILD_NUMBER - $BUILD_STATUS!'
252 $PROJECT_NAME - Build # $BUILD_NUMBER - $BUILD_STATUS:
254 Please refer to the logs server URL for console logs when possible
255 and use the Jenkins Build URL as a last resort.
258 https://logs.opendaylight.org/$SILO/$JENKINS_HOSTNAME/$JOB_NAME/$BUILD_NUMBER
271 exec-pattern: "**/**.exec"
272 class-pattern: "**/classes"
273 source-pattern: "**/src/main/java"
274 exclusion-pattern: "**/gen/**,**/generated-sources/**,**/yang-gen**,**/pax/**"
285 name: opendaylight-infra-shiplogs
286 # To archive things the job will need to create a "archives" directory in
287 # the workspace and this macro will handle copying the contents of the
288 # archives directory.
290 # Uses the build parameter ARCHIVE_ARTIFACTS if not empty to find files
291 # to archive. You can pass globstar patterns for example "**/*.xml **/*.log"
292 # as the archive pattern. This is a space separated list of files to archive.
294 # Also ensure that the workspace is cleaned up at the end of the build.
298 - shell: !include-raw: include-raw-stack-delete.sh
299 - shell: !include-raw-escape: include-raw-deploy-archives.sh
301 maven-version: '{maven-version}'
302 pom: '.archives/deploy-archives.xml'
303 goals: 'clean deploy -V -B -q -Dmaven.repo.local=/tmp/r'
304 settings: 'jenkins-log-archives-settings'
306 global-settings: 'odl-global-settings'
307 global-settings-type: cfp
308 - description-setter:
309 regexp: '^Build logs: .*'
310 # Cleanup after ourselves
311 - wipe-org-opendaylight-repo
312 script-only-if-succeeded: false
313 script-only-if-failed: false
314 mark-unstable-if-failed: true
317 # Do not clean up *.jenkins-trigger files for jobs that use a
318 # properties file as input for triggering another build.
319 - '**/*.jenkins-trigger'
323 name: opendaylight-infra-stack
324 # opendaylight-infra-stack.sh has a required variable {stack-template} that
325 # must be passed into this macro.
327 - shell: !include-raw: opendaylight-infra-stack.sh
328 - shell: !include-raw-escape: opendaylight-infra-copy-ssh-keys.sh
331 name: opendaylight-infra-push-gerrit-patch
332 # opendaylight-infra-push-gerrit-patch.sh allows a job to push a patch to
333 # Gerrit in an automated fashion. This is meant for tasks that creates
334 # the same patch regularly and needs the ability to detect if an unreviewed
335 # patch already exists. In which case it will update the existing patch.
337 # Note: This patch assumes the $WORKSPACE contains the project repo with
338 # the files changed already "git add" and waiting for a "git commit" call.
340 # This script requires the following JJB variables to be passed in:
341 # {project} Gerrit project-name
342 # {gerrit-topic} Gerrit topic, please make a unique topic.
343 # {gerrit-commit-message} Commit message to assign to commit.
344 # NOTE: Requires git review to be installed on node.
346 - shell: !include-raw: opendaylight-infra-push-gerrit-patch.sh
349 name: distribute-build-url
350 # Place URL of the current run of a build job to a file at given path.
352 - shell: 'echo "$BUILD_URL" > {path}/build.url'
355 name: wipe-org-opendaylight-repo
357 - shell: 'if [ -d /tmp/r/org/opendaylight ]; then rm -rf /tmp/r/org/opendaylight; fi'
360 name: wipe-local-maven-repo
362 - shell: 'if [ -d /tmp/r ]; then rm -rf /tmp/r; fi'
365 name: jacoco-nojava-workaround
367 - shell: 'mkdir -p $WORKSPACE/target/classes $WORKSPACE/jacoco/classes'
373 application-name: '{application-name}'
376 name: releng-check-unicode
379 $WORKSPACE/scripts/check-unicode.sh jjb/
382 name: provide-maven-settings
384 - config-file-provider:
386 - file-id: '{global-settings-file}'
387 variable: 'GLOBAL_SETTINGS_FILE'
388 - file-id: '{settings-file}'
389 variable: 'SETTINGS_FILE'
392 name: releng-fetch-p2zip-if-necessary
395 # Cleanup any existing zips and metadata before we download the new update site
398 condition-kind: strings-match
399 condition-string1: '$P2ZIP_URL'
400 condition-string2: ''
401 condition-basedir: workspace
403 # TODO: Figure out latest snapshot version number to pull rather than hardcoding 1.1.1-SNAPSHOT
405 maven-version: '{maven-version}'
407 org.apache.maven.plugins:maven-dependency-plugin:get
408 org.apache.maven.plugins:maven-dependency-plugin:copy
410 -Dartifact=org.opendaylight.yangide:org.opendaylight.yangide.update-site:1.1.1-SNAPSHOT:zip
411 -DoutputDirectory=$WORKSPACE
412 settings: '{settings}'
413 global-settings: '{global-settings}'
416 name: releng-generate-p2pom
418 - shell: !include-raw: include-raw-generate-p2pom.sh
421 name: releng-update-p2composite-metadata
423 - shell: !include-raw: include-raw-update-p2composite-metadata.sh
425 condition-kind: file-exists
426 condition-filename: deploy-composite-repo.xml
427 condition-basedir: workspace
430 maven-version: '{maven-version}'
431 pom: 'deploy-composite-repo.xml'
432 goals: 'clean deploy -V -B -Dmaven.repo.local=/tmp/r'
433 settings: '{settings}'
434 global-settings: '{global-settings}'
437 name: releng-stage-release
439 - shell: !include-raw: include-raw-stage-release.sh
442 # This wrapper is required for all jobs as it configures the wrappers
443 # needed by OpenDaylight infra.
444 name: opendaylight-infra-wrappers
447 - config-file-provider:
449 - file-id: rackspace-heat
450 target: '$HOME/.config/openstack/clouds.yaml'
453 timeout: '{build-timeout}'
454 timeout-var: 'BUILD_TIMEOUT'
457 - ssh-agent-credentials:
459 - 'opendaylight-jenkins-ssh'
464 name: packer-validate
466 - config-file-provider:
468 - file-id: 'packer-cloud-env'
472 varfiles="../packer/vars/*"
473 templates="../packer/templates/*"
474 provision="../packer/provision/*.sh"
475 for v in $varfiles; do
476 [[ "${v##*/}" =~ ^(cloud-env.*)$ ]] && continue
477 for t in $templates; do
478 export PACKER_LOG="yes" && \
479 export PACKER_LOG_PATH="packer-validate-${v##*/}-${t##*/}.log" && \
480 packer.io validate -var-file=$CLOUDENV \
482 if [ $? -ne 0 ]; then
487 for p in $provision; do
488 /bin/bash -n $p > provision-validate-${p##*/}.log 2>&1
495 - config-file-provider:
497 - file-id: 'packer-cloud-env'
501 export PACKER_LOG="yes" && \
502 export PACKER_LOG_PATH="packer-build.log" && \
503 packer.io build -color=false -var-file=$CLOUDENV \
504 -var-file=../packer/vars/{platform}.json \
505 ../packer/templates/{template}.json
508 # TODO: Verify signature after downloading users public key from a locally created
509 # repository instead of the public keymesh. This requires a process in place to get ODL
510 # developers public keys into a local repository without increasing the job thoughput.
511 name: verify-gpg-signature
513 - shell: !include-raw: include-raw-verify-gpg-signatures.sh
516 name: opendaylight-infra-jjbini
518 - config-file-provider:
521 target: '$HOME/.config/jenkins_jobs/jenkins_jobs.ini'
524 name: distribution-check-wipe
525 # Step zero: Wipe file repositories up front.
528 echo "wipe r: the local Maven repository"
530 echo "wipe n: the fake remote (Nexus) repository"
532 echo "wipe t: the transient repository used in some manipulations"
536 name: distribution-check-build-project
537 # Step one: Online build of the project, using local repository /tmp/r/ and deploying artifacts to /tmp/n/.
538 # Ordinary SingleFeatureTest failures are detected in the verify job, so we can use "q" profile here.
540 # pom: Relative path to pom file to use. Typically '$GERRIT_PROJECT/pom.xml'.
543 maven-version: 'mvn33'
546 clean deploy dependency:tree
547 -DoutputFile=dependency_tree.txt
550 -DaltDeploymentRepository=fake-nexus::default::file:///tmp/n/
551 -Dmaven.repo.local=/tmp/r
552 -Dorg.ops4j.pax.url.mvn.localRepository=/tmp/r
554 - '-Xmx4096m -XX:MaxPermSize=1024m -Dmaven.compile.fork=true'
555 settings: 'integration-settings'
557 global-settings: 'odl-global-settings'
558 global-settings-type: cfp
561 name: distribution-check-verify-groupid
562 # Step two: Verify all deployed artifacts belong to the project's groupId.
563 # This is done by moving the allowed directories out of /tmp/n and checking no files remained there.
564 # The correct directory is derived from $GERRIT_PROJECT.
565 # TODO: Verify all deployed artifacts are snapshots.
567 # gerrit-project: Project name as nexus URI part. Typically '$GERRIT_PROJECT'.
570 mkdir -p /tmp/t/org/opendaylight/{gerrit-project}
571 mv /tmp/n/org/opendaylight/{gerrit-project}/* /tmp/t/org/opendaylight/{gerrit-project}/
572 test -z "`find /tmp/n/ -type f`" || ( echo "ERROR: Mismatched groupId detected (see above)." && false )
577 name: distribution-check-download-deps
578 # Step three: Online build of integration distribution.
579 # This step is mainly used for downloading other project artifacts.
580 # Running SingleFeaturesTest here does not seem to be required, so -Pq is used again.
582 # dist-pom: Relative path to pom file to use. 'distribution/pom.xml' is recommended.
585 maven-version: 'mvn33'
588 clean install dependency:tree
589 -DoutputFile=dependency_tree.txt
592 -Dmaven.repo.local=/tmp/r
593 -Dorg.ops4j.pax.url.mvn.localRepository=/tmp/r
595 - '-Xmx1024m -XX:MaxPermSize=256m -Dmaven.compile.fork=true'
596 settings: 'integration-settings'
598 global-settings: 'odl-global-settings'
599 global-settings-type: cfp
602 name: distribution-check-delete-snapshots
603 # Step four: Delete snapshot artifacts from the local repository.
604 # This is critical to detect orphaned artifacts or missing project-internal dependency declarations.
605 # Also other files related to maven repository resolution are removed,
606 # and then empty directories are removed, in order to simplify debugging.
608 - shell: !include-raw-escape: integration-distribution-delete-snaphot-artifacts.sh
611 name: distribution-check-configure-remotes
612 # Now the ugly part. It seems that the only way to tell Maven 2+
613 # which remote repositories to use is via settings.xml file.
614 # So we create such a file here, but it needs most of odlparent:settings.xml
618 <settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
619 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
620 xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
621 https://maven.apache.org/xsd/settings-1.0.0.xsd">
624 <id>opendaylight-release</id>
627 <id>opendaylight-mirror</id>
628 <name>opendaylight</name>
629 <url>https://nexus.opendaylight.org/content/repositories/public/</url>
630 <releases><updatePolicy>never</updatePolicy></releases>
631 <snapshots><enabled>false</enabled></snapshots>
636 <id>opendaylight-plugin-mirror</id>
637 <name>opendaylight-plugin</name>
638 <url>https://nexus.opendaylight.org/content/repositories/public/</url>
639 <releases><updatePolicy>never</updatePolicy></releases>
640 <snapshots><enabled>false</enabled></snapshots>
642 </pluginRepositories>
645 <id>file-snapshots</id>
648 <id>file-snapshots</id>
650 <url>file:///tmp/n/</url>
651 <releases><enabled>false</enabled></releases>
656 <id>file-plugin-snapshots</id>
657 <name>file-plugin</name>
658 <url>file:///tmp/n/</url>
659 <releases><enabled>false</enabled></releases>
661 </pluginRepositories>
665 <activeProfile>file-snapshots</activeProfile>
666 <activeProfile>opendaylight-release</activeProfile>
670 # Notes: The settings are minimal in order to detect breakage scenarios,
671 # while allowing for the following quirks:
672 # * Some plugins seem to have hardcoded repos, for example check-license looks at repository.apache.org
673 # * Some plugin artifacts (related to surefire) are not downloaded when tests are skipped.
674 # * populate-local-repo looks at oss.sonatype.org and does not store things (like guava) to /tmp/r
677 name: distribution-check-repeat-build
678 # Step five: Repeat the distribution build but with the new settings.
679 # Here, only the project snapshot artifacts deployed to /tmp/n are available,
680 # which faithfully reproduces conditions in later verify-like job runs.
681 # We cannot use --offline, because: "Cannot access file (file:///tmp/n) in offline mode"
682 # This is where SingleFeatureTest is not skipped.
684 # dist-pom: Relative path to pom file to use. 'distribution/pom.xml' is recommended.
687 maven-version: 'mvn33'
690 clean install dependency:tree
691 -DoutputFile=dependency_tree.txt -s fake_remotes.xml
695 -Dmaven.repo.local=/tmp/r
696 -Dorg.ops4j.pax.url.mvn.localRepository=/tmp/r
698 - '-Xmx1024m -XX:MaxPermSize=256m -Dmaven.compile.fork=true'