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. OS_CLOUD is a
52 variable name that is significant to openstack client as a
53 environment variable. Please refer to the documentation for
55 https://docs.openstack.org/developer/python-openstackclient/
63 description: 'Tag in Git to checkout'
66 name: controller-version-parameter
70 default: '{odl_version}'
71 description: 'Controller version (for use with openstacks networking_odl project)'
74 name: patches-to-build-parameter
77 name: PATCHES_TO_BUILD
79 description: 'csv list of patches in project:changeset format to build distribution with'
82 name: distribution-branch-to-build-parameter
85 name: DISTRIBUTION_BRANCH_TO_BUILD
87 description: 'distribution repo branch to build with'
95 description: 'Nexus staging profile id'
98 name: stage-id-parameter
101 name: STAGING_PROFILE_ID
102 default: '{stage-id}'
103 description: 'Nexus staging profile id'
110 default: '/w/tools/hudson.tasks.Maven_MavenInstallation/{maven-version}/bin/mvn'
111 description: 'Maven selector to be used by shell scripts'
117 credentials-id: 'opendaylight-jenkins-ssh'
126 name: git-scm-with-submodules
129 credentials-id: 'opendaylight-jenkins-ssh'
133 - 'refs/heads/{branch}'
140 name: gerrit-trigger-scm
143 credentials-id: 'opendaylight-jenkins-ssh'
147 - 'origin/$GERRIT_BRANCH'
149 choosing-strategy: '{choosing-strategy}'
159 # This is a single macro to use for all jobs who vote on every (relevant) patch set.
160 # Only 'recheck' trigger word is supported, it always triggers the full set of relevant jobs,
161 # in order to prevent Jenkins from starting only a subset and still voting Verified+1.
163 # server: name of gerrit server to listen to
164 # project: pattern to match triggering projects
165 # branch: triggering branch name
166 # files: pattern to match triggering filepaths
168 name: gerrit-trigger-patch-submitted
171 server-name: '{server}'
173 - patchset-created-event:
175 exclude-trivial-rebase: false
176 exclude-no-code-change: false
177 - draft-published-event
178 - comment-added-contains-event:
179 comment-contains-value: recheck
181 - project-compare-type: ANT
182 project-pattern: '{project}'
184 - branch-compare-type: ANT
185 branch-pattern: '**/{branch}'
190 # TODO: Unify argument names across gerrit-trigger-* macros.
192 name: gerrit-trigger-patch-merged
195 server-name: '{server-name}'
197 - change-merged-event
198 - comment-added-contains-event:
199 comment-contains-value: 'remerge'
201 - project-compare-type: 'ANT'
202 project-pattern: '{name}'
204 - branch-compare-type: 'ANT'
205 branch-pattern: '**/{branch}'
211 # Force Jenkins always vote the values it should already have voted
212 # during the prior verify phase
214 gerrit-build-started-verified-value: 1
215 gerrit-build-successful-verified-value: 1
216 gerrit-build-failed-verified-value: 1
217 gerrit-build-unstable-verified-value: 1
218 gerrit-build-notbuilt-verified-value: 1
219 gerrit-build-started-codereview-value: 0
220 gerrit-build-successful-codereview-value: 0
221 gerrit-build-failed-codereview-value: 0
222 gerrit-build-unstable-codereview-value: 0
223 gerrit-build-notbuilt-codereview-value: 0
225 # TODO: Unify argument names across gerrit-trigger-* macros.
227 name: gerrit-trigger-patch-sonar
230 server-name: '{server-name}'
232 - comment-added-contains-event:
233 comment-contains-value: 'run-sonar'
235 - project-compare-type: 'ANT'
236 project-pattern: '{name}'
238 - branch-compare-type: 'ANT'
239 branch-pattern: '**/master'
247 name: archive-artifacts
250 artifacts: '{artifacts}'
256 name: email-notification
259 recipients: '{email-recipients}'
261 content-type: default
262 subject: '{email-prefix} $PROJECT_NAME - Build # $BUILD_NUMBER - $BUILD_STATUS!'
264 $PROJECT_NAME - Build # $BUILD_NUMBER - $BUILD_STATUS:
266 Please refer to the logs server URL for console logs when possible
267 and use the Jenkins Build URL as a last resort.
270 https://logs.opendaylight.org/$SILO/$JENKINS_HOSTNAME/$JOB_NAME/$BUILD_NUMBER
283 exec-pattern: "**/**.exec"
284 class-pattern: "**/classes"
285 source-pattern: "**/src/main/java"
286 exclusion-pattern: "**/gen/**,**/generated-sources/**,**/yang-gen**,**/pax/**"
297 name: opendaylight-infra-shiplogs
298 # To archive things the job will need to create a "archives" directory in
299 # the workspace and this macro will handle copying the contents of the
300 # archives directory.
302 # Uses the build parameter ARCHIVE_ARTIFACTS if not empty to find files
303 # to archive. You can pass globstar patterns for example "**/*.xml **/*.log"
304 # as the archive pattern. This is a space separated list of files to archive.
306 # Also ensure that the workspace is cleaned up at the end of the build.
310 - shell: !include-raw: include-raw-stack-delete.sh
311 - shell: !include-raw-escape: include-raw-deploy-archives.sh
313 maven-version: '{maven-version}'
314 pom: '.archives/deploy-archives.xml'
315 goals: 'clean deploy -V -B -q -Dmaven.repo.local=/tmp/r'
316 settings: 'jenkins-log-archives-settings'
318 global-settings: 'odl-global-settings'
319 global-settings-type: cfp
320 - description-setter:
321 regexp: '^Build logs: .*'
322 # Cleanup after ourselves
323 - wipe-org-opendaylight-repo
324 script-only-if-succeeded: false
325 script-only-if-failed: false
326 mark-unstable-if-failed: true
329 # Do not clean up *.jenkins-trigger files for jobs that use a
330 # properties file as input for triggering another build.
331 - '**/*.jenkins-trigger'
335 name: opendaylight-infra-stack
336 # opendaylight-infra-stack.sh has a required variable {stack-template} that
337 # must be passed into this macro.
339 - shell: !include-raw: opendaylight-infra-stack.sh
340 - shell: !include-raw-escape: opendaylight-infra-copy-ssh-keys.sh
343 name: opendaylight-infra-push-gerrit-patch
344 # opendaylight-infra-push-gerrit-patch.sh allows a job to push a patch to
345 # Gerrit in an automated fashion. This is meant for tasks that creates
346 # the same patch regularly and needs the ability to detect if an unreviewed
347 # patch already exists. In which case it will update the existing patch.
349 # Note: This patch assumes the $WORKSPACE contains the project repo with
350 # the files changed already "git add" and waiting for a "git commit" call.
352 # This script requires the following JJB variables to be passed in:
353 # {project} Gerrit project-name
354 # {gerrit-topic} Gerrit topic, please make a unique topic.
355 # {gerrit-commit-message} Commit message to assign to commit.
356 # NOTE: Requires git review to be installed on node.
358 - shell: !include-raw: opendaylight-infra-push-gerrit-patch.sh
361 name: distribute-build-url
362 # Place URL of the current run of a build job to a file at given path.
364 - shell: 'echo "$BUILD_URL" > {path}/build.url'
367 name: wipe-org-opendaylight-repo
369 - shell: 'if [ -d /tmp/r/org/opendaylight ]; then rm -rf /tmp/r/org/opendaylight; fi'
372 name: wipe-local-maven-repo
374 - shell: 'if [ -d /tmp/r ]; then rm -rf /tmp/r; fi'
377 name: jacoco-nojava-workaround
379 - shell: 'mkdir -p $WORKSPACE/target/classes $WORKSPACE/jacoco/classes'
385 application-name: '{application-name}'
388 name: releng-check-unicode
391 $WORKSPACE/scripts/check-unicode.sh jjb/
394 name: provide-maven-settings
396 - config-file-provider:
398 - file-id: '{global-settings-file}'
399 variable: 'GLOBAL_SETTINGS_FILE'
400 - file-id: '{settings-file}'
401 variable: 'SETTINGS_FILE'
404 name: releng-fetch-p2zip-if-necessary
407 # Cleanup any existing zips and metadata before we download the new update site
410 condition-kind: strings-match
411 condition-string1: '$P2ZIP_URL'
412 condition-string2: ''
413 condition-basedir: workspace
415 # TODO: Figure out latest snapshot version number to pull rather than hardcoding 1.1.1-SNAPSHOT
417 maven-version: '{maven-version}'
419 org.apache.maven.plugins:maven-dependency-plugin:get
420 org.apache.maven.plugins:maven-dependency-plugin:copy
422 -Dartifact=org.opendaylight.yangide:org.opendaylight.yangide.update-site:1.1.1-SNAPSHOT:zip
423 -DoutputDirectory=$WORKSPACE
424 settings: '{settings}'
425 global-settings: '{global-settings}'
428 name: releng-generate-p2pom
430 - shell: !include-raw: include-raw-generate-p2pom.sh
433 name: releng-update-p2composite-metadata
435 - shell: !include-raw: include-raw-update-p2composite-metadata.sh
437 condition-kind: file-exists
438 condition-filename: deploy-composite-repo.xml
439 condition-basedir: workspace
442 maven-version: '{maven-version}'
443 pom: 'deploy-composite-repo.xml'
444 goals: 'clean deploy -V -B -Dmaven.repo.local=/tmp/r'
445 settings: '{settings}'
446 global-settings: '{global-settings}'
449 name: releng-stage-release
451 - shell: !include-raw: include-raw-stage-release.sh
454 # This wrapper is required for all jobs as it configures the wrappers
455 # needed by OpenDaylight infra.
456 name: opendaylight-infra-wrappers
459 - config-file-provider:
461 - file-id: rackspace-heat
462 target: '$HOME/.config/openstack/clouds.yaml'
465 timeout: '{build-timeout}'
466 timeout-var: 'BUILD_TIMEOUT'
469 - ssh-agent-credentials:
471 - 'opendaylight-jenkins-ssh'
476 name: packer-validate
478 - config-file-provider:
480 - file-id: 'packer-cloud-env'
484 varfiles="../packer/vars/*"
485 templates="../packer/templates/*"
486 provision="../packer/provision/*.sh"
487 for v in $varfiles; do
488 [[ "${v##*/}" =~ ^(cloud-env.*)$ ]] && continue
489 for t in $templates; do
490 export PACKER_LOG="yes" && \
491 export PACKER_LOG_PATH="packer-validate-${v##*/}-${t##*/}.log" && \
492 packer.io validate -var-file=$CLOUDENV \
494 if [ $? -ne 0 ]; then
499 for p in $provision; do
500 /bin/bash -n $p > provision-validate-${p##*/}.log 2>&1
507 - config-file-provider:
509 - file-id: 'packer-cloud-env'
513 export PACKER_LOG="yes" && \
514 export PACKER_LOG_PATH="packer-build.log" && \
515 packer.io build -color=false -var-file=$CLOUDENV \
516 -var-file=../packer/vars/{platform}.json \
517 ../packer/templates/{template}.json
520 # TODO: Verify signature after downloading users public key from a locally created
521 # repository instead of the public keymesh. This requires a process in place to get ODL
522 # developers public keys into a local repository without increasing the job thoughput.
523 name: verify-gpg-signature
525 - shell: !include-raw: include-raw-verify-gpg-signatures.sh
528 name: opendaylight-infra-jjbini
530 - config-file-provider:
533 target: '$HOME/.config/jenkins_jobs/jenkins_jobs.ini'
536 name: distribution-check-wipe
537 # Step zero: Wipe file repositories up front.
540 echo "wipe r: the local Maven repository"
542 echo "wipe n: the fake remote (Nexus) repository"
544 echo "wipe t: the transient repository used in some manipulations"
548 name: distribution-check-build-project
549 # Step one: Online build of the project, using local repository /tmp/r/ and deploying artifacts to /tmp/n/.
550 # Ordinary SingleFeatureTest failures are detected in the verify job, so we can use "q" profile here.
552 # pom: Relative path to pom file to use. Typically '$GERRIT_PROJECT/pom.xml'.
555 maven-version: 'mvn33'
558 clean deploy dependency:tree
559 -DoutputFile=dependency_tree.txt
562 -DaltDeploymentRepository=fake-nexus::default::file:///tmp/n/
563 -Dmaven.repo.local=/tmp/r
564 -Dorg.ops4j.pax.url.mvn.localRepository=/tmp/r
566 - '-Xmx4096m -XX:MaxPermSize=1024m -Dmaven.compile.fork=true'
567 settings: 'integration-settings'
569 global-settings: 'odl-global-settings'
570 global-settings-type: cfp
573 name: distribution-check-verify-groupid
574 # Step two: Verify all deployed artifacts belong to the project's groupId.
575 # This is done by moving the allowed directories out of /tmp/n and checking no files remained there.
576 # The correct directory is derived from $GERRIT_PROJECT.
577 # TODO: Verify all deployed artifacts are snapshots.
579 # gerrit-project: Project name as nexus URI part. Typically '$GERRIT_PROJECT'.
582 mkdir -p /tmp/t/org/opendaylight/{gerrit-project}
583 mv /tmp/n/org/opendaylight/{gerrit-project}/* /tmp/t/org/opendaylight/{gerrit-project}/
584 test -z "`find /tmp/n/ -type f`" || ( echo "ERROR: Mismatched groupId detected (see above)." && false )
589 name: distribution-check-download-deps
590 # Step three: Online build of integration distribution.
591 # This step is mainly used for downloading other project artifacts.
592 # Running SingleFeaturesTest here does not seem to be required, so -Pq is used again.
594 # dist-pom: Relative path to pom file to use. 'distribution/pom.xml' is recommended.
597 maven-version: 'mvn33'
600 clean install dependency:tree
601 -DoutputFile=dependency_tree.txt
604 -Dmaven.repo.local=/tmp/r
605 -Dorg.ops4j.pax.url.mvn.localRepository=/tmp/r
607 - '-Xmx1024m -XX:MaxPermSize=256m -Dmaven.compile.fork=true'
608 settings: 'integration-settings'
610 global-settings: 'odl-global-settings'
611 global-settings-type: cfp
614 name: distribution-check-delete-snapshots
615 # Step four: Delete snapshot artifacts from the local repository.
616 # This is critical to detect orphaned artifacts or missing project-internal dependency declarations.
617 # Also other files related to maven repository resolution are removed,
618 # and then empty directories are removed, in order to simplify debugging.
620 - shell: !include-raw-escape: integration-distribution-delete-snaphot-artifacts.sh
623 name: distribution-check-configure-remotes
624 # Now the ugly part. It seems that the only way to tell Maven 2+
625 # which remote repositories to use is via settings.xml file.
626 # So we create such a file here, but it needs most of odlparent:settings.xml
630 <settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
631 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
632 xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
633 https://maven.apache.org/xsd/settings-1.0.0.xsd">
636 <id>opendaylight-release</id>
639 <id>opendaylight-mirror</id>
640 <name>opendaylight</name>
641 <url>https://nexus.opendaylight.org/content/repositories/public/</url>
642 <releases><updatePolicy>never</updatePolicy></releases>
643 <snapshots><enabled>false</enabled></snapshots>
648 <id>opendaylight-plugin-mirror</id>
649 <name>opendaylight-plugin</name>
650 <url>https://nexus.opendaylight.org/content/repositories/public/</url>
651 <releases><updatePolicy>never</updatePolicy></releases>
652 <snapshots><enabled>false</enabled></snapshots>
654 </pluginRepositories>
657 <id>file-snapshots</id>
660 <id>file-snapshots</id>
662 <url>file:///tmp/n/</url>
663 <releases><enabled>false</enabled></releases>
668 <id>file-plugin-snapshots</id>
669 <name>file-plugin</name>
670 <url>file:///tmp/n/</url>
671 <releases><enabled>false</enabled></releases>
673 </pluginRepositories>
677 <activeProfile>file-snapshots</activeProfile>
678 <activeProfile>opendaylight-release</activeProfile>
682 # Notes: The settings are minimal in order to detect breakage scenarios,
683 # while allowing for the following quirks:
684 # * Some plugins seem to have hardcoded repos, for example check-license looks at repository.apache.org
685 # * Some plugin artifacts (related to surefire) are not downloaded when tests are skipped.
686 # * populate-local-repo looks at oss.sonatype.org and does not store things (like guava) to /tmp/r
689 name: distribution-check-repeat-build
690 # Step five: Repeat the distribution build but with the new settings.
691 # Here, only the project snapshot artifacts deployed to /tmp/n are available,
692 # which faithfully reproduces conditions in later verify-like job runs.
693 # We cannot use --offline, because: "Cannot access file (file:///tmp/n) in offline mode"
694 # This is where SingleFeatureTest is not skipped.
696 # dist-pom: Relative path to pom file to use. 'distribution/pom.xml' is recommended.
699 maven-version: 'mvn33'
702 clean install dependency:tree
703 -DoutputFile=dependency_tree.txt -s fake_remotes.xml
707 -Dmaven.repo.local=/tmp/r
708 -Dorg.ops4j.pax.url.mvn.localRepository=/tmp/r
710 - '-Xmx1024m -XX:MaxPermSize=256m -Dmaven.compile.fork=true'