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/*.txt
27 **/target/surefire-reports/*.xml
28 **/target/failsafe-reports/*.txt
29 **/target/failsafe-reports/*.xml
31 **/target/feature/feature.xml
33 description: 'Space separated glob patterns for artifacts to archive into logs.opendaylight.org'
37 description: "GERRIT_PROJECT parameter if not given by trigger"
41 description: "JJB configured GERRIT_BRANCH parameter"
45 description: "GERRIT_REFSPEC parameter if not given by trigger"
48 default: '$SILO-$JOB_NAME-$BUILD_NUMBER'
49 description: "Used by Heat to generate a unique stack & vm name"
54 The name of a cloud configuration in clouds.yaml. OS_CLOUD is a
55 variable name that is significant to openstack client as a
56 environment variable. Please refer to the documentation for
58 https://docs.openstack.org/developer/python-openstackclient/
66 description: 'Tag in Git to checkout'
69 name: controller-version-parameter
73 default: '{odl_version}'
74 description: 'Controller version (for use with openstacks networking_odl project)'
77 name: patches-to-build-parameter
80 name: PATCHES_TO_BUILD
83 Patches to add to distro in CSV project:changeset format (genius:32/53632/9,netvirt:59/50259/47)
86 name: run-test-parameter
91 description: 'Set true to run test after build'
94 name: distribution-branch-to-build-parameter
97 name: DISTRIBUTION_BRANCH_TO_BUILD
99 description: 'distribution repo branch to build with'
102 name: p2zip-parameter
107 description: 'Nexus staging profile id'
110 name: stage-id-parameter
113 name: STAGING_PROFILE_ID
114 default: '{stage-id}'
115 description: 'Nexus staging profile id'
122 default: '/w/tools/hudson.tasks.Maven_MavenInstallation/{maven-version}/bin/mvn'
123 description: 'Maven selector to be used by shell scripts'
129 credentials-id: 'opendaylight-jenkins-ssh'
138 name: git-scm-with-submodules
141 credentials-id: 'opendaylight-jenkins-ssh'
145 - 'refs/heads/{branch}'
152 name: gerrit-trigger-scm
155 credentials-id: 'opendaylight-jenkins-ssh'
159 - 'origin/$GERRIT_BRANCH'
161 choosing-strategy: '{choosing-strategy}'
171 # This is a single macro to use for all jobs who vote on every (relevant) patch set.
172 # Only 'recheck' trigger word is supported, it always triggers the full set of relevant jobs,
173 # in order to prevent Jenkins from starting only a subset and still voting Verified+1.
175 # server: name of gerrit server to listen to
176 # project: pattern to match triggering projects
177 # branch: triggering branch name
178 # files: pattern to match triggering filepaths
180 name: gerrit-trigger-patch-submitted
183 server-name: '{server}'
185 - patchset-created-event:
187 exclude-trivial-rebase: false
188 exclude-no-code-change: false
189 - draft-published-event
190 - comment-added-contains-event:
191 comment-contains-value: recheck
193 - project-compare-type: ANT
194 project-pattern: '{project}'
196 - branch-compare-type: ANT
197 branch-pattern: '**/{branch}'
202 # TODO: Unify argument names across gerrit-trigger-* macros.
204 name: gerrit-trigger-patch-merged
207 server-name: '{server-name}'
209 - change-merged-event
210 - comment-added-contains-event:
211 comment-contains-value: 'remerge'
213 - project-compare-type: 'ANT'
214 project-pattern: '{name}'
216 - branch-compare-type: 'ANT'
217 branch-pattern: '**/{branch}'
223 # Force Jenkins always vote the values it should already have voted
224 # during the prior verify phase
226 gerrit-build-started-verified-value: 1
227 gerrit-build-successful-verified-value: 1
228 gerrit-build-failed-verified-value: 1
229 gerrit-build-unstable-verified-value: 1
230 gerrit-build-notbuilt-verified-value: 1
231 gerrit-build-started-codereview-value: 0
232 gerrit-build-successful-codereview-value: 0
233 gerrit-build-failed-codereview-value: 0
234 gerrit-build-unstable-codereview-value: 0
235 gerrit-build-notbuilt-codereview-value: 0
237 # TODO: Unify argument names across gerrit-trigger-* macros.
239 name: gerrit-trigger-patch-sonar
242 server-name: '{server-name}'
244 - comment-added-contains-event:
245 comment-contains-value: 'run-sonar'
247 - project-compare-type: 'ANT'
248 project-pattern: '{name}'
250 - branch-compare-type: 'ANT'
251 branch-pattern: '**/master'
259 name: archive-artifacts
262 artifacts: '{artifacts}'
268 name: email-notification
271 recipients: '{email-recipients}'
273 content-type: default
274 subject: '{email-prefix} $PROJECT_NAME - Build # $BUILD_NUMBER - $BUILD_STATUS!'
276 $PROJECT_NAME - Build # $BUILD_NUMBER - $BUILD_STATUS:
278 Please refer to the logs server URL for console logs when possible
279 and use the Jenkins Build URL as a last resort.
282 https://logs.opendaylight.org/$SILO/$JENKINS_HOSTNAME/$JOB_NAME/$BUILD_NUMBER
295 exec-pattern: "**/**.exec"
296 class-pattern: "**/classes"
297 source-pattern: "**/src/main/java"
298 exclusion-pattern: "**/gen/**,**/generated-sources/**,**/yang-gen**,**/pax/**"
309 name: opendaylight-infra-stack
310 # opendaylight-infra-stack.sh has a required variable {stack-template} that
311 # must be passed into this macro.
313 - shell: !include-raw: opendaylight-infra-stack.sh
314 - shell: !include-raw-escape: opendaylight-infra-copy-ssh-keys.sh
317 name: opendaylight-infra-push-gerrit-patch
318 # opendaylight-infra-push-gerrit-patch.sh allows a job to push a patch to
319 # Gerrit in an automated fashion. This is meant for tasks that creates
320 # the same patch regularly and needs the ability to detect if an unreviewed
321 # patch already exists. In which case it will update the existing patch.
323 # Note: This patch assumes the $WORKSPACE contains the project repo with
324 # the files changed already "git add" and waiting for a "git commit" call.
326 # This script requires the following JJB variables to be passed in:
327 # {project} Gerrit project-name
328 # {gerrit-topic} Gerrit topic, please make a unique topic.
329 # {gerrit-commit-message} Commit message to assign to commit.
330 # NOTE: Requires git review to be installed on node.
332 - shell: !include-raw: opendaylight-infra-push-gerrit-patch.sh
335 name: distribute-build-url
336 # Place URL of the current run of a build job to a file at given path.
340 set +e # DO NOT fail script if command returns non-zero.
342 echo "$BUILD_URL" > {path}/build.url
344 # DO NOT fail the build if the echo failed.
348 name: wipe-org-opendaylight-repo
350 - shell: 'if [ -d /tmp/r/org/opendaylight ]; then rm -rf /tmp/r/org/opendaylight; fi'
353 name: wipe-local-maven-repo
355 - shell: 'if [ -d /tmp/r ]; then rm -rf /tmp/r; fi'
358 name: jacoco-nojava-workaround
360 - shell: 'mkdir -p $WORKSPACE/target/classes $WORKSPACE/jacoco/classes'
366 application-name: '{application-name}'
369 name: releng-check-unicode
372 $WORKSPACE/scripts/check-unicode.sh jjb/
375 name: provide-maven-settings
377 - config-file-provider:
379 - file-id: '{global-settings-file}'
380 variable: 'GLOBAL_SETTINGS_FILE'
381 - file-id: '{settings-file}'
382 variable: 'SETTINGS_FILE'
385 name: releng-fetch-p2zip-if-necessary
388 # Cleanup any existing zips and metadata before we download the new update site
391 condition-kind: strings-match
392 condition-string1: '$P2ZIP_URL'
393 condition-string2: ''
394 condition-basedir: workspace
396 # TODO: Figure out latest snapshot version number to pull rather than hardcoding 1.1.1-SNAPSHOT
398 maven-version: '{maven-version}'
400 org.apache.maven.plugins:maven-dependency-plugin:get
401 org.apache.maven.plugins:maven-dependency-plugin:copy
403 -Dartifact=org.opendaylight.yangide:org.opendaylight.yangide.update-site:1.1.1-SNAPSHOT:zip
404 -DoutputDirectory=$WORKSPACE
405 settings: '{settings}'
406 global-settings: '{global-settings}'
409 name: releng-generate-p2pom
411 - shell: !include-raw: include-raw-generate-p2pom.sh
414 name: releng-update-p2composite-metadata
416 - shell: !include-raw: include-raw-update-p2composite-metadata.sh
418 condition-kind: file-exists
419 condition-filename: deploy-composite-repo.xml
420 condition-basedir: workspace
423 maven-version: '{maven-version}'
424 pom: 'deploy-composite-repo.xml'
425 goals: 'clean deploy -V -B -Dmaven.repo.local=/tmp/r'
426 settings: '{settings}'
427 global-settings: '{global-settings}'
430 name: releng-stage-release
432 - shell: !include-raw: include-raw-stage-release.sh
435 # This wrapper is required for all jobs as it configures the wrappers
436 # needed by OpenDaylight infra.
437 name: opendaylight-infra-wrappers
440 - config-file-provider:
443 target: '$HOME/.npmrc'
444 - file-id: rackspace-heat
445 target: '$HOME/.config/openstack/clouds.yaml'
448 timeout: '{build-timeout}'
449 timeout-var: 'BUILD_TIMEOUT'
452 - ssh-agent-credentials:
454 - 'opendaylight-jenkins-ssh'
459 name: packer-validate
461 - config-file-provider:
463 - file-id: 'packer-cloud-env'
468 varfiles="../packer/vars/*"
469 templates="../packer/templates/*"
470 provision="../packer/provision/*.sh"
471 for v in $varfiles; do
472 [[ "${v##*/}" =~ ^(cloud-env.*)$ ]] && continue
473 for t in $templates; do
474 export PACKER_LOG="yes" && \
475 export PACKER_LOG_PATH="packer-validate-${v##*/}-${t##*/}.log" && \
476 packer.io validate -var-file=$CLOUDENV \
478 if [ $? -ne 0 ]; then
487 - config-file-provider:
489 - file-id: 'packer-cloud-env'
494 export PACKER_LOG="yes" && \
495 export PACKER_LOG_PATH="packer-build.log" && \
496 packer.io build -color=false -var-file=$CLOUDENV \
497 -var-file=../packer/vars/{platform}.json \
498 ../packer/templates/{template}.json
499 # Split public and private cloud logs
500 grep -e 'public_cloud' packer-build.log > packer-build_public_cloud.log 2>&1
501 grep -e 'private_cloud' packer-build.log > packer-build_private_cloud.log 2>&1
504 # TODO: Verify signature after downloading users public key from a locally created
505 # repository instead of the public keymesh. This requires a process in place to get ODL
506 # developers public keys into a local repository without increasing the job thoughput.
507 name: verify-gpg-signature
509 - shell: !include-raw: include-raw-verify-gpg-signatures.sh
512 name: opendaylight-infra-jjbini
514 - config-file-provider:
517 target: '$HOME/.config/jenkins_jobs/jenkins_jobs.ini'
520 name: distribution-check-wipe
521 # Step zero: Wipe file repositories up front.
524 echo "wipe r: the local Maven repository"
526 echo "wipe n: the fake remote (Nexus) repository"
528 echo "wipe t: the transient repository used in some manipulations"
532 name: distribution-check-build-project
533 # Step one: Online build of the project, using local repository /tmp/r/ and deploying artifacts to /tmp/n/.
534 # Ordinary SingleFeatureTest failures are detected in the verify job, so we can use "q" profile here.
536 # pom: Relative path to pom file to use. Typically '$GERRIT_PROJECT/pom.xml'.
539 maven-version: 'mvn33'
542 clean deploy dependency:tree
543 -DoutputFile=dependency_tree.txt
545 -DaltDeploymentRepository=fake-nexus::default::file:///tmp/n/
548 - '-Xmx4096m -XX:MaxPermSize=1024m -Dmaven.compile.fork=true'
549 settings: 'integration-settings'
551 global-settings: 'global-settings'
552 global-settings-type: cfp
555 name: distribution-check-verify-groupid
556 # Step two: Verify all deployed artifacts belong to the project's groupId.
557 # This is done by moving the allowed directories out of /tmp/n and checking no files remained there.
558 # The correct directory is derived from $GERRIT_PROJECT.
559 # TODO: Verify all deployed artifacts are snapshots.
561 # gerrit-project: Project name as nexus URI part. Typically '$GERRIT_PROJECT'.
564 mkdir -p /tmp/t/org/opendaylight/{gerrit-project}
565 mv /tmp/n/org/opendaylight/{gerrit-project}/* /tmp/t/org/opendaylight/{gerrit-project}/
566 test -z "`find /tmp/n/ -type f`" || ( echo "ERROR: Mismatched groupId detected (see above)." && false )
571 name: distribution-check-download-deps
572 # Step three: Online build of integration distribution.
573 # This step is mainly used for downloading other project artifacts.
574 # Running SingleFeaturesTest here does not seem to be required, so -Pq is used again.
576 # dist-pom: Relative path to pom file to use. 'distribution/pom.xml' is recommended.
579 maven-version: 'mvn33'
582 clean install dependency:tree
583 -DoutputFile=dependency_tree.txt
587 - '-Xmx1024m -XX:MaxPermSize=256m -Dmaven.compile.fork=true'
588 settings: 'integration-settings'
590 global-settings: 'global-settings'
591 global-settings-type: cfp
594 name: distribution-check-delete-snapshots
595 # Step four: Delete snapshot artifacts from the local repository.
596 # This is critical to detect orphaned artifacts or missing project-internal dependency declarations.
597 # Also other files related to maven repository resolution are removed,
598 # and then empty directories are removed, in order to simplify debugging.
600 - shell: !include-raw-escape: integration-distribution-delete-snaphot-artifacts.sh
603 name: distribution-check-configure-remotes
604 # Now the ugly part. It seems that the only way to tell Maven 2+
605 # which remote repositories to use is via settings.xml file.
606 # So we create such a file here, but it needs most of odlparent:settings.xml
610 <settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
611 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
612 xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
613 https://maven.apache.org/xsd/settings-1.0.0.xsd">
616 <id>opendaylight-release</id>
619 <id>opendaylight-mirror</id>
620 <name>opendaylight</name>
621 <url>https://nexus.opendaylight.org/content/repositories/public/</url>
622 <releases><updatePolicy>never</updatePolicy></releases>
623 <snapshots><enabled>false</enabled></snapshots>
628 <id>opendaylight-plugin-mirror</id>
629 <name>opendaylight-plugin</name>
630 <url>https://nexus.opendaylight.org/content/repositories/public/</url>
631 <releases><updatePolicy>never</updatePolicy></releases>
632 <snapshots><enabled>false</enabled></snapshots>
634 </pluginRepositories>
637 <id>file-snapshots</id>
640 <id>file-snapshots</id>
642 <url>file:///tmp/n/</url>
643 <releases><enabled>false</enabled></releases>
648 <id>file-plugin-snapshots</id>
649 <name>file-plugin</name>
650 <url>file:///tmp/n/</url>
651 <releases><enabled>false</enabled></releases>
653 </pluginRepositories>
657 <activeProfile>file-snapshots</activeProfile>
658 <activeProfile>opendaylight-release</activeProfile>
662 # Notes: The settings are minimal in order to detect breakage scenarios,
663 # while allowing for the following quirks:
664 # * Some plugins seem to have hardcoded repos, for example check-license looks at repository.apache.org
665 # * Some plugin artifacts (related to surefire) are not downloaded when tests are skipped.
666 # * populate-local-repo looks at oss.sonatype.org and does not store things (like guava) to /tmp/r
669 name: distribution-check-repeat-build
670 # Step five: Repeat the distribution build but with the new settings.
671 # Here, only the project snapshot artifacts deployed to /tmp/n are available,
672 # which faithfully reproduces conditions in later verify-like job runs.
673 # We cannot use --offline, because: "Cannot access file (file:///tmp/n) in offline mode"
674 # This is where SingleFeatureTest is not skipped.
676 # dist-pom: Relative path to pom file to use. 'distribution/pom.xml' is recommended.
679 maven-version: 'mvn33'
682 clean install dependency:tree
683 -DoutputFile=dependency_tree.txt -s fake_remotes.xml
688 - '-Xmx1024m -XX:MaxPermSize=256m -Dmaven.compile.fork=true'