Jnkinsfile, automation test trial2
This commit is contained in:
parent
a00b62730f
commit
fe45696573
12
Jenkinsfile
vendored
12
Jenkinsfile
vendored
@ -59,18 +59,20 @@ stage('Update Repo on Remote') {
|
|||||||
if [ -d ${REMOTE_DIR}/certificates ]; then
|
if [ -d ${REMOTE_DIR}/certificates ]; then
|
||||||
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
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user