Jnkinsfile, automation test trial2

This commit is contained in:
vriti 2025-06-09 20:06:28 +05:30
parent a00b62730f
commit fe45696573

12
Jenkinsfile vendored
View File

@ -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