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"
48 The name of a cloud configuration in clouds.yaml.
49 https://docs.openstack.org/developer/python-openstackclient/
57 description: 'Tag in Git to checkout'
60 name: controller-version-parameter
64 default: '{odl_version}'
65 description: 'Controller version (for use with openstacks networking_odl project)'
68 name: patches-to-build-parameter
71 name: PATCHES_TO_BUILD
73 description: 'csv list of patches in project:changeset format to build distribution with'
76 name: distribution-branch-to-build-parameter
79 name: DISTRIBUTION_BRANCH_TO_BUILD
81 description: 'distribution repo branch to build with'
89 description: 'Nexus staging profile id'
92 name: stage-id-parameter
95 name: STAGING_PROFILE_ID
97 description: 'Nexus staging profile id'
104 default: '/w/tools/hudson.tasks.Maven_MavenInstallation/{maven-version}/bin/mvn'
105 description: 'Maven selector to be used by shell scripts'
111 credentials-id: 'opendaylight-jenkins-ssh'
120 name: git-scm-with-submodules
123 credentials-id: 'opendaylight-jenkins-ssh'
127 - 'refs/heads/{branch}'
134 name: gerrit-trigger-scm
137 credentials-id: 'opendaylight-jenkins-ssh'
141 - 'origin/$GERRIT_BRANCH'
143 choosing-strategy: '{choosing-strategy}'
153 # This is a single macro to use for all jobs who vote on every (relevant) patch set.
154 # Only 'recheck' trigger word is supported, it always triggers the full set of relevant jobs,
155 # in order to prevent Jenkins from starting only a subset and still voting Verified+1.
157 # server: name of gerrit server to listen to
158 # project: pattern to match triggering projects
159 # branch: triggering branch name
160 # files: pattern to match triggering filepaths
162 name: gerrit-trigger-patch-submitted
165 server-name: '{server}'
167 - patchset-created-event:
169 exclude-trivial-rebase: false
170 exclude-no-code-change: false
171 - draft-published-event
172 - comment-added-contains-event:
173 comment-contains-value: recheck
175 - project-compare-type: ANT
176 project-pattern: '{project}'
178 - branch-compare-type: ANT
179 branch-pattern: '**/{branch}'
184 # TODO: Unify argument names across gerrit-trigger-* macros.
186 name: gerrit-trigger-patch-merged
189 server-name: '{server-name}'
191 - change-merged-event
192 - comment-added-contains-event:
193 comment-contains-value: 'remerge'
195 - project-compare-type: 'ANT'
196 project-pattern: '{name}'
198 - branch-compare-type: 'ANT'
199 branch-pattern: '**/{branch}'
205 # Force Jenkins always vote the values it should already have voted
206 # during the prior verify phase
208 gerrit-build-started-verified-value: 1
209 gerrit-build-successful-verified-value: 1
210 gerrit-build-failed-verified-value: 1
211 gerrit-build-unstable-verified-value: 1
212 gerrit-build-notbuilt-verified-value: 1
213 gerrit-build-started-codereview-value: 0
214 gerrit-build-successful-codereview-value: 0
215 gerrit-build-failed-codereview-value: 0
216 gerrit-build-unstable-codereview-value: 0
217 gerrit-build-notbuilt-codereview-value: 0
219 # TODO: Unify argument names across gerrit-trigger-* macros.
221 name: gerrit-trigger-patch-sonar
224 server-name: '{server-name}'
226 - comment-added-contains-event:
227 comment-contains-value: 'run-sonar'
229 - project-compare-type: 'ANT'
230 project-pattern: '{name}'
232 - branch-compare-type: 'ANT'
233 branch-pattern: '**/master'
241 name: archive-artifacts
244 artifacts: '{artifacts}'
250 name: email-notification
253 recipients: '{email-recipients}'
255 content-type: default
256 subject: '{email-prefix} $PROJECT_NAME - Build # $BUILD_NUMBER - $BUILD_STATUS!'
258 $PROJECT_NAME - Build # $BUILD_NUMBER - $BUILD_STATUS:
260 Please refer to the logs server URL for console logs when possible
261 and use the Jenkins Build URL as a last resort.
264 https://logs.opendaylight.org/$SILO/$JENKINS_HOSTNAME/$JOB_NAME/$BUILD_NUMBER
277 exec-pattern: "**/**.exec"
278 class-pattern: "**/classes"
279 source-pattern: "**/src/main/java"
280 exclusion-pattern: "**/gen/**,**/generated-sources/**,**/yang-gen**,**/pax/**"
291 name: opendaylight-infra-shiplogs
292 # To archive things the job will need to create a "archives" directory in
293 # the workspace and this macro will handle copying the contents of the
294 # archives directory.
296 # Uses the build parameter ARCHIVE_ARTIFACTS if not empty to find files
297 # to archive. You can pass globstar patterns for example "**/*.xml **/*.log"
298 # as the archive pattern. This is a space separated list of files to archive.
300 # Also ensure that the workspace is cleaned up at the end of the build.
304 - shell: !include-raw: include-raw-stack-delete.sh
305 - shell: !include-raw-escape: include-raw-deploy-archives.sh
307 maven-version: '{maven-version}'
308 pom: '.archives/deploy-archives.xml'
309 goals: 'clean deploy -V -B -q -Dmaven.repo.local=/tmp/r'
310 settings: 'jenkins-log-archives-settings'
312 global-settings: 'odl-global-settings'
313 global-settings-type: cfp
314 - description-setter:
315 regexp: '^Build logs: .*'
316 # Cleanup after ourselves
317 - wipe-org-opendaylight-repo
318 script-only-if-succeeded: false
319 script-only-if-failed: false
320 mark-unstable-if-failed: true
323 # Do not clean up *.jenkins-trigger files for jobs that use a
324 # properties file as input for triggering another build.
325 - '**/*.jenkins-trigger'
329 name: opendaylight-infra-stack
330 # opendaylight-infra-stack.sh has a required variable {stack-template} that
331 # must be passed into this macro.
333 - shell: !include-raw: opendaylight-infra-stack.sh
334 - shell: !include-raw-escape: opendaylight-infra-copy-ssh-keys.sh
337 name: opendaylight-infra-push-gerrit-patch
338 # opendaylight-infra-push-gerrit-patch.sh allows a job to push a patch to
339 # Gerrit in an automated fashion. This is meant for tasks that creates
340 # the same patch regularly and needs the ability to detect if an unreviewed
341 # patch already exists. In which case it will update the existing patch.
343 # Note: This patch assumes the $WORKSPACE contains the project repo with
344 # the files changed already "git add" and waiting for a "git commit" call.
346 # This script requires the following JJB variables to be passed in:
347 # {project} Gerrit project-name
348 # {gerrit-topic} Gerrit topic, please make a unique topic.
349 # {gerrit-commit-message} Commit message to assign to commit.
350 # NOTE: Requires git review to be installed on node.
352 - shell: !include-raw: opendaylight-infra-push-gerrit-patch.sh
355 name: distribute-build-url
356 # Place URL of the current run of a build job to a file at given path.
358 - shell: 'echo "$BUILD_URL" > {path}/build.url'
361 name: wipe-org-opendaylight-repo
363 - shell: 'if [ -d /tmp/r/org/opendaylight ]; then rm -rf /tmp/r/org/opendaylight; fi'
366 name: wipe-local-maven-repo
368 - shell: 'if [ -d /tmp/r ]; then rm -rf /tmp/r; fi'
371 name: jacoco-nojava-workaround
373 - shell: 'mkdir -p $WORKSPACE/target/classes $WORKSPACE/jacoco/classes'
379 application-name: '{application-name}'
382 name: releng-check-unicode
385 $WORKSPACE/scripts/check-unicode.sh jjb/
388 name: provide-maven-settings
390 - config-file-provider:
392 - file-id: '{global-settings-file}'
393 variable: 'GLOBAL_SETTINGS_FILE'
394 - file-id: '{settings-file}'
395 variable: 'SETTINGS_FILE'
398 name: releng-fetch-p2zip-if-necessary
401 # Cleanup any existing zips and metadata before we download the new update site
404 condition-kind: strings-match
405 condition-string1: '$P2ZIP_URL'
406 condition-string2: ''
407 condition-basedir: workspace
409 # TODO: Figure out latest snapshot version number to pull rather than hardcoding 1.1.1-SNAPSHOT
411 maven-version: '{maven-version}'
413 org.apache.maven.plugins:maven-dependency-plugin:get
414 org.apache.maven.plugins:maven-dependency-plugin:copy
416 -Dartifact=org.opendaylight.yangide:org.opendaylight.yangide.update-site:1.1.1-SNAPSHOT:zip
417 -DoutputDirectory=$WORKSPACE
418 settings: '{settings}'
419 global-settings: '{global-settings}'
422 name: releng-generate-p2pom
424 - shell: !include-raw: include-raw-generate-p2pom.sh
427 name: releng-update-p2composite-metadata
429 - shell: !include-raw: include-raw-update-p2composite-metadata.sh
431 condition-kind: file-exists
432 condition-filename: deploy-composite-repo.xml
433 condition-basedir: workspace
436 maven-version: '{maven-version}'
437 pom: 'deploy-composite-repo.xml'
438 goals: 'clean deploy -V -B -Dmaven.repo.local=/tmp/r'
439 settings: '{settings}'
440 global-settings: '{global-settings}'
443 name: releng-stage-release
445 - shell: !include-raw: include-raw-stage-release.sh
448 # This wrapper is required for all jobs as it configures the wrappers
449 # needed by OpenDaylight infra.
450 name: opendaylight-infra-wrappers
453 - config-file-provider:
455 - file-id: rackspace-heat
456 target: '$HOME/.config/openstack/clouds.yaml'
459 timeout: '{build-timeout}'
460 timeout-var: 'BUILD_TIMEOUT'
463 - ssh-agent-credentials:
465 - 'opendaylight-jenkins-ssh'
470 name: packer-validate
472 - config-file-provider:
474 - file-id: 'packer-cloud-env'
478 varfiles="../packer/vars/*"
479 templates="../packer/templates/*"
480 provision="../packer/provision/*.sh"
481 for v in $varfiles; do
482 [[ "${v##*/}" =~ ^(cloud-env.*)$ ]] && continue
483 for t in $templates; do
484 export PACKER_LOG="yes" && \
485 export PACKER_LOG_PATH="packer-validate-${v##*/}-${t##*/}.log" && \
486 packer.io validate -var-file=$CLOUDENV \
488 if [ $? -ne 0 ]; then
493 for p in $provision; do
494 /bin/bash -n $p > provision-validate-${p##*/}.log 2>&1
501 - config-file-provider:
503 - file-id: 'packer-cloud-env'
507 export PACKER_LOG="yes" && \
508 export PACKER_LOG_PATH="packer-build.log" && \
509 packer.io build -color=false -var-file=$CLOUDENV \
510 -var-file=../packer/vars/{platform}.json \
511 ../packer/templates/{template}.json
514 # TODO: Verify signature after downloading users public key from a locally created
515 # repository instead of the public keymesh. This requires a process in place to get ODL
516 # developers public keys into a local repository without increasing the job thoughput.
517 name: verify-gpg-signature
519 - shell: !include-raw: include-raw-verify-gpg-signatures.sh
522 name: opendaylight-infra-jjbini
524 - config-file-provider:
527 target: '$HOME/.config/jenkins_jobs/jenkins_jobs.ini'
530 name: distribution-check-wipe
531 # Step zero: Wipe file repositories up front.
534 echo "wipe r: the local Maven repository"
536 echo "wipe n: the fake remote (Nexus) repository"
538 echo "wipe t: the transient repository used in some manipulations"
542 name: distribution-check-build-project
543 # Step one: Online build of the project, using local repository /tmp/r/ and deploying artifacts to /tmp/n/.
544 # Ordinary SingleFeatureTest failures are detected in the verify job, so we can use "q" profile here.
546 # pom: Relative path to pom file to use. Typically '$GERRIT_PROJECT/pom.xml'.
549 maven-version: 'mvn33'
552 clean deploy dependency:tree
553 -DoutputFile=dependency_tree.txt
556 -DaltDeploymentRepository=fake-nexus::default::file:///tmp/n/
557 -Dmaven.repo.local=/tmp/r
558 -Dorg.ops4j.pax.url.mvn.localRepository=/tmp/r
560 - '-Xmx4096m -XX:MaxPermSize=1024m -Dmaven.compile.fork=true'
561 settings: 'integration-settings'
563 global-settings: 'odl-global-settings'
564 global-settings-type: cfp
567 name: distribution-check-verify-groupid
568 # Step two: Verify all deployed artifacts belong to the project's groupId.
569 # This is done by moving the allowed directories out of /tmp/n and checking no files remained there.
570 # The correct directory is derived from $GERRIT_PROJECT.
571 # TODO: Verify all deployed artifacts are snapshots.
573 # gerrit-project: Project name as nexus URI part. Typically '$GERRIT_PROJECT'.
576 mkdir -p /tmp/t/org/opendaylight/{gerrit-project}
577 mv /tmp/n/org/opendaylight/{gerrit-project}/* /tmp/t/org/opendaylight/{gerrit-project}/
578 test -z "`find /tmp/n/ -type f`" || ( echo "ERROR: Mismatched groupId detected (see above)." && false )
583 name: distribution-check-download-deps
584 # Step three: Online build of integration distribution.
585 # This step is mainly used for downloading other project artifacts.
586 # Running SingleFeaturesTest here does not seem to be required, so -Pq is used again.
588 # dist-pom: Relative path to pom file to use. 'distribution/pom.xml' is recommended.
591 maven-version: 'mvn33'
594 clean install dependency:tree
595 -DoutputFile=dependency_tree.txt
598 -Dmaven.repo.local=/tmp/r
599 -Dorg.ops4j.pax.url.mvn.localRepository=/tmp/r
601 - '-Xmx1024m -XX:MaxPermSize=256m -Dmaven.compile.fork=true'
602 settings: 'integration-settings'
604 global-settings: 'odl-global-settings'
605 global-settings-type: cfp
608 name: distribution-check-delete-snapshots
609 # Step four: Delete snapshot artifacts from the local repository.
610 # This is critical to detect orphaned artifacts or missing project-internal dependency declarations.
611 # Also other files related to maven repository resolution are removed,
612 # and then empty directories are removed, in order to simplify debugging.
614 - shell: !include-raw-escape: integration-distribution-delete-snaphot-artifacts.sh
617 name: distribution-check-configure-remotes
618 # Now the ugly part. It seems that the only way to tell Maven 2+
619 # which remote repositories to use is via settings.xml file.
620 # So we create such a file here, but it needs most of odlparent:settings.xml
624 <settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
625 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
626 xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
627 https://maven.apache.org/xsd/settings-1.0.0.xsd">
630 <id>opendaylight-release</id>
633 <id>opendaylight-mirror</id>
634 <name>opendaylight</name>
635 <url>https://nexus.opendaylight.org/content/repositories/public/</url>
636 <releases><updatePolicy>never</updatePolicy></releases>
637 <snapshots><enabled>false</enabled></snapshots>
642 <id>opendaylight-plugin-mirror</id>
643 <name>opendaylight-plugin</name>
644 <url>https://nexus.opendaylight.org/content/repositories/public/</url>
645 <releases><updatePolicy>never</updatePolicy></releases>
646 <snapshots><enabled>false</enabled></snapshots>
648 </pluginRepositories>
651 <id>file-snapshots</id>
654 <id>file-snapshots</id>
656 <url>file:///tmp/n/</url>
657 <releases><enabled>false</enabled></releases>
662 <id>file-plugin-snapshots</id>
663 <name>file-plugin</name>
664 <url>file:///tmp/n/</url>
665 <releases><enabled>false</enabled></releases>
667 </pluginRepositories>
671 <activeProfile>file-snapshots</activeProfile>
672 <activeProfile>opendaylight-release</activeProfile>
676 # Notes: The settings are minimal in order to detect breakage scenarios,
677 # while allowing for the following quirks:
678 # * Some plugins seem to have hardcoded repos, for example check-license looks at repository.apache.org
679 # * Some plugin artifacts (related to surefire) are not downloaded when tests are skipped.
680 # * populate-local-repo looks at oss.sonatype.org and does not store things (like guava) to /tmp/r
683 name: distribution-check-repeat-build
684 # Step five: Repeat the distribution build but with the new settings.
685 # Here, only the project snapshot artifacts deployed to /tmp/n are available,
686 # which faithfully reproduces conditions in later verify-like job runs.
687 # We cannot use --offline, because: "Cannot access file (file:///tmp/n) in offline mode"
688 # This is where SingleFeatureTest is not skipped.
690 # dist-pom: Relative path to pom file to use. 'distribution/pom.xml' is recommended.
693 maven-version: 'mvn33'
696 clean install dependency:tree
697 -DoutputFile=dependency_tree.txt -s fake_remotes.xml
701 -Dmaven.repo.local=/tmp/r
702 -Dorg.ops4j.pax.url.mvn.localRepository=/tmp/r
704 - '-Xmx1024m -XX:MaxPermSize=256m -Dmaven.compile.fork=true'