summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMorgan Richomme <morgan.richomme@orange.com>2015-06-15 17:41:12 +0200
committerMorgan Richomme <morgan.richomme@orange.com>2015-06-15 17:44:54 +0200
commita8ced6b99a496fd01db2744e4b68f05d66582fe4 (patch)
tree968e59c4af69965ed685d689a0f020147375e51e
parentc236af84b0158cc3135e56214f35a8d05de391c0 (diff)
Automate result management in CI
create a file to push results into artifact JIRA: FUNCTEST-9, FUNCTEST-12 Change-Id: I831981b5f43ac041af202dc86d5e33b380259c2e Signed-off-by: Morgan Richomme <morgan.richomme@orange.com>
-rw-r--r--jjb/functest/functest.yml131
-rw-r--r--jjb/functest/res-build.sh29
2 files changed, 138 insertions, 22 deletions
diff --git a/jjb/functest/functest.yml b/jjb/functest/functest.yml
index 824888e8c..fb9f5a6c2 100644
--- a/jjb/functest/functest.yml
+++ b/jjb/functest/functest.yml
@@ -9,11 +9,13 @@
- 'opnfv-jump-2'
jobs:
- 'functest-{pod}'
- - 'functest-openstack-bench-test'
- - 'functest-openstack-tempest-smoke-test'
- - 'functest-odl-test'
- - 'functest-vims-test'
- - 'functest-vping-test'
+ - 'set-functest-env-{pod}'
+ - 'clean-functest-env-{pod}'
+ - 'functest-openstack-bench-test-{pod}'
+ - 'functest-openstack-tempest-smoke-test-{pod}'
+ - 'functest-odl-test-{pod}'
+ - 'functest-vims-test-{pod}'
+ - 'functest-vping-test-{pod}'
- 'functest-daily-master'
- 'functest-merge'
- 'functest-verify-{stream}'
@@ -32,11 +34,72 @@
# job template
################################
- job-template:
- name: functest-openstack-bench-test
+ name: set-functest-env-{pod}
project-type: freestyle
- node: opnfv-jump-2
+ node: '{pod}'
+
+ logrotate:
+ daysToKeep: 30
+ numToKeep: 10
+ artifactDaysToKeep: -1
+ artifactNumToKeep: -1
+
+ builders:
+ - shell: |
+ #!/bin/bash
+ set +e
+
+ echo "Functest: prepare Functest environment"
+ mkdir -p $HOME/functest/
+ source $HOME/functest/opnfv-openrc.sh
+
+ # WORKSPACE is the root of the functest repo
+ # go into WORKSPACE where the functest repo is cloned
+ cd $WORKSPACE
+
+ # prepare
+ echo "Functest: prepare Functest environment"
+ python $WORKSPACE/testcases/config_functest.py --debug $WORKSPACE/ start
+
+- job-template:
+ name: clean-functest-env-{pod}
+
+ project-type: freestyle
+
+ node: '{pod}'
+
+ logrotate:
+ daysToKeep: 30
+ numToKeep: 10
+ artifactDaysToKeep: -1
+ artifactNumToKeep: -1
+
+ builders:
+ - shell: |
+ #!/bin/bash
+ set +e
+
+ # collect results
+ echo "Functest: copy results and clean Functest environment"
+ mkdir -p $HOME/functest/results
+
+ # save ODL results
+ cp -Rf $WORSPACE/testcases/Controllers/ODL/CI/logs $HOME/functest/results/ODL
+
+ # save tempest.conf for further troubleshooting
+ cp $HOME/.rally/tempest/for-deployment-*/tempest.conf $HOME/functest/results
+
+ # cleanup
+ python $WORKSPACE/testcases/config_functest.py --debug --force $WORKSPACE/ clean
+
+- job-template:
+ name: functest-openstack-bench-test-{pod}
+
+ project-type: freestyle
+
+ node: '{pod}'
logrotate:
daysToKeep: 30
@@ -46,14 +109,18 @@
builders:
- shell: |
- python $HOME/.functest/run_rally.py all
+ #!/bin/bash
+ set +e
+
+ echo "Functest: run Functest Rally Bench suites"
+ python $WORKSPACE/testcases/VIM/OpenStack/CI/libraries/run_rally.py --debug $WORKSPACE/ all
- job-template:
- name: functest-openstack-tempest-smoke-test
+ name: functest-openstack-tempest-smoke-test-{pod}
project-type: freestyle
- node: opnfv-jump-2
+ node: '{pod}'
logrotate:
daysToKeep: 30
@@ -63,15 +130,20 @@
builders:
- shell: |
+ #!/bin/bash
+ set +e
+
+ # tempest
+ echo "Functest: run Tempest suite"
rally verify start smoke
rally verify list
- job-template:
- name: functest-odl-test
+ name: functest-odl-test-{pod}
project-type: freestyle
- node: opnfv-jump-2
+ node: '{pod}'
logrotate:
daysToKeep: 30
@@ -81,14 +153,18 @@
builders:
- shell: |
- echo "put your CI scenario here"
+ #!/bin/bash
+ set +e
+
+ echo "Functest: run ODL suite"
+ $WORKSPACE/testcases/Controllers/ODL/CI/start_tests.sh
- job-template:
- name: functest-vims-test
+ name: functest-vims-test-{pod}
project-type: freestyle
- node: opnfv-jump-2
+ node: '{pod}'
logrotate:
daysToKeep: 30
@@ -102,11 +178,11 @@
- job-template:
- name: functest-vping-test
+ name: functest-vping-test-{pod}
project-type: freestyle
- node: opnfv-jump-2
+ node: '{pod}'
logrotate:
daysToKeep: 30
@@ -116,7 +192,12 @@
builders:
- shell: |
- python $HOME/.functest/vPing/vPing.py
+ #!/bin/bash
+ set +e
+
+ # vPing
+ echo "Functest: run vPing"
+ python $WORKSPACE/testcases/vPing/CI/libraries/vPing.py --debug $WORKSPACE/
- job-template:
name: functest-{pod}
@@ -320,21 +401,27 @@
echo "Functest: run ODL suite"
$WORKSPACE/testcases/Controllers/ODL/CI/start_tests.sh
+ # rally
+ echo "Functest: run Functest Rally Bench suites"
+ python $WORKSPACE/testcases/VIM/OpenStack/CI/libraries/run_rally.py --debug $WORKSPACE/ all
+
# tempest
echo "Functest: run Tempest suite"
rally verify start smoke
rally verify list
- # rally
- echo "Functest: run Functest Rally Bench suites"
- python $WORKSPACE/testcases/VIM/OpenStack/CI/libraries/run_rally.py --debug $WORKSPACE/ all
-
# collect results
echo "Functest: copy results and clean Functest environment"
mkdir -p $HOME/functest/results
+ # save ODL results
+ cp -Rf $WORSPACE/testcases/Controllers/ODL/CI/logs $HOME/functest/results/ODL
+
# save tempest.conf for further troubleshooting
cp $HOME/.rally/tempest/for-deployment-*/tempest.conf $HOME/functest/results
+
+ # push results to artifact
+ !include-raw res-build.sh
# cleanup
python $WORKSPACE/testcases/config_functest.py --debug --force $WORKSPACE/ clean
diff --git a/jjb/functest/res-build.sh b/jjb/functest/res-build.sh
new file mode 100644
index 000000000..304d2cc34
--- /dev/null
+++ b/jjb/functest/res-build.sh
@@ -0,0 +1,29 @@
+#!/bin/bash
+set -e
+set -o pipefail
+
+project="$(git remote -v | head -n1 | awk '{{print $2}}' | sed -e 's,.*:\(.*/\)\?,,' -e 's/\.git$//')"
+export PATH=$PATH:/usr/local/bin/
+
+git_sha1="$(git rev-parse HEAD)"
+res_build_date=$(date -u +"%Y-%m-%d_%H-%M-%S")
+
+# set once, functe config file could be use to avoid such hardcoded path
+dir_result="$HOME/functest/results"
+
+# Several information are required: date and testbed
+# date is generated by functest so on the artifact, the results shall be under functest/<testbed id>/date/
+testbed="$(hostname)"
+project_artifact=$project/$testbed/$res_build_date
+
+# copy folder to artifact
+if [ -d "$dir_result" ]; then
+ if [ "$(ls -A $dir_result)" ]; then
+ echo "copy result files to artifact $project_artifact"
+ gsutil cp -r "$dir_result" gs://artifacts.opnfv.org/"$project_artifact"/
+ else
+ echo "Result folder is empty"
+ fi
+else
+ echo "No result folder found"
+fi