diff options
author | Jose Lausuch <jose.lausuch@ericsson.com> | 2017-01-25 12:58:11 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@opnfv.org> | 2017-01-25 12:58:11 +0000 |
commit | 0f54f23e804ec095b5ff84c3a6086c0855ed28c5 (patch) | |
tree | b8fbc5556063e57fd2e38d964fb0484741df1fc2 | |
parent | 32408dd6f7506a2a791bd5c00bf7cd9509961a07 (diff) | |
parent | db63c1b76140a583b43870094dbc2de323662933 (diff) |
Merge "Add jenkins job for testapi mongodb backup"
-rw-r--r-- | jjb/releng/testapi-automate.yml | 19 | ||||
-rw-r--r-- | jjb/releng/testapi-backup-mongodb.sh | 31 |
2 files changed, 50 insertions, 0 deletions
diff --git a/jjb/releng/testapi-automate.yml b/jjb/releng/testapi-automate.yml index 78e80b392..8332f5bb4 100644 --- a/jjb/releng/testapi-automate.yml +++ b/jjb/releng/testapi-automate.yml @@ -10,6 +10,20 @@ project: 'releng' +- job: + name: 'testapi-mongodb-backup' + + slave-label: 'testresults' + + scm: + - git-scm + + triggers: + - timed: '@weekly' + + builders: + - mongodb-backup + - job-template: name: 'testapi-verify-{stream}' @@ -110,6 +124,11 @@ ################################ # job builders ################################ +- builder: + name: mongodb-backup + builders: + - shell: | + bash ./jjb/releng/testapi-backup-mongodb.sh - builder: name: run-unit-tests diff --git a/jjb/releng/testapi-backup-mongodb.sh b/jjb/releng/testapi-backup-mongodb.sh new file mode 100644 index 000000000..52957ab12 --- /dev/null +++ b/jjb/releng/testapi-backup-mongodb.sh @@ -0,0 +1,31 @@ +#!/bin/bash + +set -e + +# Run MongoDB backup +python $WORKSPACE/utils/test/testapi/update/templates/backup_mongodb.py -o $WORKSPACE/ + +# Compressing the dump +now=$(date +"%m_%d_%Y_%H_%M_%S") +echo $now + +file_name="testapi_mongodb_"$now".tar.gz" +echo $file_name + +tar cvfz "$file_name" test_results_collection* + +rm -rf test_results_collection* + +artifact_dir="testapibackup" +workspace="$WORKSPACE" + +set +e +/usr/local/bin/gsutil &>/dev/null +if [ $? != 0 ]; then + echo "Not possible to push results to artifact: gsutil not installed" + exit 1 +else + echo "Uploading mongodump to artifact $artifact_dir" + /usr/local/bin/gsutil cp -r "$workspace"/"$file_name" gs://testingrohit/"$artifact_dir"/ + echo "MongoDump can be found at http://artifacts.opnfv.org/$artifact_dir" +fi |