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
80 Patches to add to distro in CSV project:changeset format (genius:32/53632/9,netvirt:59/50259/47)
83 name: run-test-parameter
88 description: 'Set true to run test after build'
91 name: distribution-branch-to-build-parameter
94 name: DISTRIBUTION_BRANCH_TO_BUILD
96 description: 'distribution repo branch to build with'
104 description: 'Nexus staging profile id'
107 name: stage-id-parameter
110 name: STAGING_PROFILE_ID
111 default: '{stage-id}'
112 description: 'Nexus staging profile id'
119 default: '/w/tools/hudson.tasks.Maven_MavenInstallation/{maven-version}/bin/mvn'
120 description: 'Maven selector to be used by shell scripts'
126 credentials-id: 'opendaylight-jenkins-ssh'
135 name: git-scm-with-submodules
138 credentials-id: 'opendaylight-jenkins-ssh'
142 - 'refs/heads/{branch}'
149 name: gerrit-trigger-scm
152 credentials-id: 'opendaylight-jenkins-ssh'
156 - 'origin/$GERRIT_BRANCH'
158 choosing-strategy: '{choosing-strategy}'
168 # This is a single macro to use for all jobs who vote on every (relevant) patch set.
169 # Only 'recheck' trigger word is supported, it always triggers the full set of relevant jobs,
170 # in order to prevent Jenkins from starting only a subset and still voting Verified+1.
172 # server: name of gerrit server to listen to
173 # project: pattern to match triggering projects
174 # branch: triggering branch name
175 # files: pattern to match triggering filepaths
177 name: gerrit-trigger-patch-submitted
180 server-name: '{server}'
182 - patchset-created-event:
184 exclude-trivial-rebase: false
185 exclude-no-code-change: false
186 - draft-published-event
187 - comment-added-contains-event:
188 comment-contains-value: recheck
190 - project-compare-type: ANT
191 project-pattern: '{project}'
193 - branch-compare-type: ANT
194 branch-pattern: '**/{branch}'
199 # TODO: Unify argument names across gerrit-trigger-* macros.
201 name: gerrit-trigger-patch-merged
204 server-name: '{server-name}'
206 - change-merged-event
207 - comment-added-contains-event:
208 comment-contains-value: 'remerge'
210 - project-compare-type: 'ANT'
211 project-pattern: '{name}'
213 - branch-compare-type: 'ANT'
214 branch-pattern: '**/{branch}'
220 # Force Jenkins always vote the values it should already have voted
221 # during the prior verify phase
223 gerrit-build-started-verified-value: 1
224 gerrit-build-successful-verified-value: 1
225 gerrit-build-failed-verified-value: 1
226 gerrit-build-unstable-verified-value: 1
227 gerrit-build-notbuilt-verified-value: 1
228 gerrit-build-started-codereview-value: 0
229 gerrit-build-successful-codereview-value: 0
230 gerrit-build-failed-codereview-value: 0
231 gerrit-build-unstable-codereview-value: 0
232 gerrit-build-notbuilt-codereview-value: 0
234 # TODO: Unify argument names across gerrit-trigger-* macros.
236 name: gerrit-trigger-patch-sonar
239 server-name: '{server-name}'
241 - comment-added-contains-event:
242 comment-contains-value: 'run-sonar'
244 - project-compare-type: 'ANT'
245 project-pattern: '{name}'
247 - branch-compare-type: 'ANT'
248 branch-pattern: '**/master'
256 name: archive-artifacts
259 artifacts: '{artifacts}'
265 name: email-notification
268 recipients: '{email-recipients}'
270 content-type: default
271 subject: '{email-prefix} $PROJECT_NAME - Build # $BUILD_NUMBER - $BUILD_STATUS!'
273 $PROJECT_NAME - Build # $BUILD_NUMBER - $BUILD_STATUS:
275 Please refer to the logs server URL for console logs when possible
276 and use the Jenkins Build URL as a last resort.
279 https://logs.opendaylight.org/$SILO/$JENKINS_HOSTNAME/$JOB_NAME/$BUILD_NUMBER
292 exec-pattern: "**/**.exec"
293 class-pattern: "**/classes"
294 source-pattern: "**/src/main/java"
295 exclusion-pattern: "**/gen/**,**/generated-sources/**,**/yang-gen**,**/pax/**"
306 # Deploys a maven site to Nexus using lftools nexus-zip command
307 name: opendaylight-infra-deploy-maven-site
309 - lf-provide-maven-settings:
310 global-settings-file: global-settings
311 settings-file: '{settings-file}'
312 - lf-infra-create-netrc:
313 server-id: opendaylight-site
314 - shell: !include-raw-escape:
315 - global-jjb/shell/lftools-install.sh
316 - opendaylight-infra-deploy-maven-site.sh
317 - lf-provide-maven-settings-cleanup
320 name: opendaylight-infra-stack
321 # opendaylight-infra-stack.sh has a required variable {stack-template} that
322 # must be passed into this macro.
324 - shell: !include-raw: opendaylight-infra-stack.sh
325 - shell: !include-raw-escape: opendaylight-infra-copy-ssh-keys.sh
328 name: opendaylight-infra-push-gerrit-patch
329 # opendaylight-infra-push-gerrit-patch.sh allows a job to push a patch to
330 # Gerrit in an automated fashion. This is meant for tasks that creates
331 # the same patch regularly and needs the ability to detect if an unreviewed
332 # patch already exists. In which case it will update the existing patch.
334 # Note: This patch assumes the $WORKSPACE contains the project repo with
335 # the files changed already "git add" and waiting for a "git commit" call.
337 # This script requires the following JJB variables to be passed in:
338 # {project} Gerrit project-name
339 # {gerrit-topic} Gerrit topic, please make a unique topic.
340 # {gerrit-commit-message} Commit message to assign to commit.
341 # NOTE: Requires git review to be installed on node.
343 - shell: !include-raw: opendaylight-infra-push-gerrit-patch.sh
346 name: distribute-build-url
347 # Place URL of the current run of a build job to a file at given path.
351 set +e # DO NOT fail script if command returns non-zero.
353 echo "$BUILD_URL" > {path}/build.url
355 # DO NOT fail the build if the echo failed.
359 name: wipe-org-opendaylight-repo
361 - shell: 'if [ -d /tmp/r/org/opendaylight ]; then rm -rf /tmp/r/org/opendaylight; fi'
364 name: wipe-local-maven-repo
366 - shell: 'if [ -d /tmp/r ]; then rm -rf /tmp/r; fi'
369 name: jacoco-nojava-workaround
371 - shell: 'mkdir -p $WORKSPACE/target/classes $WORKSPACE/jacoco/classes'
377 application-name: '{application-name}'
380 name: releng-check-unicode
383 $WORKSPACE/scripts/check-unicode.sh jjb/
386 name: provide-maven-settings
388 - config-file-provider:
390 - file-id: '{global-settings-file}'
391 variable: 'GLOBAL_SETTINGS_FILE'
392 - file-id: '{settings-file}'
393 variable: 'SETTINGS_FILE'
396 name: releng-fetch-p2zip-if-necessary
399 # Cleanup any existing zips and metadata before we download the new update site
402 condition-kind: strings-match
403 condition-string1: '$P2ZIP_URL'
404 condition-string2: ''
405 condition-basedir: workspace
407 # TODO: Figure out latest snapshot version number to pull rather than hardcoding 1.1.1-SNAPSHOT
409 maven-version: '{maven-version}'
411 org.apache.maven.plugins:maven-dependency-plugin:get
412 org.apache.maven.plugins:maven-dependency-plugin:copy
414 -Dartifact=org.opendaylight.yangide:org.opendaylight.yangide.update-site:1.1.1-SNAPSHOT:zip
415 -DoutputDirectory=$WORKSPACE
416 settings: '{settings}'
417 global-settings: '{global-settings}'
420 name: releng-generate-p2pom
422 - shell: !include-raw: include-raw-generate-p2pom.sh
425 name: releng-update-p2composite-metadata
427 - shell: !include-raw: include-raw-update-p2composite-metadata.sh
429 condition-kind: file-exists
430 condition-filename: deploy-composite-repo.xml
431 condition-basedir: workspace
434 maven-version: '{maven-version}'
435 pom: 'deploy-composite-repo.xml'
436 goals: 'clean deploy -V -B -Dmaven.repo.local=/tmp/r'
437 settings: '{settings}'
438 global-settings: '{global-settings}'
441 name: releng-stage-release
443 - shell: !include-raw: include-raw-stage-release.sh
446 # This wrapper is required for all jobs as it configures the wrappers
447 # needed by OpenDaylight infra.
448 name: opendaylight-infra-wrappers
451 - config-file-provider:
454 target: '$HOME/.npmrc'
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'
479 varfiles="../packer/vars/*"
480 templates="../packer/templates/*"
481 provision="../packer/provision/*.sh"
482 for v in $varfiles; do
483 [[ "${v##*/}" =~ ^(cloud-env.*)$ ]] && continue
484 for t in $templates; do
485 export PACKER_LOG="yes" && \
486 export PACKER_LOG_PATH="packer-validate-${v##*/}-${t##*/}.log" && \
487 packer.io validate -var-file=$CLOUDENV \
489 if [ $? -ne 0 ]; then
498 - config-file-provider:
500 - file-id: 'packer-cloud-env'
505 export PACKER_LOG="yes" && \
506 export PACKER_LOG_PATH="packer-build.log" && \
507 packer.io build -color=false -var-file=$CLOUDENV \
508 -var-file=../packer/vars/{platform}.json \
509 ../packer/templates/{template}.json
510 # Split public and private cloud logs
511 grep -e 'public_cloud' packer-build.log > packer-build_public_cloud.log 2>&1
512 grep -e 'private_cloud' packer-build.log > packer-build_private_cloud.log 2>&1
515 # TODO: Verify signature after downloading users public key from a locally created
516 # repository instead of the public keymesh. This requires a process in place to get ODL
517 # developers public keys into a local repository without increasing the job thoughput.
518 name: verify-gpg-signature
520 - shell: !include-raw: include-raw-verify-gpg-signatures.sh
523 name: opendaylight-infra-jjbini
525 - config-file-provider:
528 target: '$HOME/.config/jenkins_jobs/jenkins_jobs.ini'
531 name: distribution-check-wipe
532 # Step zero: Wipe file repositories up front.
535 echo "wipe r: the local Maven repository"
537 echo "wipe n: the fake remote (Nexus) repository"
539 echo "wipe t: the transient repository used in some manipulations"
543 name: distribution-check-build-project
544 # Step one: Online build of the project, using local repository /tmp/r/ and deploying artifacts to /tmp/n/.
545 # Ordinary SingleFeatureTest failures are detected in the verify job, so we can use "q" profile here.
547 # pom: Relative path to pom file to use. Typically '$GERRIT_PROJECT/pom.xml'.
550 maven-version: 'mvn33'
553 clean deploy dependency:tree
554 -DoutputFile=dependency_tree.txt
556 -DaltDeploymentRepository=fake-nexus::default::file:///tmp/n/
559 - '-Xmx4096m -XX:MaxPermSize=1024m -Dmaven.compile.fork=true'
560 settings: 'integration-settings'
562 global-settings: 'global-settings'
563 global-settings-type: cfp
566 name: distribution-check-verify-groupid
567 # Step two: Verify all deployed artifacts belong to the project's groupId.
568 # This is done by moving the allowed directories out of /tmp/n and checking no files remained there.
569 # The correct directory is derived from $GERRIT_PROJECT.
570 # TODO: Verify all deployed artifacts are snapshots.
572 # gerrit-project: Project name as nexus URI part. Typically '$GERRIT_PROJECT'.
575 mkdir -p /tmp/t/org/opendaylight/{gerrit-project}
576 mv /tmp/n/org/opendaylight/{gerrit-project}/* /tmp/t/org/opendaylight/{gerrit-project}/
577 test -z "`find /tmp/n/ -type f`" || ( echo "ERROR: Mismatched groupId detected (see above)." && false )
582 name: distribution-check-download-deps
583 # Step three: Online build of integration distribution.
584 # This step is mainly used for downloading other project artifacts.
585 # Running SingleFeaturesTest here does not seem to be required, so -Pq is used again.
587 # dist-pom: Relative path to pom file to use. 'distribution/pom.xml' is recommended.
590 maven-version: 'mvn33'
593 clean install dependency:tree
594 -DoutputFile=dependency_tree.txt
598 - '-Xmx1024m -XX:MaxPermSize=256m -Dmaven.compile.fork=true'
599 settings: 'integration-settings'
601 global-settings: 'global-settings'
602 global-settings-type: cfp
605 name: distribution-check-delete-snapshots
606 # Step four: Delete snapshot artifacts from the local repository.
607 # This is critical to detect orphaned artifacts or missing project-internal dependency declarations.
608 # Also other files related to maven repository resolution are removed,
609 # and then empty directories are removed, in order to simplify debugging.
611 - shell: !include-raw-escape: integration-distribution-delete-snaphot-artifacts.sh
614 name: distribution-check-configure-remotes
615 # Now the ugly part. It seems that the only way to tell Maven 2+
616 # which remote repositories to use is via settings.xml file.
617 # So we create such a file here, but it needs most of odlparent:settings.xml
621 <settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
622 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
623 xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
624 https://maven.apache.org/xsd/settings-1.0.0.xsd">
627 <id>opendaylight-release</id>
630 <id>opendaylight-mirror</id>
631 <name>opendaylight</name>
632 <url>https://nexus.opendaylight.org/content/repositories/public/</url>
633 <releases><updatePolicy>never</updatePolicy></releases>
634 <snapshots><enabled>false</enabled></snapshots>
639 <id>opendaylight-plugin-mirror</id>
640 <name>opendaylight-plugin</name>
641 <url>https://nexus.opendaylight.org/content/repositories/public/</url>
642 <releases><updatePolicy>never</updatePolicy></releases>
643 <snapshots><enabled>false</enabled></snapshots>
645 </pluginRepositories>
648 <id>file-snapshots</id>
651 <id>file-snapshots</id>
653 <url>file:///tmp/n/</url>
654 <releases><enabled>false</enabled></releases>
659 <id>file-plugin-snapshots</id>
660 <name>file-plugin</name>
661 <url>file:///tmp/n/</url>
662 <releases><enabled>false</enabled></releases>
664 </pluginRepositories>
668 <activeProfile>file-snapshots</activeProfile>
669 <activeProfile>opendaylight-release</activeProfile>
673 # Notes: The settings are minimal in order to detect breakage scenarios,
674 # while allowing for the following quirks:
675 # * Some plugins seem to have hardcoded repos, for example check-license looks at repository.apache.org
676 # * Some plugin artifacts (related to surefire) are not downloaded when tests are skipped.
677 # * populate-local-repo looks at oss.sonatype.org and does not store things (like guava) to /tmp/r
680 name: distribution-check-repeat-build
681 # Step five: Repeat the distribution build but with the new settings.
682 # Here, only the project snapshot artifacts deployed to /tmp/n are available,
683 # which faithfully reproduces conditions in later verify-like job runs.
684 # We cannot use --offline, because: "Cannot access file (file:///tmp/n) in offline mode"
685 # This is where SingleFeatureTest is not skipped.
687 # dist-pom: Relative path to pom file to use. 'distribution/pom.xml' is recommended.
690 maven-version: 'mvn33'
693 clean install dependency:tree
694 -DoutputFile=dependency_tree.txt -s fake_remotes.xml
699 - '-Xmx1024m -XX:MaxPermSize=256m -Dmaven.compile.fork=true'