Jnkinsfile, automation test trial2

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

10
Jenkinsfile vendored
View File

@ -60,17 +60,19 @@ stage('Update Repo on Remote') {
cp -a ${REMOTE_DIR}/certificates ${BACKUP_UPLOADS_DIR}/ cp -a ${REMOTE_DIR}/certificates ${BACKUP_UPLOADS_DIR}/
fi fi
# Pull or clone repo # Pull latest changes without deleting local files/folders
if [ -d ${REMOTE_DIR}/.git ]; then if [ -d ${REMOTE_DIR}/.git ]; then
echo "🔁 Repo exists. Pulling latest changes..." echo "🔁 Repo exists. Pulling latest changes..."
cd ${REMOTE_DIR} cd ${REMOTE_DIR}
git reset --hard git stash push --include-untracked --message "temp-backup-before-pull" || true
git clean -fd
git pull origin ${BRANCH} git pull origin ${BRANCH}
git stash pop || true
else else
echo "📥 Repo not found. Cloning fresh and restoring backup..." echo "📥 Repo not found. Cloning fresh and restoring backup..."
rm -rf ${REMOTE_DIR} 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 # Restore backup only on fresh clone
if [ -d ${BACKUP_UPLOADS_DIR}/uploads ]; then if [ -d ${BACKUP_UPLOADS_DIR}/uploads ]; then