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: run-test-parameter
84 description: 'Set true to run test after build'
87 name: distribution-branch-to-build-parameter
90 name: DISTRIBUTION_BRANCH_TO_BUILD
92 description: 'distribution repo branch to build with'
100 description: 'Nexus staging profile id'
103 name: stage-id-parameter
106 name: STAGING_PROFILE_ID
107 default: '{stage-id}'
108 description: 'Nexus staging profile id'
115 default: '/w/tools/hudson.tasks.Maven_MavenInstallation/{maven-version}/bin/mvn'
116 description: 'Maven selector to be used by shell scripts'
122 credentials-id: 'opendaylight-jenkins-ssh'
131 name: git-scm-with-submodules
134 credentials-id: 'opendaylight-jenkins-ssh'
138 - 'refs/heads/{branch}'
145 name: gerrit-trigger-scm
148 credentials-id: 'opendaylight-jenkins-ssh'
152 - 'origin/$GERRIT_BRANCH'
154 choosing-strategy: '{choosing-strategy}'
164 # This is a single macro to use for all jobs who vote on every (relevant) patch set.
165 # Only 'recheck' trigger word is supported, it always triggers the full set of relevant jobs,
166 # in order to prevent Jenkins from starting only a subset and still voting Verified+1.
168 # server: name of gerrit server to listen to
169 # project: pattern to match triggering projects
170 # branch: triggering branch name
171 # files: pattern to match triggering filepaths
173 name: gerrit-trigger-patch-submitted
176 server-name: '{server}'
178 - patchset-created-event:
180 exclude-trivial-rebase: false
181 exclude-no-code-change: false
182 - draft-published-event
183 - comment-added-contains-event:
184 comment-contains-value: recheck
186 - project-compare-type: ANT
187 project-pattern: '{project}'
189 - branch-compare-type: ANT
190 branch-pattern: '**/{branch}'
195 # TODO: Unify argument names across gerrit-trigger-* macros.
197 name: gerrit-trigger-patch-merged
200 server-name: '{server-name}'
202 - change-merged-event
203 - comment-added-contains-event:
204 comment-contains-value: 'remerge'
206 - project-compare-type: 'ANT'
207 project-pattern: '{name}'
209 - branch-compare-type: 'ANT'
210 branch-pattern: '**/{branch}'
216 # Force Jenkins always vote the values it should already have voted
217 # during the prior verify phase
219 gerrit-build-started-verified-value: 1
220 gerrit-build-successful-verified-value: 1
221 gerrit-build-failed-verified-value: 1
222 gerrit-build-unstable-verified-value: 1
223 gerrit-build-notbuilt-verified-value: 1
224 gerrit-build-started-codereview-value: 0
225 gerrit-build-successful-codereview-value: 0
226 gerrit-build-failed-codereview-value: 0
227 gerrit-build-unstable-codereview-value: 0
228 gerrit-build-notbuilt-codereview-value: 0
230 # TODO: Unify argument names across gerrit-trigger-* macros.
232 name: gerrit-trigger-patch-sonar
235 server-name: '{server-name}'
237 - comment-added-contains-event:
238 comment-contains-value: 'run-sonar'
240 - project-compare-type: 'ANT'
241 project-pattern: '{name}'
243 - branch-compare-type: 'ANT'
244 branch-pattern: '**/master'
252 name: archive-artifacts
255 artifacts: '{artifacts}'
261 name: email-notification
264 recipients: '{email-recipients}'
266 content-type: default
267 subject: '{email-prefix} $PROJECT_NAME - Build # $BUILD_NUMBER - $BUILD_STATUS!'
269 $PROJECT_NAME - Build # $BUILD_NUMBER - $BUILD_STATUS:
271 Please refer to the logs server URL for console logs when possible
272 and use the Jenkins Build URL as a last resort.
275 https://logs.opendaylight.org/$SILO/$JENKINS_HOSTNAME/$JOB_NAME/$BUILD_NUMBER
288 exec-pattern: "**/**.exec"
289 class-pattern: "**/classes"
290 source-pattern: "**/src/main/java"
291 exclusion-pattern: "**/gen/**,**/generated-sources/**,**/yang-gen**,**/pax/**"
302 name: opendaylight-infra-shiplogs
303 # To archive things the job will need to create a "archives" directory in
304 # the workspace and this macro will handle copying the contents of the
305 # archives directory.
307 # Uses the build parameter ARCHIVE_ARTIFACTS if not empty to find files
308 # to archive. You can pass globstar patterns for example "**/*.xml **/*.log"
309 # as the archive pattern. This is a space separated list of files to archive.
311 # Also ensure that the workspace is cleaned up at the end of the build.
315 - shell: !include-raw: include-raw-stack-delete.sh
316 - shell: !include-raw-escape: include-raw-deploy-archives.sh
318 maven-version: '{maven-version}'
319 pom: '.archives/deploy-archives.xml'
320 goals: 'clean deploy -V -B -q -Dmaven.repo.local=/tmp/r'
321 settings: 'jenkins-log-archives-settings'
323 global-settings: 'odl-global-settings'
324 global-settings-type: cfp
325 - description-setter:
326 regexp: '^Build logs: .*'
327 # Cleanup after ourselves
328 - wipe-org-opendaylight-repo
329 script-only-if-succeeded: false
330 script-only-if-failed: false
331 mark-unstable-if-failed: true
334 # Do not clean up *.jenkins-trigger files for jobs that use a
335 # properties file as input for triggering another build.
336 - '**/*.jenkins-trigger'
340 name: opendaylight-infra-stack
341 # opendaylight-infra-stack.sh has a required variable {stack-template} that
342 # must be passed into this macro.
344 - shell: !include-raw: opendaylight-infra-stack.sh
345 - shell: !include-raw-escape: opendaylight-infra-copy-ssh-keys.sh
348 name: opendaylight-infra-push-gerrit-patch
349 # opendaylight-infra-push-gerrit-patch.sh allows a job to push a patch to
350 # Gerrit in an automated fashion. This is meant for tasks that creates
351 # the same patch regularly and needs the ability to detect if an unreviewed
352 # patch already exists. In which case it will update the existing patch.
354 # Note: This patch assumes the $WORKSPACE contains the project repo with
355 # the files changed already "git add" and waiting for a "git commit" call.
357 # This script requires the following JJB variables to be passed in:
358 # {project} Gerrit project-name
359 # {gerrit-topic} Gerrit topic, please make a unique topic.
360 # {gerrit-commit-message} Commit message to assign to commit.
361 # NOTE: Requires git review to be installed on node.
363 - shell: !include-raw: opendaylight-infra-push-gerrit-patch.sh
366 name: distribute-build-url
367 # Place URL of the current run of a build job to a file at given path.
369 - shell: 'echo "$BUILD_URL" > {path}/build.url'
372 name: wipe-org-opendaylight-repo
374 - shell: 'if [ -d /tmp/r/org/opendaylight ]; then rm -rf /tmp/r/org/opendaylight; fi'
377 name: wipe-local-maven-repo
379 - shell: 'if [ -d /tmp/r ]; then rm -rf /tmp/r; fi'
382 name: jacoco-nojava-workaround
384 - shell: 'mkdir -p $WORKSPACE/target/classes $WORKSPACE/jacoco/classes'
390 application-name: '{application-name}'
393 name: releng-check-unicode
396 $WORKSPACE/scripts/check-unicode.sh jjb/
399 name: provide-maven-settings
401 - config-file-provider:
403 - file-id: '{global-settings-file}'
404 variable: 'GLOBAL_SETTINGS_FILE'
405 - file-id: '{settings-file}'
406 variable: 'SETTINGS_FILE'
409 name: releng-fetch-p2zip-if-necessary
412 # Cleanup any existing zips and metadata before we download the new update site
415 condition-kind: strings-match
416 condition-string1: '$P2ZIP_URL'
417 condition-string2: ''
418 condition-basedir: workspace
420 # TODO: Figure out latest snapshot version number to pull rather than hardcoding 1.1.1-SNAPSHOT
422 maven-version: '{maven-version}'
424 org.apache.maven.plugins:maven-dependency-plugin:get
425 org.apache.maven.plugins:maven-dependency-plugin:copy
427 -Dartifact=org.opendaylight.yangide:org.opendaylight.yangide.update-site:1.1.1-SNAPSHOT:zip
428 -DoutputDirectory=$WORKSPACE
429 settings: '{settings}'
430 global-settings: '{global-settings}'
433 name: releng-generate-p2pom
435 - shell: !include-raw: include-raw-generate-p2pom.sh
438 name: releng-update-p2composite-metadata
440 - shell: !include-raw: include-raw-update-p2composite-metadata.sh
442 condition-kind: file-exists
443 condition-filename: deploy-composite-repo.xml
444 condition-basedir: workspace
447 maven-version: '{maven-version}'
448 pom: 'deploy-composite-repo.xml'
449 goals: 'clean deploy -V -B -Dmaven.repo.local=/tmp/r'
450 settings: '{settings}'
451 global-settings: '{global-settings}'
454 name: releng-stage-release
456 - shell: !include-raw: include-raw-stage-release.sh
459 # This wrapper is required for all jobs as it configures the wrappers
460 # needed by OpenDaylight infra.
461 name: opendaylight-infra-wrappers
464 - config-file-provider:
466 - file-id: rackspace-heat
467 target: '$HOME/.config/openstack/clouds.yaml'
470 timeout: '{build-timeout}'
471 timeout-var: 'BUILD_TIMEOUT'
474 - ssh-agent-credentials:
476 - 'opendaylight-jenkins-ssh'
481 name: packer-validate
483 - config-file-provider:
485 - file-id: 'packer-cloud-env'
489 varfiles="../packer/vars/*"
490 templates="../packer/templates/*"
491 provision="../packer/provision/*.sh"
492 for v in $varfiles; do
493 [[ "${v##*/}" =~ ^(cloud-env.*)$ ]] && continue
494 for t in $templates; do
495 export PACKER_LOG="yes" && \
496 export PACKER_LOG_PATH="packer-validate-${v##*/}-${t##*/}.log" && \
497 packer.io validate -var-file=$CLOUDENV \
499 if [ $? -ne 0 ]; then
504 for p in $provision; do
505 /bin/bash -n $p > provision-validate-${p##*/}.log 2>&1
512 - config-file-provider:
514 - file-id: 'packer-cloud-env'
518 export PACKER_LOG="yes" && \
519 export PACKER_LOG_PATH="packer-build.log" && \
520 packer.io build -color=false -var-file=$CLOUDENV \
521 -var-file=../packer/vars/{platform}.json \
522 ../packer/templates/{template}.json
525 # TODO: Verify signature after downloading users public key from a locally created
526 # repository instead of the public keymesh. This requires a process in place to get ODL
527 # developers public keys into a local repository without increasing the job thoughput.
528 name: verify-gpg-signature
530 - shell: !include-raw: include-raw-verify-gpg-signatures.sh
533 name: opendaylight-infra-jjbini
535 - config-file-provider:
538 target: '$HOME/.config/jenkins_jobs/jenkins_jobs.ini'
541 name: distribution-check-wipe
542 # Step zero: Wipe file repositories up front.
545 echo "wipe r: the local Maven repository"
547 echo "wipe n: the fake remote (Nexus) repository"
549 echo "wipe t: the transient repository used in some manipulations"
553 name: distribution-check-build-project
554 # Step one: Online build of the project, using local repository /tmp/r/ and deploying artifacts to /tmp/n/.
555 # Ordinary SingleFeatureTest failures are detected in the verify job, so we can use "q" profile here.
557 # pom: Relative path to pom file to use. Typically '$GERRIT_PROJECT/pom.xml'.
560 maven-version: 'mvn33'
563 clean deploy dependency:tree
564 -DoutputFile=dependency_tree.txt
567 -DaltDeploymentRepository=fake-nexus::default::file:///tmp/n/
568 -Dmaven.repo.local=/tmp/r
569 -Dorg.ops4j.pax.url.mvn.localRepository=/tmp/r
571 - '-Xmx4096m -XX:MaxPermSize=1024m -Dmaven.compile.fork=true'
572 settings: 'integration-settings'
574 global-settings: 'odl-global-settings'
575 global-settings-type: cfp
578 name: distribution-check-verify-groupid
579 # Step two: Verify all deployed artifacts belong to the project's groupId.
580 # This is done by moving the allowed directories out of /tmp/n and checking no files remained there.
581 # The correct directory is derived from $GERRIT_PROJECT.
582 # TODO: Verify all deployed artifacts are snapshots.
584 # gerrit-project: Project name as nexus URI part. Typically '$GERRIT_PROJECT'.
587 mkdir -p /tmp/t/org/opendaylight/{gerrit-project}
588 mv /tmp/n/org/opendaylight/{gerrit-project}/* /tmp/t/org/opendaylight/{gerrit-project}/
589 test -z "`find /tmp/n/ -type f`" || ( echo "ERROR: Mismatched groupId detected (see above)." && false )
594 name: distribution-check-download-deps
595 # Step three: Online build of integration distribution.
596 # This step is mainly used for downloading other project artifacts.
597 # Running SingleFeaturesTest here does not seem to be required, so -Pq is used again.
599 # dist-pom: Relative path to pom file to use. 'distribution/pom.xml' is recommended.
602 maven-version: 'mvn33'
605 clean install dependency:tree
606 -DoutputFile=dependency_tree.txt
609 -Dmaven.repo.local=/tmp/r
610 -Dorg.ops4j.pax.url.mvn.localRepository=/tmp/r
612 - '-Xmx1024m -XX:MaxPermSize=256m -Dmaven.compile.fork=true'
613 settings: 'integration-settings'
615 global-settings: 'odl-global-settings'
616 global-settings-type: cfp
619 name: distribution-check-delete-snapshots
620 # Step four: Delete snapshot artifacts from the local repository.
621 # This is critical to detect orphaned artifacts or missing project-internal dependency declarations.
622 # Also other files related to maven repository resolution are removed,
623 # and then empty directories are removed, in order to simplify debugging.
625 - shell: !include-raw-escape: integration-distribution-delete-snaphot-artifacts.sh
628 name: distribution-check-configure-remotes
629 # Now the ugly part. It seems that the only way to tell Maven 2+
630 # which remote repositories to use is via settings.xml file.
631 # So we create such a file here, but it needs most of odlparent:settings.xml
635 <settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
636 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
637 xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
638 https://maven.apache.org/xsd/settings-1.0.0.xsd">
641 <id>opendaylight-release</id>
644 <id>opendaylight-mirror</id>
645 <name>opendaylight</name>
646 <url>https://nexus.opendaylight.org/content/repositories/public/</url>
647 <releases><updatePolicy>never</updatePolicy></releases>
648 <snapshots><enabled>false</enabled></snapshots>
653 <id>opendaylight-plugin-mirror</id>
654 <name>opendaylight-plugin</name>
655 <url>https://nexus.opendaylight.org/content/repositories/public/</url>
656 <releases><updatePolicy>never</updatePolicy></releases>
657 <snapshots><enabled>false</enabled></snapshots>
659 </pluginRepositories>
662 <id>file-snapshots</id>
665 <id>file-snapshots</id>
667 <url>file:///tmp/n/</url>
668 <releases><enabled>false</enabled></releases>
673 <id>file-plugin-snapshots</id>
674 <name>file-plugin</name>
675 <url>file:///tmp/n/</url>
676 <releases><enabled>false</enabled></releases>
678 </pluginRepositories>
682 <activeProfile>file-snapshots</activeProfile>
683 <activeProfile>opendaylight-release</activeProfile>
687 # Notes: The settings are minimal in order to detect breakage scenarios,
688 # while allowing for the following quirks:
689 # * Some plugins seem to have hardcoded repos, for example check-license looks at repository.apache.org
690 # * Some plugin artifacts (related to surefire) are not downloaded when tests are skipped.
691 # * populate-local-repo looks at oss.sonatype.org and does not store things (like guava) to /tmp/r
694 name: distribution-check-repeat-build
695 # Step five: Repeat the distribution build but with the new settings.
696 # Here, only the project snapshot artifacts deployed to /tmp/n are available,
697 # which faithfully reproduces conditions in later verify-like job runs.
698 # We cannot use --offline, because: "Cannot access file (file:///tmp/n) in offline mode"
699 # This is where SingleFeatureTest is not skipped.
701 # dist-pom: Relative path to pom file to use. 'distribution/pom.xml' is recommended.
704 maven-version: 'mvn33'
707 clean install dependency:tree
708 -DoutputFile=dependency_tree.txt -s fake_remotes.xml
712 -Dmaven.repo.local=/tmp/r
713 -Dorg.ops4j.pax.url.mvn.localRepository=/tmp/r
715 - '-Xmx1024m -XX:MaxPermSize=256m -Dmaven.compile.fork=true'