diff --git a/backup/pvc/VERSION.txt b/backup/pvc/VERSION.txt index 0eec13e4..f87d474c 100644 --- a/backup/pvc/VERSION.txt +++ b/backup/pvc/VERSION.txt @@ -1 +1 @@ -v0.4.2 +v0.4.3 diff --git a/backup/pvc/bin/backup.sh b/backup/pvc/bin/backup.sh index 13d2f096..40c9f8dd 100755 --- a/backup/pvc/bin/backup.sh +++ b/backup/pvc/bin/backup.sh @@ -51,6 +51,10 @@ if [[ "$ret" -eq 0 ]]; then _log "INFO" "[backup] backup ${BACKUP_NUMBER} was completed without warnings" elif [[ "$ret" -eq 1 ]]; then _log "INFO" "[backup] backup ${BACKUP_NUMBER} was completed with some warnings" +else + _log "ERROR" "[backup] backup ${BACKUP_NUMBER} failed with error code: $ret" + _clean + exit "$ret" fi mv "${BACKUP_TMP_DIR}/${BACKUP_NUMBER}.tar.zstd" "${BACKUP_DIR}/${BACKUP_NUMBER}.tar.zstd" diff --git a/backup/pvc/bin/restore.sh b/backup/pvc/bin/restore.sh index 3a692625..f10e2e75 100755 --- a/backup/pvc/bin/restore.sh +++ b/backup/pvc/bin/restore.sh @@ -39,7 +39,17 @@ else exit 1 fi -tar $OPTS -C "${JENKINS_HOME}" -xf "${BACKUP_DIR}/${BACKUP_NUMBER}.${EXT}" +tar $OPTS -C "${JENKINS_HOME}" -xf "${BACKUP_DIR}/${BACKUP_NUMBER}.${EXT}" || ret=$? + +if [[ "$ret" -eq 0 ]]; then + _log "INFO" "[restore] restore ${BACKUP_NUMBER} was completed without warnings" +elif [[ "$ret" -eq 1 ]]; then + _log "INFO" "[restore] restore ${BACKUP_NUMBER} was completed with some warnings" +else + _log "ERROR" "[restore] restore ${BACKUP_NUMBER} failed with error code: $ret" + exit "$ret" +fi + _log "INFO" "[restore] deleting lock file ${TRAP_FILE}" test -f "${TRAP_FILE}" && rm -f "${TRAP_FILE}"