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 # Before adding more here, beware of https://jira.linuxfoundation.org/browse/RELENG-280
27 **/target/surefire-reports/*-output.txt
28 **/target/failsafe-reports/failsafe-summary.xml
30 **/target/feature/feature.xml
32 description: 'Space separated glob patterns for artifacts to archive into logs.opendaylight.org'
36 description: "GERRIT_PROJECT parameter if not given by trigger"
40 description: "JJB configured GERRIT_BRANCH parameter"
44 description: "GERRIT_REFSPEC parameter if not given by trigger"
47 default: '$SILO-$JOB_NAME-$BUILD_NUMBER'
48 description: "Used by Heat to generate a unique stack & vm name"
53 The name of a cloud configuration in clouds.yaml. OS_CLOUD is a
54 variable name that is significant to openstack client as a
55 environment variable. Please refer to the documentation for
57 https://docs.openstack.org/developer/python-openstackclient/
65 description: 'Tag in Git to checkout'
68 name: controller-version-parameter
72 default: '{odl_version}'
73 description: 'Controller version (for use with openstacks networking_odl project)'
76 name: patches-to-build-parameter
79 name: PATCHES_TO_BUILD
82 Patches to add to distro in CSV project:changeset format (genius:32/53632/9,netvirt:59/50259/47)
85 name: run-test-parameter
90 description: 'Set true to run test after build'
93 name: distribution-branch-to-build-parameter
96 name: DISTRIBUTION_BRANCH_TO_BUILD
98 description: 'distribution repo branch to build with'
101 name: p2zip-parameter
106 description: 'Nexus staging profile id'
109 name: stage-id-parameter
112 name: STAGING_PROFILE_ID
113 default: '{stage-id}'
114 description: 'Nexus staging profile id'
121 default: '/w/tools/hudson.tasks.Maven_MavenInstallation/{maven-version}/bin/mvn'
122 description: 'Maven selector to be used by shell scripts'
128 credentials-id: 'opendaylight-jenkins-ssh'
137 name: git-scm-with-submodules
140 credentials-id: 'opendaylight-jenkins-ssh'
144 - 'refs/heads/{branch}'
151 name: gerrit-trigger-scm
154 credentials-id: 'opendaylight-jenkins-ssh'
158 - 'origin/$GERRIT_BRANCH'
160 choosing-strategy: '{choosing-strategy}'
170 # This is a single macro to use for all jobs who vote on every (relevant) patch set.
171 # Only 'recheck' trigger word is supported, it always triggers the full set of relevant jobs,
172 # in order to prevent Jenkins from starting only a subset and still voting Verified+1.
174 # server: name of gerrit server to listen to
175 # project: pattern to match triggering projects
176 # branch: triggering branch name
177 # files: pattern to match triggering filepaths
179 name: gerrit-trigger-patch-submitted
182 server-name: '{server}'
184 - patchset-created-event:
186 exclude-trivial-rebase: false
187 exclude-no-code-change: false
188 - draft-published-event
189 - comment-added-contains-event:
190 comment-contains-value: recheck
192 - project-compare-type: ANT
193 project-pattern: '{project}'
195 - branch-compare-type: ANT
196 branch-pattern: '**/{branch}'
201 # TODO: Unify argument names across gerrit-trigger-* macros.
203 name: gerrit-trigger-patch-merged
206 server-name: '{server-name}'
208 - change-merged-event
209 - comment-added-contains-event:
210 comment-contains-value: 'remerge'
212 - project-compare-type: 'ANT'
213 project-pattern: '{name}'
215 - branch-compare-type: 'ANT'
216 branch-pattern: '**/{branch}'
222 # Force Jenkins always vote the values it should already have voted
223 # during the prior verify phase
225 gerrit-build-started-verified-value: 1
226 gerrit-build-successful-verified-value: 1
227 gerrit-build-failed-verified-value: 1
228 gerrit-build-unstable-verified-value: 1
229 gerrit-build-notbuilt-verified-value: 1
230 gerrit-build-started-codereview-value: 0
231 gerrit-build-successful-codereview-value: 0
232 gerrit-build-failed-codereview-value: 0
233 gerrit-build-unstable-codereview-value: 0
234 gerrit-build-notbuilt-codereview-value: 0
236 # TODO: Unify argument names across gerrit-trigger-* macros.
238 name: gerrit-trigger-patch-sonar
241 server-name: '{server-name}'
243 - comment-added-contains-event:
244 comment-contains-value: 'run-sonar'
246 - project-compare-type: 'ANT'
247 project-pattern: '{name}'
249 - branch-compare-type: 'ANT'
250 branch-pattern: '**/master'
258 name: archive-artifacts
261 artifacts: '{artifacts}'
267 name: email-notification
270 recipients: '{email-recipients}'
272 content-type: default
273 subject: '{email-prefix} $PROJECT_NAME - Build # $BUILD_NUMBER - $BUILD_STATUS!'
275 $PROJECT_NAME - Build # $BUILD_NUMBER - $BUILD_STATUS:
277 Please refer to the logs server URL for console logs when possible
278 and use the Jenkins Build URL as a last resort.
281 https://logs.opendaylight.org/$SILO/$JENKINS_HOSTNAME/$JOB_NAME/$BUILD_NUMBER
294 exec-pattern: "**/**.exec"
295 class-pattern: "**/classes"
296 source-pattern: "**/src/main/java"
297 exclusion-pattern: "**/gen/**,**/generated-sources/**,**/yang-gen**,**/pax/**"
308 # Deploys a maven site to Nexus using lftools nexus-zip command
309 name: opendaylight-infra-deploy-maven-site
311 - lf-provide-maven-settings:
312 global-settings-file: global-settings
313 settings-file: '{settings-file}'
314 - lf-infra-create-netrc:
315 server-id: opendaylight-site
316 - shell: !include-raw-escape:
317 - global-jjb/shell/lftools-install.sh
318 - opendaylight-infra-deploy-maven-site.sh
319 - lf-provide-maven-settings-cleanup
322 name: opendaylight-infra-stack
323 # opendaylight-infra-stack.sh has a required variable {stack-template} that
324 # must be passed into this macro.
326 - shell: !include-raw: opendaylight-infra-stack.sh
327 - shell: !include-raw-escape: opendaylight-infra-copy-ssh-keys.sh
330 name: opendaylight-infra-push-gerrit-patch
331 # opendaylight-infra-push-gerrit-patch.sh allows a job to push a patch to
332 # Gerrit in an automated fashion. This is meant for tasks that creates
333 # the same patch regularly and needs the ability to detect if an unreviewed
334 # patch already exists. In which case it will update the existing patch.
336 # Note: This patch assumes the $WORKSPACE contains the project repo with
337 # the files changed already "git add" and waiting for a "git commit" call.
339 # This script requires the following JJB variables to be passed in:
340 # {project} Gerrit project-name
341 # {gerrit-topic} Gerrit topic, please make a unique topic.
342 # {gerrit-commit-message} Commit message to assign to commit.
343 # NOTE: Requires git review to be installed on node.
345 - shell: !include-raw: opendaylight-infra-push-gerrit-patch.sh
348 name: distribute-build-url
349 # Place URL of the current run of a build job to a file at given path.
353 set +e # DO NOT fail script if command returns non-zero.
355 echo "$BUILD_URL" > {path}/build.url
357 # DO NOT fail the build if the echo failed.
361 name: wipe-org-opendaylight-repo
363 - shell: 'if [ -d /tmp/r/org/opendaylight ]; then rm -rf /tmp/r/org/opendaylight; fi'
366 name: wipe-local-maven-repo
368 - shell: 'if [ -d /tmp/r ]; then rm -rf /tmp/r; fi'
371 name: jacoco-nojava-workaround
373 - shell: 'mkdir -p $WORKSPACE/target/classes $WORKSPACE/jacoco/classes'
379 application-name: '{application-name}'
382 name: releng-check-unicode
385 $WORKSPACE/scripts/check-unicode.sh jjb/
388 name: provide-maven-settings
390 - config-file-provider:
392 - file-id: '{global-settings-file}'
393 variable: 'GLOBAL_SETTINGS_FILE'
394 - file-id: '{settings-file}'
395 variable: 'SETTINGS_FILE'
398 name: releng-fetch-p2zip-if-necessary
401 # Cleanup any existing zips and metadata before we download the new update site
404 condition-kind: strings-match
405 condition-string1: '$P2ZIP_URL'
406 condition-string2: ''
407 condition-basedir: workspace
409 # TODO: Figure out latest snapshot version number to pull rather than hardcoding 1.1.1-SNAPSHOT
411 maven-version: '{maven-version}'
413 org.apache.maven.plugins:maven-dependency-plugin:get
414 org.apache.maven.plugins:maven-dependency-plugin:copy
416 -Dartifact=org.opendaylight.yangide:org.opendaylight.yangide.update-site:1.1.1-SNAPSHOT:zip
417 -DoutputDirectory=$WORKSPACE
418 settings: '{settings}'
419 global-settings: '{global-settings}'
422 name: releng-generate-p2pom
424 - shell: !include-raw: include-raw-generate-p2pom.sh
427 name: releng-update-p2composite-metadata
429 - shell: !include-raw: include-raw-update-p2composite-metadata.sh
431 condition-kind: file-exists
432 condition-filename: deploy-composite-repo.xml
433 condition-basedir: workspace
436 maven-version: '{maven-version}'
437 pom: 'deploy-composite-repo.xml'
438 goals: 'clean deploy -V -B -Dmaven.repo.local=/tmp/r'
439 settings: '{settings}'
440 global-settings: '{global-settings}'
443 name: releng-stage-release
445 - shell: !include-raw: include-raw-stage-release.sh
448 # This wrapper is required for all jobs as it configures the wrappers
449 # needed by OpenDaylight infra.
450 name: opendaylight-infra-wrappers
453 - config-file-provider:
456 target: '$HOME/.npmrc'
457 - file-id: rackspace-heat
458 target: '$HOME/.config/openstack/clouds.yaml'
461 timeout: '{build-timeout}'
462 timeout-var: 'BUILD_TIMEOUT'
465 - ssh-agent-credentials:
467 - 'opendaylight-jenkins-ssh'
472 name: packer-validate
474 - config-file-provider:
476 - file-id: 'packer-cloud-env'
480 # Ensure we fail the job if any steps fail.
483 varfiles="../packer/vars/*"
484 templates="../packer/templates/*"
485 provision="../packer/provision/*.sh"
486 for v in $varfiles; do
487 [[ "${v##*/}" =~ ^(cloud-env.*)$ ]] && continue
488 for t in $templates; do
489 export PACKER_LOG="yes" && \
490 export PACKER_LOG_PATH="packer-validate-${v##*/}-${t##*/}.log" && \
491 packer.io validate -var-file=$CLOUDENV \
493 if [ $? -ne 0 ]; then
502 - config-file-provider:
504 - file-id: 'packer-cloud-env'
508 # Ensure we fail the job if any steps fail.
511 export PACKER_LOG="yes" && \
512 export PACKER_LOG_PATH="packer-build.log" && \
513 packer.io build -color=false -var-file=$CLOUDENV \
514 -var-file=../packer/vars/{platform}.json \
515 ../packer/templates/{template}.json
516 # Split public and private cloud logs
517 grep -e 'public_cloud' packer-build.log > packer-build_public_cloud.log 2>&1
518 grep -e 'private_cloud' packer-build.log > packer-build_private_cloud.log 2>&1
521 # TODO: Verify signature after downloading users public key from a locally created
522 # repository instead of the public keymesh. This requires a process in place to get ODL
523 # developers public keys into a local repository without increasing the job thoughput.
524 name: verify-gpg-signature
526 - shell: !include-raw: include-raw-verify-gpg-signatures.sh
529 name: opendaylight-infra-jjbini
531 - config-file-provider:
534 target: '$HOME/.config/jenkins_jobs/jenkins_jobs.ini'
537 name: distribution-check-wipe
538 # Step zero: Wipe file repositories up front.
541 echo "wipe r: the local Maven repository"
543 echo "wipe n: the fake remote (Nexus) repository"
545 echo "wipe t: the transient repository used in some manipulations"
549 name: distribution-check-build-project
550 # Step one: Online build of the project, using local repository /tmp/r/ and deploying artifacts to /tmp/n/.
551 # Ordinary SingleFeatureTest failures are detected in the verify job, so we can use "q" profile here.
553 # pom: Relative path to pom file to use. Typically '$GERRIT_PROJECT/pom.xml'.
556 maven-version: 'mvn33'
559 clean deploy dependency:tree
560 -DoutputFile=dependency_tree.txt
562 -DaltDeploymentRepository=fake-nexus::default::file:///tmp/n/
565 - '-Xmx4096m -XX:MaxPermSize=1024m -Dmaven.compile.fork=true'
566 settings: 'integration-settings'
568 global-settings: 'global-settings'
569 global-settings-type: cfp
572 name: distribution-check-verify-groupid
573 # Step two: Verify all deployed artifacts belong to the project's groupId.
574 # This is done by moving the allowed directories out of /tmp/n and checking no files remained there.
575 # The correct directory is derived from $GERRIT_PROJECT.
576 # TODO: Verify all deployed artifacts are snapshots.
578 # gerrit-project: Project name as nexus URI part. Typically '$GERRIT_PROJECT'.
581 mkdir -p /tmp/t/org/opendaylight/{gerrit-project}
582 mv /tmp/n/org/opendaylight/{gerrit-project}/* /tmp/t/org/opendaylight/{gerrit-project}/
583 test -z "`find /tmp/n/ -type f`" || ( echo "ERROR: Mismatched groupId detected (see above)." && false )
588 name: distribution-check-download-deps
589 # Step three: Online build of integration distribution.
590 # This step is mainly used for downloading other project artifacts.
591 # Running SingleFeaturesTest here does not seem to be required, so -Pq is used again.
593 # dist-pom: Relative path to pom file to use. 'distribution/pom.xml' is recommended.
596 maven-version: 'mvn33'
599 clean install dependency:tree
600 -DoutputFile=dependency_tree.txt
604 - '-Xmx1024m -XX:MaxPermSize=256m -Dmaven.compile.fork=true'
605 settings: 'integration-settings'
607 global-settings: 'global-settings'
608 global-settings-type: cfp
611 name: distribution-check-delete-snapshots
612 # Step four: Delete snapshot artifacts from the local repository.
613 # This is critical to detect orphaned artifacts or missing project-internal dependency declarations.
614 # Also other files related to maven repository resolution are removed,
615 # and then empty directories are removed, in order to simplify debugging.
617 - shell: !include-raw-escape: integration-distribution-delete-snaphot-artifacts.sh
620 name: distribution-check-configure-remotes
621 # Now the ugly part. It seems that the only way to tell Maven 2+
622 # which remote repositories to use is via settings.xml file.
623 # So we create such a file here, but it needs most of odlparent:settings.xml
627 <settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
628 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
629 xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
630 https://maven.apache.org/xsd/settings-1.0.0.xsd">
633 <id>opendaylight-release</id>
636 <id>opendaylight-mirror</id>
637 <name>opendaylight</name>
638 <url>https://nexus.opendaylight.org/content/repositories/public/</url>
639 <releases><updatePolicy>never</updatePolicy></releases>
640 <snapshots><enabled>false</enabled></snapshots>
645 <id>opendaylight-plugin-mirror</id>
646 <name>opendaylight-plugin</name>
647 <url>https://nexus.opendaylight.org/content/repositories/public/</url>
648 <releases><updatePolicy>never</updatePolicy></releases>
649 <snapshots><enabled>false</enabled></snapshots>
651 </pluginRepositories>
654 <id>file-snapshots</id>
657 <id>file-snapshots</id>
659 <url>file:///tmp/n/</url>
660 <releases><enabled>false</enabled></releases>
665 <id>file-plugin-snapshots</id>
666 <name>file-plugin</name>
667 <url>file:///tmp/n/</url>
668 <releases><enabled>false</enabled></releases>
670 </pluginRepositories>
674 <activeProfile>file-snapshots</activeProfile>
675 <activeProfile>opendaylight-release</activeProfile>
679 # Notes: The settings are minimal in order to detect breakage scenarios,
680 # while allowing for the following quirks:
681 # * Some plugins seem to have hardcoded repos, for example check-license looks at repository.apache.org
682 # * Some plugin artifacts (related to surefire) are not downloaded when tests are skipped.
683 # * populate-local-repo looks at oss.sonatype.org and does not store things (like guava) to /tmp/r
686 name: distribution-check-repeat-build
687 # Step five: Repeat the distribution build but with the new settings.
688 # Here, only the project snapshot artifacts deployed to /tmp/n are available,
689 # which faithfully reproduces conditions in later verify-like job runs.
690 # We cannot use --offline, because: "Cannot access file (file:///tmp/n) in offline mode"
691 # This is where SingleFeatureTest is not skipped.
693 # dist-pom: Relative path to pom file to use. 'distribution/pom.xml' is recommended.
696 maven-version: 'mvn33'
699 clean install dependency:tree
700 -DoutputFile=dependency_tree.txt -s fake_remotes.xml
705 - '-Xmx1024m -XX:MaxPermSize=256m -Dmaven.compile.fork=true'