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: run-test-parameter
87 description: 'Set true to run test after build'
90 name: distribution-branch-to-build-parameter
93 name: DISTRIBUTION_BRANCH_TO_BUILD
95 description: 'distribution repo branch to build with'
103 description: 'Nexus staging profile id'
106 name: stage-id-parameter
109 name: STAGING_PROFILE_ID
110 default: '{stage-id}'
111 description: 'Nexus staging profile id'
118 default: '/w/tools/hudson.tasks.Maven_MavenInstallation/{maven-version}/bin/mvn'
119 description: 'Maven selector to be used by shell scripts'
125 credentials-id: 'opendaylight-jenkins-ssh'
134 name: git-scm-with-submodules
137 credentials-id: 'opendaylight-jenkins-ssh'
141 - 'refs/heads/{branch}'
148 name: gerrit-trigger-scm
151 credentials-id: 'opendaylight-jenkins-ssh'
155 - 'origin/$GERRIT_BRANCH'
157 choosing-strategy: '{choosing-strategy}'
167 # This is a single macro to use for all jobs who vote on every (relevant) patch set.
168 # Only 'recheck' trigger word is supported, it always triggers the full set of relevant jobs,
169 # in order to prevent Jenkins from starting only a subset and still voting Verified+1.
171 # server: name of gerrit server to listen to
172 # project: pattern to match triggering projects
173 # branch: triggering branch name
174 # files: pattern to match triggering filepaths
176 name: gerrit-trigger-patch-submitted
179 server-name: '{server}'
181 - patchset-created-event:
183 exclude-trivial-rebase: false
184 exclude-no-code-change: false
185 - draft-published-event
186 - comment-added-contains-event:
187 comment-contains-value: recheck
189 - project-compare-type: ANT
190 project-pattern: '{project}'
192 - branch-compare-type: ANT
193 branch-pattern: '**/{branch}'
198 # TODO: Unify argument names across gerrit-trigger-* macros.
200 name: gerrit-trigger-patch-merged
203 server-name: '{server-name}'
205 - change-merged-event
206 - comment-added-contains-event:
207 comment-contains-value: 'remerge'
209 - project-compare-type: 'ANT'
210 project-pattern: '{name}'
212 - branch-compare-type: 'ANT'
213 branch-pattern: '**/{branch}'
219 # Force Jenkins always vote the values it should already have voted
220 # during the prior verify phase
222 gerrit-build-started-verified-value: 1
223 gerrit-build-successful-verified-value: 1
224 gerrit-build-failed-verified-value: 1
225 gerrit-build-unstable-verified-value: 1
226 gerrit-build-notbuilt-verified-value: 1
227 gerrit-build-started-codereview-value: 0
228 gerrit-build-successful-codereview-value: 0
229 gerrit-build-failed-codereview-value: 0
230 gerrit-build-unstable-codereview-value: 0
231 gerrit-build-notbuilt-codereview-value: 0
233 # TODO: Unify argument names across gerrit-trigger-* macros.
235 name: gerrit-trigger-patch-sonar
238 server-name: '{server-name}'
240 - comment-added-contains-event:
241 comment-contains-value: 'run-sonar'
243 - project-compare-type: 'ANT'
244 project-pattern: '{name}'
246 - branch-compare-type: 'ANT'
247 branch-pattern: '**/master'
255 name: archive-artifacts
258 artifacts: '{artifacts}'
264 name: email-notification
267 recipients: '{email-recipients}'
269 content-type: default
270 subject: '{email-prefix} $PROJECT_NAME - Build # $BUILD_NUMBER - $BUILD_STATUS!'
272 $PROJECT_NAME - Build # $BUILD_NUMBER - $BUILD_STATUS:
274 Please refer to the logs server URL for console logs when possible
275 and use the Jenkins Build URL as a last resort.
278 https://logs.opendaylight.org/$SILO/$JENKINS_HOSTNAME/$JOB_NAME/$BUILD_NUMBER
291 exec-pattern: "**/**.exec"
292 class-pattern: "**/classes"
293 source-pattern: "**/src/main/java"
294 exclusion-pattern: "**/gen/**,**/generated-sources/**,**/yang-gen**,**/pax/**"
305 name: opendaylight-infra-shiplogs
306 # To archive things the job will need to create a "archives" directory in
307 # the workspace and this macro will handle copying the contents of the
308 # archives directory.
310 # Uses the build parameter ARCHIVE_ARTIFACTS if not empty to find files
311 # to archive. You can pass globstar patterns for example "**/*.xml **/*.log"
312 # as the archive pattern. This is a space separated list of files to archive.
314 # Also ensure that the workspace is cleaned up at the end of the build.
318 - shell: !include-raw: include-raw-stack-delete.sh
319 - shell: !include-raw-escape: include-raw-deploy-archives.sh
321 maven-version: '{maven-version}'
322 pom: '.archives/deploy-archives.xml'
323 goals: 'clean deploy -V -B -q -Dmaven.repo.local=/tmp/r'
324 settings: 'jenkins-log-archives-settings'
326 global-settings: 'odl-global-settings'
327 global-settings-type: cfp
328 - description-setter:
329 regexp: '^Build logs: .*'
330 # Cleanup after ourselves
331 - wipe-org-opendaylight-repo
332 script-only-if-succeeded: false
333 script-only-if-failed: false
334 mark-unstable-if-failed: true
337 # Do not clean up *.jenkins-trigger files for jobs that use a
338 # properties file as input for triggering another build.
339 - '**/*.jenkins-trigger'
343 name: opendaylight-infra-stack
344 # opendaylight-infra-stack.sh has a required variable {stack-template} that
345 # must be passed into this macro.
347 - shell: !include-raw: opendaylight-infra-stack.sh
348 - shell: !include-raw-escape: opendaylight-infra-copy-ssh-keys.sh
351 name: opendaylight-infra-push-gerrit-patch
352 # opendaylight-infra-push-gerrit-patch.sh allows a job to push a patch to
353 # Gerrit in an automated fashion. This is meant for tasks that creates
354 # the same patch regularly and needs the ability to detect if an unreviewed
355 # patch already exists. In which case it will update the existing patch.
357 # Note: This patch assumes the $WORKSPACE contains the project repo with
358 # the files changed already "git add" and waiting for a "git commit" call.
360 # This script requires the following JJB variables to be passed in:
361 # {project} Gerrit project-name
362 # {gerrit-topic} Gerrit topic, please make a unique topic.
363 # {gerrit-commit-message} Commit message to assign to commit.
364 # NOTE: Requires git review to be installed on node.
366 - shell: !include-raw: opendaylight-infra-push-gerrit-patch.sh
369 name: distribute-build-url
370 # Place URL of the current run of a build job to a file at given path.
372 - shell: 'echo "$BUILD_URL" > {path}/build.url'
375 name: wipe-org-opendaylight-repo
377 - shell: 'if [ -d /tmp/r/org/opendaylight ]; then rm -rf /tmp/r/org/opendaylight; fi'
380 name: wipe-local-maven-repo
382 - shell: 'if [ -d /tmp/r ]; then rm -rf /tmp/r; fi'
385 name: jacoco-nojava-workaround
387 - shell: 'mkdir -p $WORKSPACE/target/classes $WORKSPACE/jacoco/classes'
393 application-name: '{application-name}'
396 name: releng-check-unicode
399 $WORKSPACE/scripts/check-unicode.sh jjb/
402 name: provide-maven-settings
404 - config-file-provider:
406 - file-id: '{global-settings-file}'
407 variable: 'GLOBAL_SETTINGS_FILE'
408 - file-id: '{settings-file}'
409 variable: 'SETTINGS_FILE'
412 name: releng-fetch-p2zip-if-necessary
415 # Cleanup any existing zips and metadata before we download the new update site
418 condition-kind: strings-match
419 condition-string1: '$P2ZIP_URL'
420 condition-string2: ''
421 condition-basedir: workspace
423 # TODO: Figure out latest snapshot version number to pull rather than hardcoding 1.1.1-SNAPSHOT
425 maven-version: '{maven-version}'
427 org.apache.maven.plugins:maven-dependency-plugin:get
428 org.apache.maven.plugins:maven-dependency-plugin:copy
430 -Dartifact=org.opendaylight.yangide:org.opendaylight.yangide.update-site:1.1.1-SNAPSHOT:zip
431 -DoutputDirectory=$WORKSPACE
432 settings: '{settings}'
433 global-settings: '{global-settings}'
436 name: releng-generate-p2pom
438 - shell: !include-raw: include-raw-generate-p2pom.sh
441 name: releng-update-p2composite-metadata
443 - shell: !include-raw: include-raw-update-p2composite-metadata.sh
445 condition-kind: file-exists
446 condition-filename: deploy-composite-repo.xml
447 condition-basedir: workspace
450 maven-version: '{maven-version}'
451 pom: 'deploy-composite-repo.xml'
452 goals: 'clean deploy -V -B -Dmaven.repo.local=/tmp/r'
453 settings: '{settings}'
454 global-settings: '{global-settings}'
457 name: releng-stage-release
459 - shell: !include-raw: include-raw-stage-release.sh
462 # This wrapper is required for all jobs as it configures the wrappers
463 # needed by OpenDaylight infra.
464 name: opendaylight-infra-wrappers
467 - config-file-provider:
470 target: '$HOME/.npmrc'
471 - file-id: rackspace-heat
472 target: '$HOME/.config/openstack/clouds.yaml'
475 timeout: '{build-timeout}'
476 timeout-var: 'BUILD_TIMEOUT'
479 - ssh-agent-credentials:
481 - 'opendaylight-jenkins-ssh'
486 name: packer-validate
488 - config-file-provider:
490 - file-id: 'packer-cloud-env'
494 varfiles="../packer/vars/*"
495 templates="../packer/templates/*"
496 provision="../packer/provision/*.sh"
497 for v in $varfiles; do
498 [[ "${v##*/}" =~ ^(cloud-env.*)$ ]] && continue
499 for t in $templates; do
500 export PACKER_LOG="yes" && \
501 export PACKER_LOG_PATH="packer-validate-${v##*/}-${t##*/}.log" && \
502 packer.io validate -var-file=$CLOUDENV \
504 if [ $? -ne 0 ]; then
509 for p in $provision; do
510 /bin/bash -n $p > provision-validate-${p##*/}.log 2>&1
517 - config-file-provider:
519 - file-id: 'packer-cloud-env'
523 export PACKER_LOG="yes" && \
524 export PACKER_LOG_PATH="packer-build.log" && \
525 packer.io build -color=false -var-file=$CLOUDENV \
526 -var-file=../packer/vars/{platform}.json \
527 ../packer/templates/{template}.json
530 # TODO: Verify signature after downloading users public key from a locally created
531 # repository instead of the public keymesh. This requires a process in place to get ODL
532 # developers public keys into a local repository without increasing the job thoughput.
533 name: verify-gpg-signature
535 - shell: !include-raw: include-raw-verify-gpg-signatures.sh
538 name: opendaylight-infra-jjbini
540 - config-file-provider:
543 target: '$HOME/.config/jenkins_jobs/jenkins_jobs.ini'
546 name: distribution-check-wipe
547 # Step zero: Wipe file repositories up front.
550 echo "wipe r: the local Maven repository"
552 echo "wipe n: the fake remote (Nexus) repository"
554 echo "wipe t: the transient repository used in some manipulations"
558 name: distribution-check-build-project
559 # Step one: Online build of the project, using local repository /tmp/r/ and deploying artifacts to /tmp/n/.
560 # Ordinary SingleFeatureTest failures are detected in the verify job, so we can use "q" profile here.
562 # pom: Relative path to pom file to use. Typically '$GERRIT_PROJECT/pom.xml'.
565 maven-version: 'mvn33'
568 clean deploy dependency:tree
569 -DoutputFile=dependency_tree.txt
571 -DaltDeploymentRepository=fake-nexus::default::file:///tmp/n/
574 - '-Xmx4096m -XX:MaxPermSize=1024m -Dmaven.compile.fork=true'
575 settings: 'integration-settings'
577 global-settings: 'odl-global-settings'
578 global-settings-type: cfp
581 name: distribution-check-verify-groupid
582 # Step two: Verify all deployed artifacts belong to the project's groupId.
583 # This is done by moving the allowed directories out of /tmp/n and checking no files remained there.
584 # The correct directory is derived from $GERRIT_PROJECT.
585 # TODO: Verify all deployed artifacts are snapshots.
587 # gerrit-project: Project name as nexus URI part. Typically '$GERRIT_PROJECT'.
590 mkdir -p /tmp/t/org/opendaylight/{gerrit-project}
591 mv /tmp/n/org/opendaylight/{gerrit-project}/* /tmp/t/org/opendaylight/{gerrit-project}/
592 test -z "`find /tmp/n/ -type f`" || ( echo "ERROR: Mismatched groupId detected (see above)." && false )
597 name: distribution-check-download-deps
598 # Step three: Online build of integration distribution.
599 # This step is mainly used for downloading other project artifacts.
600 # Running SingleFeaturesTest here does not seem to be required, so -Pq is used again.
602 # dist-pom: Relative path to pom file to use. 'distribution/pom.xml' is recommended.
605 maven-version: 'mvn33'
608 clean install dependency:tree
609 -DoutputFile=dependency_tree.txt
613 - '-Xmx1024m -XX:MaxPermSize=256m -Dmaven.compile.fork=true'
614 settings: 'integration-settings'
616 global-settings: 'odl-global-settings'
617 global-settings-type: cfp
620 name: distribution-check-delete-snapshots
621 # Step four: Delete snapshot artifacts from the local repository.
622 # This is critical to detect orphaned artifacts or missing project-internal dependency declarations.
623 # Also other files related to maven repository resolution are removed,
624 # and then empty directories are removed, in order to simplify debugging.
626 - shell: !include-raw-escape: integration-distribution-delete-snaphot-artifacts.sh
629 name: distribution-check-configure-remotes
630 # Now the ugly part. It seems that the only way to tell Maven 2+
631 # which remote repositories to use is via settings.xml file.
632 # So we create such a file here, but it needs most of odlparent:settings.xml
636 <settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
637 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
638 xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
639 https://maven.apache.org/xsd/settings-1.0.0.xsd">
642 <id>opendaylight-release</id>
645 <id>opendaylight-mirror</id>
646 <name>opendaylight</name>
647 <url>https://nexus.opendaylight.org/content/repositories/public/</url>
648 <releases><updatePolicy>never</updatePolicy></releases>
649 <snapshots><enabled>false</enabled></snapshots>
654 <id>opendaylight-plugin-mirror</id>
655 <name>opendaylight-plugin</name>
656 <url>https://nexus.opendaylight.org/content/repositories/public/</url>
657 <releases><updatePolicy>never</updatePolicy></releases>
658 <snapshots><enabled>false</enabled></snapshots>
660 </pluginRepositories>
663 <id>file-snapshots</id>
666 <id>file-snapshots</id>
668 <url>file:///tmp/n/</url>
669 <releases><enabled>false</enabled></releases>
674 <id>file-plugin-snapshots</id>
675 <name>file-plugin</name>
676 <url>file:///tmp/n/</url>
677 <releases><enabled>false</enabled></releases>
679 </pluginRepositories>
683 <activeProfile>file-snapshots</activeProfile>
684 <activeProfile>opendaylight-release</activeProfile>
688 # Notes: The settings are minimal in order to detect breakage scenarios,
689 # while allowing for the following quirks:
690 # * Some plugins seem to have hardcoded repos, for example check-license looks at repository.apache.org
691 # * Some plugin artifacts (related to surefire) are not downloaded when tests are skipped.
692 # * populate-local-repo looks at oss.sonatype.org and does not store things (like guava) to /tmp/r
695 name: distribution-check-repeat-build
696 # Step five: Repeat the distribution build but with the new settings.
697 # Here, only the project snapshot artifacts deployed to /tmp/n are available,
698 # which faithfully reproduces conditions in later verify-like job runs.
699 # We cannot use --offline, because: "Cannot access file (file:///tmp/n) in offline mode"
700 # This is where SingleFeatureTest is not skipped.
702 # dist-pom: Relative path to pom file to use. 'distribution/pom.xml' is recommended.
705 maven-version: 'mvn33'
708 clean install dependency:tree
709 -DoutputFile=dependency_tree.txt -s fake_remotes.xml
714 - '-Xmx1024m -XX:MaxPermSize=256m -Dmaven.compile.fork=true'
717 name: distribution-check-deploy-distribution
718 # Deploy distribution-karaf zip to Nexus SNAPSHOT repo for testing.
720 # {settings-file} to use for opendaylight-snapshot credentials
723 properties-content: BUNDLE_POM={dist-pom}
724 - shell: !include-raw-escape: deploy-distribution-get-vars.sh
726 properties-file: deploy-distribution.env
727 - config-file-provider:
729 - file-id: odl-global-settings
730 variable: GLOBAL_SETTINGS_FILE
731 - file-id: integration-settings
732 variable: SETTINGS_FILE
733 - shell: !include-raw-escape: deploy-distribution.sh
734 # Re-inject BUNDLE_URL so that downstream projects can use it.
736 properties-file: deploy-distribution.env