+# TODO: Make all bash constants more readable.
+# e.g.: DISTRIBUTION_BRANCH instead of DISTROBRANCH.
+
- parameter:
- name: integration-branch
+ name: integration-distribution-branch
parameters:
- string:
- name: BRANCH
+ name: DISTROBRANCH
default: '{branch}'
description: 'Distribution GIT branch'
parameters:
- string:
name: DISTROGITURL
- default: 'ssh://jenkins-$SILO@git.opendaylight.org:29418/integration/distribution'
+ default: '{git-url}/integration/distribution'
description: 'Distribution GIT URL (do not modify)'
- parameter:
skip-tag: true
# Macro: integration-trigger-patch-submitted
-# Operation: this macro sets a trigger for patch submitted on a path pattern
-# Used by: {project}-verify-csit-* job templates
-
+# This is a single macro to use for all csit jobs who vote on every (relevant) patch set.
+# Only 'recheck' trigger word is supported, it always triggers the full set of relevant jobs,
+# in order to prevent Jenkins from starting only a subset and still voting Verified+1.
+# Contrary to gerrit-trigger-patch-submitted, this votes +1 also on unstable runs.
+# Arguments:
+# server: name of gerrit server to listen to
+# project: pattern to match triggering projects
+# branch: triggering branch name
+# files: pattern to match triggering filepaths
- trigger:
name: integration-trigger-patch-submitted
triggers:
- gerrit:
- server-name: 'OpenDaylight'
+ server-name: '{server}'
trigger-on:
- patchset-created-event:
exclude-drafts: 'true'
- draft-published-event
- comment-added-contains-event:
comment-contains-value: 'recheck'
- - comment-added-contains-event:
- comment-contains-value: 'reverify'
override-votes: true
gerrit-build-unstable-verified-value: +1
gerrit-build-unstable-codereview-value: 0
projects:
- - project-compare-type: 'ANT'
- project-pattern: '{name}'
- branches:
- - branch-compare-type: 'ANT'
- branch-pattern: '**/{branch}'
- file-paths:
- - compare-type: 'ANT'
- pattern: '{pattern}'
-
-# Macro: integration-trigger-patch-merged
-# Operation: this macro sets a trigger for patch merged on a path pattern
-# Used by: not used yet
-
-- trigger:
- name: integration-trigger-patch-merged
- triggers:
- - gerrit:
- server-name: 'OpenDaylight'
- trigger-on:
- - change-merged-event
- - comment-added-contains-event:
- comment-contains-value: 'remerge'
- projects:
- - project-compare-type: 'ANT'
- project-pattern: '{name}'
- branches:
- - branch-compare-type: 'ANT'
- branch-pattern: '**/{branch}'
- file-paths:
- - compare-type: 'ANT'
- pattern: '{pattern}'
-
-# Macro: integration-csit-only
-# Operation: this macro sets a trigger on reverse job list
-# Used by: csit -only- job templates
-
-- trigger:
- name: integration-csit-only
- triggers:
- - reverse:
- jobs: '{jobs}'
- result: 'success'
-
-# Macro: integration-csit-all
-# Operation: this macro sets a periodic trigger
-# Used by: csit -all- job teamplates
-
-- trigger:
- name: integration-csit-all
- triggers:
- - timed: 'H H * * *'
-
-# Macro: integration-jclouds-controller-mininet
-# Operation: this macro will spin the controller and mininet vms
-# Used by: {project}-csit-* job templates
-
-- wrapper:
- name: integration-jclouds-controller-mininet
- wrappers:
- - jclouds:
- instances:
- - '{controller-image}':
- cloud-name: 'ODLPUB'
- count: '{controller-vms}'
- - '{mininet-image}':
- cloud-name: 'ODLPUB'
- count: '{mininet-vms}'
+ - project-compare-type: 'ANT'
+ project-pattern: '{project}'
+ branches:
+ - branch-compare-type: 'ANT'
+ branch-pattern: '**/{branch}'
+ file-paths:
+ - compare-type: 'ANT'
+ pattern: '{files}'
# Macro: integration-openstack-controller-mininet
# Operation: this macro will spin the controller and mininet vms
template-name: '{mininet-image}'
count: '{mininet-vms}'
-# Macro: integration-jclouds-controller-devstack
-# Operation: this macro will spin the controller and devstack vms
-# Used by: {project}-csit-openstack job templates
-- wrapper:
- name: integration-jclouds-controller-devstack
- wrappers:
- - jclouds:
- instances:
- - '{controller-image}':
- cloud-name: 'ODLPUB'
- count: '{controller-vms}'
- - '{openstack-image}':
- cloud-name: 'ODLPUB'
- count: '{openstack-vms}'
-
# Macro: integration-openstack-controller-devstack
# Operation: this macro will spin the controller and devstack vms
# Used by: {project}-csit-openstack job templates
# Shell Scripts #
#################
-# Macro: integration-copy-ssh-keys
-# Operation: Copy ssh public key used as authentication for robot
+# Macro: integration-infra-stack
+# Operation: Sets environment and then calls opendaylight-infra-stack to spin
+# up csit lab using openstack-heat.
+# Used by: {project}-csit-* job templates
+
+- builder:
+ name: integration-infra-stack
+ builders:
+ - integration-cleanup-workspace
+ - shell: |
+ #!/bin/bash
+ # Setup openstack envirnoment file for use by
+ # the opendaylight-infra-stack macro
+ cat > $WORKSPACE/opendaylight-infra-environment.yaml << EOF
+ parameters:
+ vm_0_count: {vm_0_count}
+ vm_0_flavor: {vm_0_flavor}
+ vm_0_image: {vm_0_image}
+ vm_1_count: {vm_1_count}
+ vm_1_flavor: {vm_1_flavor}
+ vm_1_image: {vm_1_image}
+ EOF
+ echo "Contents of opendaylight-infra-environment.yaml ..."
+ cat $WORKSPACE/opendaylight-infra-environment.yaml
+ - opendaylight-infra-stack:
+ stack-template: '{stack-template}'
+
+# Macro: integration-infra-stack-3-type
+# Operation: Sets environment and then calls opendaylight-infra-stack to spin
+# up csit lab using openstack-heat.
# Used by: {project}-csit-* job templates
- builder:
- name: integration-copy-ssh-keys
+ name: integration-infra-stack-3-type
builders:
+ - integration-cleanup-workspace
- shell: |
#!/bin/bash
- function copy-ssh-keys-to-slave() {
- RETRIES=60
- for j in $(seq 1 $RETRIES); do
- if `ssh-copy-id -i /home/jenkins/.ssh/id_rsa.pub "jenkins@${i}" > /dev/null 2>&1`; then
- ssh jenkins@${i} 'echo "$(facter ipaddress_eth0) $(/bin/hostname)" | sudo tee -a /etc/hosts'
- echo "Successfully copied public keys to slave ${i}"
- break
- elif [ $j -eq $RETRIES ]; then
- echo "SSH not responding on ${i} after $RETIRES tries. Giving up."
- exit 1
- else
- echo "SSH not responding on ${i}. Retrying in 10 seconds..."
- sleep 10
- fi
- done
- }
-
- echo "OpenStack IPS are ${JCLOUDS_IPS}"
-
- IFS=',' read -ra ADDR <<< "${JCLOUDS_IPS}"
-
- for i in "${ADDR[@]}"; do
- copy-ssh-keys-to-slave &
- done
-
- wait
- echo "Copying ssh keys complete."
+ # Setup openstack envirnoment file for use by
+ # the opendaylight-infra-stack macro
+ cat > $WORKSPACE/opendaylight-infra-environment.yaml << EOF
+ parameters:
+ vm_0_count: {vm_0_count}
+ vm_0_flavor: {vm_0_flavor}
+ vm_0_image: {vm_0_image}
+ vm_1_count: {vm_1_count}
+ vm_1_flavor: {vm_1_flavor}
+ vm_1_image: {vm_1_image}
+ vm_2_count: {vm_2_count}
+ vm_2_flavor: {vm_2_flavor}
+ vm_2_image: {vm_2_image}
+ EOF
+ echo "Contents of opendaylight-infra-environment.yaml ..."
+ cat $WORKSPACE/opendaylight-infra-environment.yaml
+ - opendaylight-infra-stack:
+ stack-template: 'csit-3-instance-type.yaml'
# Macro: integration-get-slave-addresses
# Operation: this macro gets the IP addresses of the dynamic vms
# Macro: integration-deploy-controller-verify
# Operation: this macro deploys the controller with all fetures
-# Used by: integration-distribution-deploy-{stream} job template
+# Used by: distribution-deploy-{stream} job template
- builder:
name: integration-deploy-controller-verify
# Macro: integration-get-bundle-url-root
# Operation: this macro gets the job generated distribution URL from root pom.xml
-# Used by: integration-distribution-verify-{stream} job template
+# Used by: distribution-verify-{stream} job template
- builder:
name: integration-get-bundle-url-root
!include-raw:
- include-raw-integration-multipatch-distribution-test.sh
-# Macro: integration-cleanup-worspace
+# Macro: integration-cleanup-workspace
# Operation: Cleans up files possibly left there by the previous build
# Used by: {project}-csit-* job templates
- include-raw-integration-cleanup-workspace.sh
# Macro: integration-rebase-patch
-# Operation: For cloned project, rebase checked-out Gerrit patch onto $BRANCH.
+# Operation: For cloned project, rebase checked-out Gerrit patch onto $DISTROBRANCH.
# Used by: integration-patch-distribution-* job template
- builder:
- shell:
!include-raw:
- include-raw-integration-deploy-openstack-run-test.sh
+
+# Macro: integration-list-jobs
+# Operation: queries Jenkins jobs from jenkins.opendaylight.org and
+# writes a list of the jobs corresponding to the search terms to a file.
+# Used by: builder-merge job template
+#
+# This script requires the following JJB variables to be passed in:
+# {search_string} Job type to act as a primary filter (e.g. csit)
+# {blacklist} List of sub-projects to filter out (e.g. longevity)
+# {stream} Development release name (e.g. boron)
+# {jobs-filename} Filename to write list into (e.g. carbon-jobs.lst)
+# NOTE: Requires xmlstarlet installed on node.
+
+- builder:
+ name: integration-list-jobs
+ builders:
+ - shell:
+ !include-raw:
+ - include-raw-integration-list-jobs.sh
+
+# Macro: integration-replace-block-text
+# Operation: using starting and ending regex to
+# replace a block of text in a file with the text in
+# another file. Regex should be basic and work with sed
+# Used by: builder-merge job template
+#
+# This script requires the following JJB variables to be passed in:
+# {starting-regex}
+# {ending-regex}
+# {file-with-changes-to-insert}
+# {file-to-change}
+
+- builder:
+ name: integration-replace-block-text
+ builders:
+ - shell:
+ !include-raw:
+ - include-raw-integration-replace-block-text.sh
+
+# Macro: integration-compare-distributions
+# Operation: will compare an already created distribtion (probably last
+# published to nexus) to the current distribution being created.
+# The comparison is done to find the list of patches that are new to the
+# current distribtion.
+# Used by: builder-merge job template
+#
+# This script requires the bundle vars that are created by the
+# get-bundle-vars macro script
+
+
+- builder:
+ name: integration-compare-distributions
+ builders:
+ - shell:
+ !include-raw:
+ - include-raw-integration-compare-distributions.sh
+
##############
# Publishers #
##############
builders:
- shell: |
#!/bin/bash
- mkdir $WORKSPACE/archives
+ mkdir -p $WORKSPACE/archives
curl --output robot-plugin.zip "$BUILD_URL/robot/report/*zip*/robot-plugin.zip"
unzip -d $WORKSPACE/archives robot-plugin.zip
- mv *log* *.log *.csv *.png $WORKSPACE/archives || true # Don't fail if file missing
+ mv *log* *.log *.log.gz *.csv *.png $WORKSPACE/archives || true # Don't fail if file missing
script-only-if-succeeded: False
script-only-if-failed: False
mark-unstable-if-failed: True