diff --git a/Jenkinsfile b/Jenkinsfile index 8cceb7d..4d40a4f 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -82,12 +82,16 @@ pipeline { } sh ''' echo "cleanup $DEPLOY_FILE"; - if [ -f ${BACKUP_FILE} ]; then - echo "backup found: ${BACKUP_FILE} going to replace it"; - rm ${BACKUP_FILE}; - fi - mv ${DEPLOY_FILE} ${BACKUP_FILE}; - rm ${DEPLOY_FILE}; + if [ -f ${DEPLOY_FILE} ]; then + if [ -f ${BACKUP_FILE} ]; then + echo "backup found: ${BACKUP_FILE} going to replace it"; + rm ${BACKUP_FILE}; + fi + mv ${DEPLOY_FILE} ${BACKUP_FILE}; + rm ${DEPLOY_FILE}; + else + echo "deploy file empty" + fi ''' } }