From fe456965735dc652fc7a11c45b31adb24346a0eb Mon Sep 17 00:00:00 2001 From: vriti Date: Mon, 9 Jun 2025 20:06:28 +0530 Subject: [PATCH] Jnkinsfile, automation test trial2 --- Jenkinsfile | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 4c969a9..be62b5d 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -59,18 +59,20 @@ stage('Update Repo on Remote') { if [ -d ${REMOTE_DIR}/certificates ]; then cp -a ${REMOTE_DIR}/certificates ${BACKUP_UPLOADS_DIR}/ fi - - # Pull or clone repo + + # Pull latest changes without deleting local files/folders if [ -d ${REMOTE_DIR}/.git ]; then echo "🔁 Repo exists. Pulling latest changes..." cd ${REMOTE_DIR} - git reset --hard - git clean -fd + git stash push --include-untracked --message "temp-backup-before-pull" || true git pull origin ${BRANCH} + git stash pop || true else echo "📥 Repo not found. Cloning fresh and restoring backup..." rm -rf ${REMOTE_DIR} - git clone -b ${BRANCH} https://${GIT_USER}:${GIT_PASS}@https://git.tech4biz.wiki/rohit/spurrin-backend.git ${REMOTE_DIR} + git clone -b ${BRANCH} https://${GIT_USER}:${GIT_PASS}@git.tech4biz.wiki/rohit/spurrin-backend.git ${REMOTE_DIR} + + # Restore backups only on fresh clone... # Restore backup only on fresh clone if [ -d ${BACKUP_UPLOADS_DIR}/uploads ]; then