4 name: opendaylight-infra-properties
7 days-to-keep: '{build-days-to-keep}'
10 name: opendaylight-infra-parameters
15 description: 'Parameter to identify an ODL Gerrit project'
17 name: ARCHIVE_ARTIFACTS
18 default: '{artifacts} **/target/surefire-reports/*-output.txt **/hs_err_*.log'
19 description: 'Space separated glob patterns for artifacts to archive into logs.opendaylight.org'
23 description: "GERRIT_PROJECT parameter if not given by trigger"
27 description: "JJB configured GERRIT_BRANCH parameter"
31 description: "GERRIT_REFSPEC parameter if not given by trigger"
34 default: '$JOB_NAME-$BUILD_NUMBER'
35 description: "Used by Heat to generate a unique stack & vm name"
43 description: 'Tag in Git to checkout'
46 name: controller-version-parameter
50 default: '{odl_version}'
51 description: 'Controller version (for use with openstacks networking_odl project)'
54 name: patches-to-build-parameter
57 name: PATCHES_TO_BUILD
59 description: 'csv list of patches in project:changeset format to build distribution with'
62 name: distribution-branch-to-build-parameter
65 name: DISTRIBUTION_BRANCH_TO_BUILD
67 description: 'distribution repo branch to build with'
75 description: 'Nexus staging profile id'
78 name: stage-id-parameter
81 name: STAGING_PROFILE_ID
83 description: 'Nexus staging profile id'
90 default: '/w/tools/hudson.tasks.Maven_MavenInstallation/{maven-version}/bin/mvn'
91 description: 'Maven selector to be used by shell scripts'
97 credentials-id: 'opendaylight-jenkins-ssh'
106 name: git-scm-with-submodules
109 credentials-id: 'opendaylight-jenkins-ssh'
113 - 'refs/heads/{branch}'
120 name: gerrit-trigger-scm
123 credentials-id: 'opendaylight-jenkins-ssh'
127 - 'origin/$GERRIT_BRANCH'
129 choosing-strategy: '{choosing-strategy}'
139 # This is a single macro to use for all jobs who vote on every (relevant) patch set.
140 # Only 'recheck' trigger word is supported, it always triggers the full set of relevant jobs,
141 # in order to prevent Jenkins from starting only a subset and still voting Verified+1.
143 # server: name of gerrit server to listen to
144 # project: pattern to match triggering projects
145 # branch: triggering branch name
146 # files: pattern to match triggering filepaths
148 name: gerrit-trigger-patch-submitted
151 server-name: '{server}'
153 - patchset-created-event:
154 exclude-drafts: 'true'
155 exclude-trivial-rebase: 'false'
156 exclude-no-code-change: 'true'
157 - draft-published-event
158 - comment-added-contains-event:
159 comment-contains-value: 'recheck'
161 - project-compare-type: 'ANT'
162 project-pattern: '{project}'
164 - branch-compare-type: 'ANT'
165 branch-pattern: '**/{branch}'
167 - compare-type: 'ANT'
170 # TODO: Unify argument names across gerrit-trigger-* macros.
172 name: gerrit-trigger-patch-merged
175 server-name: '{server-name}'
177 - change-merged-event
178 - comment-added-contains-event:
179 comment-contains-value: 'remerge'
181 - project-compare-type: 'ANT'
182 project-pattern: '{name}'
184 - branch-compare-type: 'ANT'
185 branch-pattern: '**/{branch}'
191 # Force Jenkins always vote the values it should already have voted
192 # during the prior verify phase
194 gerrit-build-started-verified-value: 1
195 gerrit-build-successful-verified-value: 1
196 gerrit-build-failed-verified-value: 1
197 gerrit-build-unstable-verified-value: 1
198 gerrit-build-notbuilt-verified-value: 1
199 gerrit-build-started-codereview-value: 0
200 gerrit-build-successful-codereview-value: 0
201 gerrit-build-failed-codereview-value: 0
202 gerrit-build-unstable-codereview-value: 0
203 gerrit-build-notbuilt-codereview-value: 0
205 # TODO: Unify argument names across gerrit-trigger-* macros.
207 name: gerrit-trigger-patch-sonar
210 server-name: '{server-name}'
212 - comment-added-contains-event:
213 comment-contains-value: 'run-sonar'
215 - project-compare-type: 'ANT'
216 project-pattern: '{name}'
218 - branch-compare-type: 'ANT'
219 branch-pattern: '**/master'
227 name: archive-artifacts
230 artifacts: '{artifacts}'
236 name: email-notification
239 recipients: '{email-recipients}'
241 content-type: default
242 subject: '{email-prefix} $PROJECT_NAME - Build # $BUILD_NUMBER - $BUILD_STATUS!'
244 $PROJECT_NAME - Build # $BUILD_NUMBER - $BUILD_STATUS:
246 Please refer to the logs server URL for console logs when possible
247 and use the Jenkins Build URL as a last resort.
250 https://logs.opendaylight.org/$SILO/$JENKINS_HOSTNAME/$JOB_NAME/$BUILD_NUMBER
263 exec-pattern: "**/**.exec"
264 class-pattern: "**/classes"
265 source-pattern: "**/src/main/java"
266 exclusion-pattern: "**/gen/**,**/generated-sources/**,**/yang-gen**,**/pax/**"
277 name: opendaylight-infra-shiplogs
278 # To archive things the job will need to create a "archives" directory in
279 # the workspace and this macro will handle copying the contents of the
280 # archives directory.
282 # Uses the build parameter ARCHIVE_ARTIFACTS if not empty to find files
283 # to archive. You can pass globstar patterns for example "**/*.xml **/*.log"
284 # as the archive pattern. This is a space separated list of files to archive.
286 # Also ensure that the workspace is cleaned up at the end of the build.
292 if [ -d "$WORKSPACE/.venv-openstack" ]; then
293 source $WORKSPACE/.venv-openstack/bin/activate
294 OS_STATUS=`openstack --os-cloud rackspace stack show -f json -c stack_status $STACK_NAME | jq -r '.stack_status'`
295 if [ "$OS_STATUS" != "CREATE_IN_PROGRESS" ] && [ "$OS_STATUS" != "DELETE_IN_PROGRESS" ]; then
296 openstack --os-cloud rackspace stack delete --yes $STACK_NAME
299 - shell: !include-raw: include-raw-deploy-archives.sh
301 maven-version: '{maven-version}'
302 pom: '.archives/deploy-archives.xml'
303 goals: 'clean deploy -V -B -q -Dmaven.repo.local=/tmp/r'
304 settings: 'jenkins-log-archives-settings'
306 global-settings: 'odl-global-settings'
307 global-settings-type: cfp
308 - description-setter:
309 regexp: '^Build logs: .*'
310 # Cleanup after ourselves
311 - wipe-org-opendaylight-repo
312 script-only-if-succeeded: False
313 script-only-if-failed: False
314 mark-unstable-if-failed: True
317 # Do not clean up *.jenkins-trigger files for jobs that use a
318 # properties file as input for triggering another build.
319 - '**/*.jenkins-trigger'
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.
352 - shell: 'echo "$BUILD_URL" > {path}/build.url'
355 name: wipe-org-opendaylight-repo
357 - shell: 'if [ -d /tmp/r/org/opendaylight ]; then rm -rf /tmp/r/org/opendaylight; fi'
360 name: wipe-local-maven-repo
362 - shell: 'if [ -d /tmp/r ]; then rm -rf /tmp/r; fi'
365 name: jacoco-nojava-workaround
367 - shell: 'mkdir -p $WORKSPACE/target/classes $WORKSPACE/jacoco/classes'
373 application-name: '{application-name}'
376 name: releng-check-unicode
379 $WORKSPACE/scripts/check-unicode.sh jjb/
382 name: provide-maven-settings
384 - config-file-provider:
386 - file-id: '{global-settings-file}'
387 variable: 'GLOBAL_SETTINGS_FILE'
388 - file-id: '{settings-file}'
389 variable: 'SETTINGS_FILE'
392 name: releng-fetch-p2zip-if-necessary
395 # Cleanup any existing zips and metadata before we download the new update site
398 condition-kind: strings-match
399 condition-string1: '$P2ZIP_URL'
400 condition-string2: ''
401 condition-basedir: workspace
403 # TODO: Figure out latest snapshot version number to pull rather than hardcoding 1.1.1-SNAPSHOT
405 maven-version: '{maven-version}'
406 goals: 'org.apache.maven.plugins:maven-dependency-plugin:get org.apache.maven.plugins:maven-dependency-plugin:copy -V -B -Dartifact=org.opendaylight.yangide:org.opendaylight.yangide.update-site:1.1.1-SNAPSHOT:zip -DoutputDirectory=$WORKSPACE'
407 settings: '{settings}'
408 global-settings: '{global-settings}'
411 name: releng-generate-p2pom
413 - shell: !include-raw: include-raw-generate-p2pom.sh
416 name: releng-update-p2composite-metadata
418 - shell: !include-raw: include-raw-update-p2composite-metadata.sh
420 condition-kind: file-exists
421 condition-filename: deploy-composite-repo.xml
422 condition-basedir: workspace
425 maven-version: '{maven-version}'
426 pom: 'deploy-composite-repo.xml'
427 goals: 'clean deploy -V -B -Dmaven.repo.local=/tmp/r'
428 settings: '{settings}'
429 global-settings: '{global-settings}'
432 name: releng-stage-release
434 - shell: !include-raw: include-raw-stage-release.sh
437 # This wrapper is required for all jobs as it configures the wrappers
438 # needed by OpenDaylight infra.
439 name: opendaylight-infra-wrappers
442 - config-file-provider:
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'
467 varfiles="../packer/vars/*"
468 templates="../packer/templates/*"
469 provision="../packer/provision/*.sh"
470 for v in $varfiles; do
471 [[ "${v##*/}" =~ ^(cloud-env.*)$ ]] && continue
472 for t in $templates; do
473 export PACKER_LOG="yes" && \
474 export PACKER_LOG_PATH="packer-validate-${v##*/}-${t##*/}.log" && \
475 packer.io validate -var-file=$CLOUDENV \
477 if [ $? -ne 0 ]; then
482 for p in $provision; do
483 /bin/bash -n $p > provision-validate-${p##*/}.log 2>&1
490 - config-file-provider:
492 - file-id: 'packer-cloud-env'
496 export PACKER_LOG="yes" && \
497 export PACKER_LOG_PATH="packer-build.log" && \
498 packer.io build -var-file=$CLOUDENV \
499 -var-file=../packer/vars/{platform}.json \
500 ../packer/templates/{template}.json
503 # TODO: Verify signature after downloading users public key from a locally created
504 # repository instead of the public keymesh. This requires a process in place to get ODL
505 # developers public keys into a local repository without increasing the job thoughput.
506 name: verify-gpg-signature
508 - shell: !include-raw: include-raw-verify-gpg-signatures.sh