summaryrefslogtreecommitdiffstats
path: root/jjb/pharos
diff options
context:
space:
mode:
authorTrevor Bramwell <tbramwell@linuxfoundation.org>2018-01-12 10:43:32 -0800
committerTrevor Bramwell <tbramwell@linuxfoundation.org>2018-01-12 11:04:03 -0800
commitae8038cc86d14f56001127fd0b503444071ab402 (patch)
tree964e7ec2d840157ad0b5c51bc21226fa3b622262 /jjb/pharos
parent7c32b1ffb5c6cc7b02559d0fc31ce33fc4b0169a (diff)
Update Pharos Backup Job
Moves the backup location to a directory that Jenkins can write to, and since this only runs a docker container there is no need to clone any repositories. Change-Id: I05b35e5d2d95c7044973d9d0e1a9d7e72c490570 Signed-off-by: Trevor Bramwell <tbramwell@linuxfoundation.org>
Diffstat (limited to 'jjb/pharos')
-rw-r--r--jjb/pharos/pharos.yml23
1 files changed, 9 insertions, 14 deletions
diff --git a/jjb/pharos/pharos.yml b/jjb/pharos/pharos.yml
index 9f4feb42e..c721c8d87 100644
--- a/jjb/pharos/pharos.yml
+++ b/jjb/pharos/pharos.yml
@@ -16,28 +16,23 @@
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 --"
+ BACKUP_DIR=$HOME/backups/
+ TMP_DIR=$HOME/tmp/
+ mkdir -p $BACKUP_DIR
+ echo "-- $(date +%Y%m%d) --"
echo "Backing up Pharos Dashboard data..."
sudo docker run -it --rm \
- -v pharos_data:/pharos_data:ro \
- -v /tmp:/backup \
+ -v pharos-data:/pharos-data:ro \
+ -v $TMP_DIR:/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
+ tar -czf /backup/pharos-dashboard-db-$(date +%Y%m%d).tar.gz -C /pharos-data ./
+ sudo mv $TMP_DIR/pharos-dashboard-db-$(date +%Y%m%d).tar.gz $BACKUP_DIR
+ sudo chown $USER:$USER $BACKUP_DIR/pharos-dashboard-db-$(date +%Y%m%d).tar.gz
echo "...complete"