diff --git a/backup/pvc/VERSION.txt b/backup/pvc/VERSION.txt index 77cada2e..41a28195 100644 --- a/backup/pvc/VERSION.txt +++ b/backup/pvc/VERSION.txt @@ -1 +1 @@ -v0.0.6 +v0.0.7 diff --git a/backup/pvc/bin/backup.sh b/backup/pvc/bin/backup.sh index 80387373..71a8f8e7 100644 --- a/backup/pvc/bin/backup.sh +++ b/backup/pvc/bin/backup.sh @@ -5,11 +5,13 @@ set -eo pipefail [[ ! $# -eq 1 ]] && echo "Usage: $0 backup_number" && exit 1; [[ -z "${BACKUP_DIR}" ]] && echo "Required 'BACKUP_DIR' env not set" && exit 1; [[ -z "${JENKINS_HOME}" ]] && echo "Required 'JENKINS_HOME' env not set" && exit 1; +BACKUP_TMP_DIR=$(mktemp -d) backup_number=$1 echo "Running backup" -tar -C ${JENKINS_HOME} -czf "${BACKUP_DIR}/${backup_number}.tar.gz" --exclude jobs/*/config.xml --exclude jobs/*/workspace* -c jobs +tar -C ${JENKINS_HOME} -czf "${BACKUP_TMP_DIR}/${backup_number}.tar.gz" --exclude jobs/*/config.xml --exclude jobs/*/workspace* -c jobs && \ +mv ${BACKUP_TMP_DIR}/${backup_number}.tar.gz ${BACKUP_DIR}/${backup_number}.tar.gz [[ ! -s ${BACKUP_DIR}/${backup_number}.tar.gz ]] && echo "backup file '${BACKUP_DIR}/${backup_number}.tar.gz' is empty" && exit 1; diff --git a/documentation/v0.1.1/getting-started.md b/documentation/v0.1.1/getting-started.md index 56ae587d..d64bc5fa 100644 --- a/documentation/v0.1.1/getting-started.md +++ b/documentation/v0.1.1/getting-started.md @@ -456,7 +456,7 @@ spec: value: /jenkins-home - name: BACKUP_COUNT value: "3" # keep only the 2 most recent backups - image: virtuslab/jenkins-operator-backup-pvc:v0.0.6 # look at backup/pvc directory + image: virtuslab/jenkins-operator-backup-pvc:v0.0.7 # look at backup/pvc directory imagePullPolicy: IfNotPresent volumeMounts: - mountPath: /jenkins-home # Jenkins home volume diff --git a/documentation/v0.2.0/getting-started.md b/documentation/v0.2.0/getting-started.md index 17ac49e9..7ab8e959 100644 --- a/documentation/v0.2.0/getting-started.md +++ b/documentation/v0.2.0/getting-started.md @@ -601,7 +601,7 @@ spec: value: /jenkins-home - name: BACKUP_COUNT value: "3" # keep only the 2 most recent backups - image: virtuslab/jenkins-operator-backup-pvc:v0.0.6 # look at backup/pvc directory + image: virtuslab/jenkins-operator-backup-pvc:v0.0.7 # look at backup/pvc directory imagePullPolicy: IfNotPresent volumeMounts: - mountPath: /jenkins-home # Jenkins home volume