4 name: opendaylight-infra-properties
7 days-to-keep: '{build-days-to-keep}'
9 # Need to keep artifacts for at least 1 day as some projects need to
10 # be able to validate their artifacts and only allowing limited
11 # number of artifacts could make fast moving jobs lost their
12 # artifacts before the developers can test it.
13 artifact-days-to-keep: 1
16 name: opendaylight-infra-parameters
21 description: 'Parameter to identify an ODL Gerrit project'
23 name: ARCHIVE_ARTIFACTS
26 **/target/surefire-reports/*-output.txt
28 **/target/feature/feature.xml
30 description: 'Space separated glob patterns for artifacts to archive into logs.opendaylight.org'
34 description: "GERRIT_PROJECT parameter if not given by trigger"
38 description: "JJB configured GERRIT_BRANCH parameter"
42 description: "GERRIT_REFSPEC parameter if not given by trigger"
45 default: '$SILO-$JOB_NAME-$BUILD_NUMBER'
46 description: "Used by Heat to generate a unique stack & vm name"
51 The name of a cloud configuration in clouds.yaml.
52 https://docs.openstack.org/developer/python-openstackclient/
60 description: 'Tag in Git to checkout'
63 name: controller-version-parameter
67 default: '{odl_version}'
68 description: 'Controller version (for use with openstacks networking_odl project)'
71 name: patches-to-build-parameter
74 name: PATCHES_TO_BUILD
76 description: 'csv list of patches in project:changeset format to build distribution with'
79 name: distribution-branch-to-build-parameter
82 name: DISTRIBUTION_BRANCH_TO_BUILD
84 description: 'distribution repo branch to build with'
92 description: 'Nexus staging profile id'
95 name: stage-id-parameter
98 name: STAGING_PROFILE_ID
100 description: 'Nexus staging profile id'
107 default: '/w/tools/hudson.tasks.Maven_MavenInstallation/{maven-version}/bin/mvn'
108 description: 'Maven selector to be used by shell scripts'
114 credentials-id: 'opendaylight-jenkins-ssh'
123 name: git-scm-with-submodules
126 credentials-id: 'opendaylight-jenkins-ssh'
130 - 'refs/heads/{branch}'
137 name: gerrit-trigger-scm
140 credentials-id: 'opendaylight-jenkins-ssh'
144 - 'origin/$GERRIT_BRANCH'
146 choosing-strategy: '{choosing-strategy}'
156 # This is a single macro to use for all jobs who vote on every (relevant) patch set.
157 # Only 'recheck' trigger word is supported, it always triggers the full set of relevant jobs,
158 # in order to prevent Jenkins from starting only a subset and still voting Verified+1.
160 # server: name of gerrit server to listen to
161 # project: pattern to match triggering projects
162 # branch: triggering branch name
163 # files: pattern to match triggering filepaths
165 name: gerrit-trigger-patch-submitted
168 server-name: '{server}'
170 - patchset-created-event:
172 exclude-trivial-rebase: false
173 exclude-no-code-change: false
174 - draft-published-event
175 - comment-added-contains-event:
176 comment-contains-value: recheck
178 - project-compare-type: ANT
179 project-pattern: '{project}'
181 - branch-compare-type: ANT
182 branch-pattern: '**/{branch}'
187 # TODO: Unify argument names across gerrit-trigger-* macros.
189 name: gerrit-trigger-patch-merged
192 server-name: '{server-name}'
194 - change-merged-event
195 - comment-added-contains-event:
196 comment-contains-value: 'remerge'
198 - project-compare-type: 'ANT'
199 project-pattern: '{name}'
201 - branch-compare-type: 'ANT'
202 branch-pattern: '**/{branch}'
208 # Force Jenkins always vote the values it should already have voted
209 # during the prior verify phase
211 gerrit-build-started-verified-value: 1
212 gerrit-build-successful-verified-value: 1
213 gerrit-build-failed-verified-value: 1
214 gerrit-build-unstable-verified-value: 1
215 gerrit-build-notbuilt-verified-value: 1
216 gerrit-build-started-codereview-value: 0
217 gerrit-build-successful-codereview-value: 0
218 gerrit-build-failed-codereview-value: 0
219 gerrit-build-unstable-codereview-value: 0
220 gerrit-build-notbuilt-codereview-value: 0
222 # TODO: Unify argument names across gerrit-trigger-* macros.
224 name: gerrit-trigger-patch-sonar
227 server-name: '{server-name}'
229 - comment-added-contains-event:
230 comment-contains-value: 'run-sonar'
232 - project-compare-type: 'ANT'
233 project-pattern: '{name}'
235 - branch-compare-type: 'ANT'
236 branch-pattern: '**/master'
244 name: archive-artifacts
247 artifacts: '{artifacts}'
253 name: email-notification
256 recipients: '{email-recipients}'
258 content-type: default
259 subject: '{email-prefix} $PROJECT_NAME - Build # $BUILD_NUMBER - $BUILD_STATUS!'
261 $PROJECT_NAME - Build # $BUILD_NUMBER - $BUILD_STATUS:
263 Please refer to the logs server URL for console logs when possible
264 and use the Jenkins Build URL as a last resort.
267 https://logs.opendaylight.org/$SILO/$JENKINS_HOSTNAME/$JOB_NAME/$BUILD_NUMBER
280 exec-pattern: "**/**.exec"
281 class-pattern: "**/classes"
282 source-pattern: "**/src/main/java"
283 exclusion-pattern: "**/gen/**,**/generated-sources/**,**/yang-gen**,**/pax/**"
294 name: opendaylight-infra-shiplogs
295 # To archive things the job will need to create a "archives" directory in
296 # the workspace and this macro will handle copying the contents of the
297 # archives directory.
299 # Uses the build parameter ARCHIVE_ARTIFACTS if not empty to find files
300 # to archive. You can pass globstar patterns for example "**/*.xml **/*.log"
301 # as the archive pattern. This is a space separated list of files to archive.
303 # Also ensure that the workspace is cleaned up at the end of the build.
307 - shell: !include-raw: include-raw-stack-delete.sh
308 - shell: !include-raw-escape: include-raw-deploy-archives.sh
310 maven-version: '{maven-version}'
311 pom: '.archives/deploy-archives.xml'
312 goals: 'clean deploy -V -B -q -Dmaven.repo.local=/tmp/r'
313 settings: 'jenkins-log-archives-settings'
315 global-settings: 'odl-global-settings'
316 global-settings-type: cfp
317 - description-setter:
318 regexp: '^Build logs: .*'
319 # Cleanup after ourselves
320 - wipe-org-opendaylight-repo
321 script-only-if-succeeded: false
322 script-only-if-failed: false
323 mark-unstable-if-failed: true
326 # Do not clean up *.jenkins-trigger files for jobs that use a
327 # properties file as input for triggering another build.
328 - '**/*.jenkins-trigger'
332 name: opendaylight-infra-stack
333 # opendaylight-infra-stack.sh has a required variable {stack-template} that
334 # must be passed into this macro.
336 - shell: !include-raw: opendaylight-infra-stack.sh
337 - shell: !include-raw-escape: opendaylight-infra-copy-ssh-keys.sh
340 name: opendaylight-infra-push-gerrit-patch
341 # opendaylight-infra-push-gerrit-patch.sh allows a job to push a patch to
342 # Gerrit in an automated fashion. This is meant for tasks that creates
343 # the same patch regularly and needs the ability to detect if an unreviewed
344 # patch already exists. In which case it will update the existing patch.
346 # Note: This patch assumes the $WORKSPACE contains the project repo with
347 # the files changed already "git add" and waiting for a "git commit" call.
349 # This script requires the following JJB variables to be passed in:
350 # {project} Gerrit project-name
351 # {gerrit-topic} Gerrit topic, please make a unique topic.
352 # {gerrit-commit-message} Commit message to assign to commit.
353 # NOTE: Requires git review to be installed on node.
355 - shell: !include-raw: opendaylight-infra-push-gerrit-patch.sh
358 name: distribute-build-url
359 # Place URL of the current run of a build job to a file at given path.
361 - shell: 'echo "$BUILD_URL" > {path}/build.url'
364 name: wipe-org-opendaylight-repo
366 - shell: 'if [ -d /tmp/r/org/opendaylight ]; then rm -rf /tmp/r/org/opendaylight; fi'
369 name: wipe-local-maven-repo
371 - shell: 'if [ -d /tmp/r ]; then rm -rf /tmp/r; fi'
374 name: jacoco-nojava-workaround
376 - shell: 'mkdir -p $WORKSPACE/target/classes $WORKSPACE/jacoco/classes'
382 application-name: '{application-name}'
385 name: releng-check-unicode
388 $WORKSPACE/scripts/check-unicode.sh jjb/
391 name: provide-maven-settings
393 - config-file-provider:
395 - file-id: '{global-settings-file}'
396 variable: 'GLOBAL_SETTINGS_FILE'
397 - file-id: '{settings-file}'
398 variable: 'SETTINGS_FILE'
401 name: releng-fetch-p2zip-if-necessary
404 # Cleanup any existing zips and metadata before we download the new update site
407 condition-kind: strings-match
408 condition-string1: '$P2ZIP_URL'
409 condition-string2: ''
410 condition-basedir: workspace
412 # TODO: Figure out latest snapshot version number to pull rather than hardcoding 1.1.1-SNAPSHOT
414 maven-version: '{maven-version}'
416 org.apache.maven.plugins:maven-dependency-plugin:get
417 org.apache.maven.plugins:maven-dependency-plugin:copy
419 -Dartifact=org.opendaylight.yangide:org.opendaylight.yangide.update-site:1.1.1-SNAPSHOT:zip
420 -DoutputDirectory=$WORKSPACE
421 settings: '{settings}'
422 global-settings: '{global-settings}'
425 name: releng-generate-p2pom
427 - shell: !include-raw: include-raw-generate-p2pom.sh
430 name: releng-update-p2composite-metadata
432 - shell: !include-raw: include-raw-update-p2composite-metadata.sh
434 condition-kind: file-exists
435 condition-filename: deploy-composite-repo.xml
436 condition-basedir: workspace
439 maven-version: '{maven-version}'
440 pom: 'deploy-composite-repo.xml'
441 goals: 'clean deploy -V -B -Dmaven.repo.local=/tmp/r'
442 settings: '{settings}'
443 global-settings: '{global-settings}'
446 name: releng-stage-release
448 - shell: !include-raw: include-raw-stage-release.sh
451 # This wrapper is required for all jobs as it configures the wrappers
452 # needed by OpenDaylight infra.
453 name: opendaylight-infra-wrappers
456 - config-file-provider:
458 - file-id: rackspace-heat
459 target: '$HOME/.config/openstack/clouds.yaml'
462 timeout: '{build-timeout}'
463 timeout-var: 'BUILD_TIMEOUT'
466 - ssh-agent-credentials:
468 - 'opendaylight-jenkins-ssh'
473 name: packer-validate
475 - config-file-provider:
477 - file-id: 'packer-cloud-env'
481 varfiles="../packer/vars/*"
482 templates="../packer/templates/*"
483 provision="../packer/provision/*.sh"
484 for v in $varfiles; do
485 [[ "${v##*/}" =~ ^(cloud-env.*)$ ]] && continue
486 for t in $templates; do
487 export PACKER_LOG="yes" && \
488 export PACKER_LOG_PATH="packer-validate-${v##*/}-${t##*/}.log" && \
489 packer.io validate -var-file=$CLOUDENV \
491 if [ $? -ne 0 ]; then
496 for p in $provision; do
497 /bin/bash -n $p > provision-validate-${p##*/}.log 2>&1
504 - config-file-provider:
506 - file-id: 'packer-cloud-env'
510 export PACKER_LOG="yes" && \
511 export PACKER_LOG_PATH="packer-build.log" && \
512 packer.io build -color=false -var-file=$CLOUDENV \
513 -var-file=../packer/vars/{platform}.json \
514 ../packer/templates/{template}.json
517 # TODO: Verify signature after downloading users public key from a locally created
518 # repository instead of the public keymesh. This requires a process in place to get ODL
519 # developers public keys into a local repository without increasing the job thoughput.
520 name: verify-gpg-signature
522 - shell: !include-raw: include-raw-verify-gpg-signatures.sh
525 name: opendaylight-infra-jjbini
527 - config-file-provider:
530 target: '$HOME/.config/jenkins_jobs/jenkins_jobs.ini'
533 name: distribution-check-wipe
534 # Step zero: Wipe file repositories up front.
537 echo "wipe r: the local Maven repository"
539 echo "wipe n: the fake remote (Nexus) repository"
541 echo "wipe t: the transient repository used in some manipulations"
545 name: distribution-check-build-project
546 # Step one: Online build of the project, using local repository /tmp/r/ and deploying artifacts to /tmp/n/.
547 # Ordinary SingleFeatureTest failures are detected in the verify job, so we can use "q" profile here.
549 # pom: Relative path to pom file to use. Typically '$GERRIT_PROJECT/pom.xml'.
552 maven-version: 'mvn33'
555 clean deploy dependency:tree
556 -DoutputFile=dependency_tree.txt
559 -DaltDeploymentRepository=fake-nexus::default::file:///tmp/n/
560 -Dmaven.repo.local=/tmp/r
561 -Dorg.ops4j.pax.url.mvn.localRepository=/tmp/r
563 - '-Xmx4096m -XX:MaxPermSize=1024m -Dmaven.compile.fork=true'
564 settings: 'integration-settings'
566 global-settings: 'odl-global-settings'
567 global-settings-type: cfp
570 name: distribution-check-verify-groupid
571 # Step two: Verify all deployed artifacts belong to the project's groupId.
572 # This is done by moving the allowed directories out of /tmp/n and checking no files remained there.
573 # The correct directory is derived from $GERRIT_PROJECT.
574 # TODO: Verify all deployed artifacts are snapshots.
576 # gerrit-project: Project name as nexus URI part. Typically '$GERRIT_PROJECT'.
579 mkdir -p /tmp/t/org/opendaylight/{gerrit-project}
580 mv /tmp/n/org/opendaylight/{gerrit-project}/* /tmp/t/org/opendaylight/{gerrit-project}/
581 test -z "`find /tmp/n/ -type f`" || ( echo "ERROR: Mismatched groupId detected (see above)." && false )
586 name: distribution-check-download-deps
587 # Step three: Online build of integration distribution.
588 # This step is mainly used for downloading other project artifacts.
589 # Running SingleFeaturesTest here does not seem to be required, so -Pq is used again.
591 # dist-pom: Relative path to pom file to use. 'distribution/pom.xml' is recommended.
594 maven-version: 'mvn33'
597 clean install dependency:tree
598 -DoutputFile=dependency_tree.txt
601 -Dmaven.repo.local=/tmp/r
602 -Dorg.ops4j.pax.url.mvn.localRepository=/tmp/r
604 - '-Xmx1024m -XX:MaxPermSize=256m -Dmaven.compile.fork=true'
605 settings: 'integration-settings'
607 global-settings: 'odl-global-settings'
608 global-settings-type: cfp
611 name: distribution-check-delete-snapshots
612 # Step four: Delete snapshot artifacts from the local repository.
613 # This is critical to detect orphaned artifacts or missing project-internal dependency declarations.
614 # Also other files related to maven repository resolution are removed,
615 # and then empty directories are removed, in order to simplify debugging.
617 - shell: !include-raw-escape: integration-distribution-delete-snaphot-artifacts.sh
620 name: distribution-check-configure-remotes
621 # Now the ugly part. It seems that the only way to tell Maven 2+
622 # which remote repositories to use is via settings.xml file.
623 # So we create such a file here, but it needs most of odlparent:settings.xml
627 <settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
628 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
629 xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
630 https://maven.apache.org/xsd/settings-1.0.0.xsd">
633 <id>opendaylight-release</id>
636 <id>opendaylight-mirror</id>
637 <name>opendaylight</name>
638 <url>https://nexus.opendaylight.org/content/repositories/public/</url>
639 <releases><updatePolicy>never</updatePolicy></releases>
640 <snapshots><enabled>false</enabled></snapshots>
645 <id>opendaylight-plugin-mirror</id>
646 <name>opendaylight-plugin</name>
647 <url>https://nexus.opendaylight.org/content/repositories/public/</url>
648 <releases><updatePolicy>never</updatePolicy></releases>
649 <snapshots><enabled>false</enabled></snapshots>
651 </pluginRepositories>
654 <id>file-snapshots</id>
657 <id>file-snapshots</id>
659 <url>file:///tmp/n/</url>
660 <releases><enabled>false</enabled></releases>
665 <id>file-plugin-snapshots</id>
666 <name>file-plugin</name>
667 <url>file:///tmp/n/</url>
668 <releases><enabled>false</enabled></releases>
670 </pluginRepositories>
674 <activeProfile>file-snapshots</activeProfile>
675 <activeProfile>opendaylight-release</activeProfile>
679 # Notes: The settings are minimal in order to detect breakage scenarios,
680 # while allowing for the following quirks:
681 # * Some plugins seem to have hardcoded repos, for example check-license looks at repository.apache.org
682 # * Some plugin artifacts (related to surefire) are not downloaded when tests are skipped.
683 # * populate-local-repo looks at oss.sonatype.org and does not store things (like guava) to /tmp/r
686 name: distribution-check-repeat-build
687 # Step five: Repeat the distribution build but with the new settings.
688 # Here, only the project snapshot artifacts deployed to /tmp/n are available,
689 # which faithfully reproduces conditions in later verify-like job runs.
690 # We cannot use --offline, because: "Cannot access file (file:///tmp/n) in offline mode"
691 # This is where SingleFeatureTest is not skipped.
693 # dist-pom: Relative path to pom file to use. 'distribution/pom.xml' is recommended.
696 maven-version: 'mvn33'
699 clean install dependency:tree
700 -DoutputFile=dependency_tree.txt -s fake_remotes.xml
704 -Dmaven.repo.local=/tmp/r
705 -Dorg.ops4j.pax.url.mvn.localRepository=/tmp/r
707 - '-Xmx1024m -XX:MaxPermSize=256m -Dmaven.compile.fork=true'