summaryrefslogtreecommitdiffstats
path: root/jjb/pharos
diff options
context:
space:
mode:
authorTrevor Bramwell <tbramwell@linuxfoundation.org>2017-12-05 16:36:27 -0800
committerTrevor Bramwell <tbramwell@linuxfoundation.org>2017-12-05 16:54:21 -0800
commit9cbee8d6cf2aedd1a792af0034932cc77b5c49c0 (patch)
tree9537ee11ad985a61075c530a32bad44db200edb3 /jjb/pharos
parent3732c0ac30c2b67b30680aee2d0ba8982a9b528c (diff)
Backup Pharos Dashboard Data
Use an alpine container to mount the pharos_data volume and create a backup in the home directory on the system. Change-Id: If6700a8c4cd19a6c4b854efc54225d8f6b973aaa Signed-off-by: Trevor Bramwell <tbramwell@linuxfoundation.org>
Diffstat (limited to 'jjb/pharos')
-rw-r--r--jjb/pharos/pharos.yml33
1 files changed, 33 insertions, 0 deletions
diff --git a/jjb/pharos/pharos.yml b/jjb/pharos/pharos.yml
index 7af4f0fa6..d7067c497 100644
--- a/jjb/pharos/pharos.yml
+++ b/jjb/pharos/pharos.yml
@@ -12,6 +12,7 @@
jobs:
- '{project}-verify-{stream}'
+ - 'backup-pharos-dashboard'
stream:
- master:
@@ -64,3 +65,35 @@
builders:
- shell: |
echo "Nothing to verify!"
+
+- job-template:
+ name: 'backup-pharos-dashboard'
+
+ disabled: '{obj:disabled}'
+
+ parameters:
+ - project-parameter:
+ project: 'pharos-tools'
+ branch: 'master'
+ - 'pharos-dashboard-defaults'
+
+ scm:
+ - git-scm-gerrit
+
+ triggers:
+ - timed: '@daily'
+
+ builders:
+ - shell: |
+ mkdir -p /home/backups/
+ DATE=$(date +%Y%m%d)
+ echo "-- $DATE --"
+ echo "Backing up Pharos Dashboard data..."
+ sudo docker run -it --rm \
+ -v pharos_data:/pharos_data:ro \
+ -v /tmp:/backup \
+ alpine \
+ tar -czf /backup/pharos-dashboard-db-$(date +%Y%m%d).tar.gz -C /pharos_data ./
+ sudo mv /tmp/pharos-dashboard-db-$(date +%Y%m%d).tar.gz /home/backups/
+ sudo chown $USER:$USER $WORKSPACE/backups/pharos-dashboard-db-$(date +%Y%m%d).tar.gz
+ echo "...complete"