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 # Deploys a maven site to Nexus using lftools nexus-zip command
310 name: opendaylight-infra-deploy-maven-site
312 - lf-provide-maven-settings:
313 global-settings-file: global-settings
314 settings-file: '{settings-file}'
315 - lf-infra-create-netrc:
316 server-id: opendaylight-site
317 - shell: !include-raw-escape:
318 - global-jjb/shell/lftools-install.sh
319 - opendaylight-infra-deploy-maven-site.sh
320 - lf-provide-maven-settings-cleanup
323 name: opendaylight-infra-stack
324 # opendaylight-infra-stack.sh has a required variable {stack-template} that
325 # must be passed into this macro.
327 - shell: !include-raw: opendaylight-infra-stack.sh
328 - shell: !include-raw-escape: opendaylight-infra-copy-ssh-keys.sh
331 name: opendaylight-infra-push-gerrit-patch
332 # opendaylight-infra-push-gerrit-patch.sh allows a job to push a patch to
333 # Gerrit in an automated fashion. This is meant for tasks that creates
334 # the same patch regularly and needs the ability to detect if an unreviewed
335 # patch already exists. In which case it will update the existing patch.
337 # Note: This patch assumes the $WORKSPACE contains the project repo with
338 # the files changed already "git add" and waiting for a "git commit" call.
340 # This script requires the following JJB variables to be passed in:
341 # {project} Gerrit project-name
342 # {gerrit-topic} Gerrit topic, please make a unique topic.
343 # {gerrit-commit-message} Commit message to assign to commit.
344 # NOTE: Requires git review to be installed on node.
346 - shell: !include-raw: opendaylight-infra-push-gerrit-patch.sh
349 name: distribute-build-url
350 # Place URL of the current run of a build job to a file at given path.
354 set +e # DO NOT fail script if command returns non-zero.
356 echo "$BUILD_URL" > {path}/build.url
358 # DO NOT fail the build if the echo failed.
362 name: wipe-org-opendaylight-repo
364 - shell: 'if [ -d /tmp/r/org/opendaylight ]; then rm -rf /tmp/r/org/opendaylight; fi'
367 name: wipe-local-maven-repo
369 - shell: 'if [ -d /tmp/r ]; then rm -rf /tmp/r; fi'
372 name: jacoco-nojava-workaround
374 - shell: 'mkdir -p $WORKSPACE/target/classes $WORKSPACE/jacoco/classes'
380 application-name: '{application-name}'
383 name: releng-check-unicode
386 $WORKSPACE/scripts/check-unicode.sh jjb/
389 name: provide-maven-settings
391 - config-file-provider:
393 - file-id: '{global-settings-file}'
394 variable: 'GLOBAL_SETTINGS_FILE'
395 - file-id: '{settings-file}'
396 variable: 'SETTINGS_FILE'
399 name: releng-fetch-p2zip-if-necessary
402 # Cleanup any existing zips and metadata before we download the new update site
405 condition-kind: strings-match
406 condition-string1: '$P2ZIP_URL'
407 condition-string2: ''
408 condition-basedir: workspace
410 # TODO: Figure out latest snapshot version number to pull rather than hardcoding 1.1.1-SNAPSHOT
412 maven-version: '{maven-version}'
414 org.apache.maven.plugins:maven-dependency-plugin:get
415 org.apache.maven.plugins:maven-dependency-plugin:copy
417 -Dartifact=org.opendaylight.yangide:org.opendaylight.yangide.update-site:1.1.1-SNAPSHOT:zip
418 -DoutputDirectory=$WORKSPACE
419 settings: '{settings}'
420 global-settings: '{global-settings}'
423 name: releng-generate-p2pom
425 - shell: !include-raw: include-raw-generate-p2pom.sh
428 name: releng-update-p2composite-metadata
430 - shell: !include-raw: include-raw-update-p2composite-metadata.sh
432 condition-kind: file-exists
433 condition-filename: deploy-composite-repo.xml
434 condition-basedir: workspace
437 maven-version: '{maven-version}'
438 pom: 'deploy-composite-repo.xml'
439 goals: 'clean deploy -V -B -Dmaven.repo.local=/tmp/r'
440 settings: '{settings}'
441 global-settings: '{global-settings}'
444 name: releng-stage-release
446 - shell: !include-raw: include-raw-stage-release.sh
449 # This wrapper is required for all jobs as it configures the wrappers
450 # needed by OpenDaylight infra.
451 name: opendaylight-infra-wrappers
454 - config-file-provider:
457 target: '$HOME/.npmrc'
458 - file-id: rackspace-heat
459 target: '$HOME/.config/openstack/clouds.yaml'
462 timeout: '{build-timeout}'
463 timeout-var: 'BUILD_TIMEOUT'
466 - ssh-agent-credentials:
468 - 'opendaylight-jenkins-ssh'
473 name: packer-validate
475 - config-file-provider:
477 - file-id: 'packer-cloud-env'
481 # Ensure we fail the job if any steps fail.
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
503 - config-file-provider:
505 - file-id: 'packer-cloud-env'
509 # Ensure we fail the job if any steps fail.
512 export PACKER_LOG="yes" && \
513 export PACKER_LOG_PATH="packer-build.log" && \
514 packer.io build -color=false -var-file=$CLOUDENV \
515 -var-file=../packer/vars/{platform}.json \
516 ../packer/templates/{template}.json
517 # Split public and private cloud logs
518 grep -e 'public_cloud' packer-build.log > packer-build_public_cloud.log 2>&1
519 grep -e 'private_cloud' packer-build.log > packer-build_private_cloud.log 2>&1
522 # TODO: Verify signature after downloading users public key from a locally created
523 # repository instead of the public keymesh. This requires a process in place to get ODL
524 # developers public keys into a local repository without increasing the job thoughput.
525 name: verify-gpg-signature
527 - shell: !include-raw: include-raw-verify-gpg-signatures.sh
530 name: opendaylight-infra-jjbini
532 - config-file-provider:
535 target: '$HOME/.config/jenkins_jobs/jenkins_jobs.ini'
538 name: distribution-check-wipe
539 # Step zero: Wipe file repositories up front.
542 echo "wipe r: the local Maven repository"
544 echo "wipe n: the fake remote (Nexus) repository"
546 echo "wipe t: the transient repository used in some manipulations"
550 name: distribution-check-build-project
551 # Step one: Online build of the project, using local repository /tmp/r/ and deploying artifacts to /tmp/n/.
552 # Ordinary SingleFeatureTest failures are detected in the verify job, so we can use "q" profile here.
554 # pom: Relative path to pom file to use. Typically '$GERRIT_PROJECT/pom.xml'.
557 maven-version: 'mvn33'
560 clean deploy dependency:tree
561 -DoutputFile=dependency_tree.txt
563 -DaltDeploymentRepository=fake-nexus::default::file:///tmp/n/
566 - '-Xmx4096m -XX:MaxPermSize=1024m -Dmaven.compile.fork=true'
567 settings: 'integration-settings'
569 global-settings: '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
605 - '-Xmx1024m -XX:MaxPermSize=256m -Dmaven.compile.fork=true'
606 settings: 'integration-settings'
608 global-settings: 'global-settings'
609 global-settings-type: cfp
612 name: distribution-check-delete-snapshots
613 # Step four: Delete snapshot artifacts from the local repository.
614 # This is critical to detect orphaned artifacts or missing project-internal dependency declarations.
615 # Also other files related to maven repository resolution are removed,
616 # and then empty directories are removed, in order to simplify debugging.
618 - shell: !include-raw-escape: integration-distribution-delete-snaphot-artifacts.sh
621 name: distribution-check-configure-remotes
622 # Now the ugly part. It seems that the only way to tell Maven 2+
623 # which remote repositories to use is via settings.xml file.
624 # So we create such a file here, but it needs most of odlparent:settings.xml
628 <settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
629 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
630 xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
631 https://maven.apache.org/xsd/settings-1.0.0.xsd">
634 <id>opendaylight-release</id>
637 <id>opendaylight-mirror</id>
638 <name>opendaylight</name>
639 <url>https://nexus.opendaylight.org/content/repositories/public/</url>
640 <releases><updatePolicy>never</updatePolicy></releases>
641 <snapshots><enabled>false</enabled></snapshots>
646 <id>opendaylight-plugin-mirror</id>
647 <name>opendaylight-plugin</name>
648 <url>https://nexus.opendaylight.org/content/repositories/public/</url>
649 <releases><updatePolicy>never</updatePolicy></releases>
650 <snapshots><enabled>false</enabled></snapshots>
652 </pluginRepositories>
655 <id>file-snapshots</id>
658 <id>file-snapshots</id>
660 <url>file:///tmp/n/</url>
661 <releases><enabled>false</enabled></releases>
666 <id>file-plugin-snapshots</id>
667 <name>file-plugin</name>
668 <url>file:///tmp/n/</url>
669 <releases><enabled>false</enabled></releases>
671 </pluginRepositories>
675 <activeProfile>file-snapshots</activeProfile>
676 <activeProfile>opendaylight-release</activeProfile>
680 # Notes: The settings are minimal in order to detect breakage scenarios,
681 # while allowing for the following quirks:
682 # * Some plugins seem to have hardcoded repos, for example check-license looks at repository.apache.org
683 # * Some plugin artifacts (related to surefire) are not downloaded when tests are skipped.
684 # * populate-local-repo looks at oss.sonatype.org and does not store things (like guava) to /tmp/r
687 name: distribution-check-repeat-build
688 # Step five: Repeat the distribution build but with the new settings.
689 # Here, only the project snapshot artifacts deployed to /tmp/n are available,
690 # which faithfully reproduces conditions in later verify-like job runs.
691 # We cannot use --offline, because: "Cannot access file (file:///tmp/n) in offline mode"
692 # This is where SingleFeatureTest is not skipped.
694 # dist-pom: Relative path to pom file to use. 'distribution/pom.xml' is recommended.
697 maven-version: 'mvn33'
700 clean install dependency:tree
701 -DoutputFile=dependency_tree.txt -s fake_remotes.xml
706 - '-Xmx1024m -XX:MaxPermSize=256m -Dmaven.compile.fork=true'