From 09e58efa62806f1f57283ba3c14a2b88cd62321d Mon Sep 17 00:00:00 2001
From: Bo-Chun Louis Chen <louistw@uab.edu>
Date: Fri, 16 Sep 2022 11:09:00 -0500
Subject: [PATCH] Update checking for sub project CRI_XCBC

---
 .gitlab-ci.yml | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 25d739c..293c4f5 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -45,18 +45,20 @@ setup_environment:
     - pip install --upgrade pip
     - pip install s3cmd ansible
     - |
-      if cd CRI_XCBC; then
-        git checkout uab-prod; git pull;
-        git fetch origin '+refs/pull/*/head:refs/remotes/origin/pr/*';
-      else
-        git clone https://github.com/uabrc/CRI_XCBC.git;
-        cd CRI_XCBC;
+      if [ ! -d $CI_PROJECT_DIR/CRI_XCBC ]; then
+        git clone https://github.com/uabrc/CRI_XCBC.git
+        cd CRI_XCBC
         git remote add upstream https://github.com/jprorama/CRI_XCBC.git
+        cd ..
       fi
+    - cd CRI_XCBC
     - git config user.name "${GIT_AUTHOR_NAME}"
     - git config user.email "${GIT_AUTHOR_EMAIL}"
-    - git fetch upstream
+    - git fetch --all
+    - git fetch origin '+refs/pull/*/head:refs/remotes/origin/pr/*'
     - git fetch upstream '+refs/pull/*/head:refs/remotes/upstream/pr/*'
+    - git checkout uab-prod
+    - git merge origin/uab-prod
     - git checkout -b integration
     - git merge upstream/uab-dev
     - cd ..
-- 
GitLab