From ae8038cc86d14f56001127fd0b503444071ab402 Mon Sep 17 00:00:00 2001 From: Trevor Bramwell Date: Fri, 12 Jan 2018 10:43:32 -0800 Subject: 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 --- jjb/pharos/pharos.yml | 23 +++++++++-------------- 1 file 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" -- cgit 1.2.3-korg