Execute yardstick sample ping scenario
[releng.git] / jjb / yardstick / yardstick.yml
index d25d851..8040cd6 100644 (file)
@@ -1,10 +1,15 @@
 - project:
     name: yardstick
     jobs:
+        - 'yardstick-{pod}'
         - 'yardstick-daily-{stream}'
         - 'yardstick-merge'
         - 'yardstick-verify'
 
+    pod:
+        - 'opnfv-jump-1'
+        - 'opnfv-jump-2'
+
     # stream:    branch with - in place of / (eg. stable-helium)
     # branch:    branch (eg. stable/helium)
     stream:
             echo "Running unit tests..."
             cd $WORKSPACE
             ./run_tests.sh
+
+- job-template:
+    name: 'yardstick-{pod}'
+
+    project-type: freestyle
+
+    disabled: false
+
+    node: '{pod}'
+
+    parameters:
+        - project-parameter:
+            project: '{project}'
+
+    scm:
+        - git-scm:
+            credentials-id: '{ssh-credentials}'
+            refspec: ''
+            branch: master
+
+    logrotate:
+        daysToKeep: 30
+        numToKeep: 10
+        artifactDaysToKeep: -1
+        artifactNumToKeep: -1
+
+    builders:
+        - 'yardstick-ping'
+
+########################
+# builder macros
+########################
+- builder:
+    name: yardstick-ping
+    builders:
+        - shell: |
+            #!/bin/bash
+             set -o errexit
+             set -o nounset
+             set -o pipefail
+
+            echo "Yardstick: prepare Yardstick environment"
+
+            # source openstack vars
+            source $HOME/yardstick/opnfv-openrc.sh
+
+            # check if cirros-0.3.3 image is already available
+            # if not, create the image
+            echo "Yardstick: configure the image"
+            IMAGE_NAME=cirros-0.3.3
+            if [[ ! $(nova image-show $IMAGE_NAME > /dev/null 2>&1) ]]; then
+                echo "Image $IMAGE_NAME doesn't exist. Creating image $IMAGE_NAME"
+                glance image-create --name cirros-0.3.3 --is-public true --disk-format qcow2 --container-format bare --file $HOME/yardstick/cirros-0.3.3-x86_64-disk.img
+            else
+                echo "Image $IMAGE_NAME exists. Proceeding with yardstick."
+            fi
+
+            # set virtualenv
+            echo "Yardstick: setup virtualenv"
+            cd $WORKSPACE
+            virtualenv $WORKSPACE/yardstick_venv
+            source $WORKSPACE/yardstick_venv/bin/activate
+            python setup.py develop
+
+            # set virtualenv
+            echo "Yardstick: execute ping scenario"
+            yardstick -v -d samples/ping.yaml
+
+            # cleanup
+            echo "Yardstick: cleanup"
+            glance image-delete $IMAGE_NAME"
+
+            # done
+            echo "Yardstick: done!"