Sergey Galkin | 24ebd76 | 2020-01-14 14:36:34 +0400 | [diff] [blame] | 1 | #!/bin/bash -ex |
Vladimir Khlyunev | 8bad6a6 | 2022-10-06 00:29:59 +0400 | [diff] [blame^] | 2 | set -ex |
Sergey Galkin | 24ebd76 | 2020-01-14 14:36:34 +0400 | [diff] [blame] | 3 | cd "$(dirname "$0")" |
Vladimir Khlyunev | 8bad6a6 | 2022-10-06 00:29:59 +0400 | [diff] [blame^] | 4 | DATE=$(date +%F-%H%M%S) |
| 5 | BACKUP_MAIN_DIR="${JENKINS_HOME}/jenkins-backups/" |
| 6 | STORAGE_DIR="${WORKSPACE:?}/storage/" |
| 7 | mkdir -p "${BACKUP_MAIN_DIR:?}/${DATE}" |
| 8 | rm -f "${BACKUP_MAIN_DIR}/${DATE}.tar.gz" |
| 9 | rsync --exclude-from="${WORKSPACE}/jobs/backups/jenkins-rsync.excludes" -avzq "${JENKINS_HOME}" "${BACKUP_MAIN_DIR:?}/$DATE" --info=progress2 |
| 10 | mv "${STORAGE_DIR}/plugin_list.txt" "${BACKUP_MAIN_DIR}/${DATE}" |
| 11 | tar -czf "${STORAGE_DIR}/sre-jenkins-backup-${DATE}.tar.gz" -C "${BACKUP_MAIN_DIR}" "${DATE}" |
| 12 | |