summaryrefslogtreecommitdiffstats
path: root/jjb/releng/testapi-backup-mongodb.sh
diff options
context:
space:
mode:
authorrohitsakala <rohitsakala@gmail.com>2017-01-24 02:26:53 +0530
committerrohitsakala <rohitsakala@gmail.com>2017-01-25 16:30:09 +0530
commitdb63c1b76140a583b43870094dbc2de323662933 (patch)
tree1efe6b8b5a72db90c225d9d72758a9763a46e302 /jjb/releng/testapi-backup-mongodb.sh
parentaa51cedd14432be1bc9a9f6e97ca2abc077ba23f (diff)
Add jenkins job for testapi mongodb backup
Mongodb backup will run every week and will get pushed into artifacts.opnfv.org/testing/ JIRA: FUNCTEST-701 Change-Id: I3a6fee59a1b8b5bdc46f07f6f6e9f5a60b77f24f Signed-off-by: rohitsakala <rohitsakala@gmail.com>
Diffstat (limited to 'jjb/releng/testapi-backup-mongodb.sh')
-rw-r--r--jjb/releng/testapi-backup-mongodb.sh31
1 files changed, 31 insertions, 0 deletions
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