Newer
Older
echo "Deploying Gitsearch in directory ${GITSEARCH_PATH}"
if [[ -z "${CI_COMMIT_REF_NAME}" ]]; then
source src/main/docker/.env && echo "CI_COMMIT_REF_NAME is not set defaulting to development"

Michael Breu
committed
export GITBRANCH="${CI_COMMIT_REF_NAME,,}"
# Decide the path based on the value of GITBRANCH
if [[ "$GITBRANCH" == "master" ]]; then
# Set the path specific for master branch
source /home/contDeploy/gitsearch/src/main/docker/.env
elif [[ "$GITBRANCH" == "development" ]]; then
# Set the path specific for development branch
source /home/contDeploy/gitsearch2/gitsearch/src/main/docker/.env
else
# Handle other branches or provide a default
echo "Using default or other branch settings for ${GITBRANCH}"
docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN sharing-codeability.uibk.ac.at:5051/development/sharing/codeability-sharing-platform/gitsearch/$GITBRANCH
fi
if [[ -z "${GITBRANCH}" ]]; then
echo "GITBRANCH is not set defaulting to development"
export GITBRANCH=development
git fetch && git stash && git checkout development && git pull
else
echo "GITBRANCH is set to '$GITBRANCH'"
export CHECKOUT="${CI_COMMIT_REF_NAME}"
git fetch && git stash && git checkout $CHECKOUT && git pull
export MAVEN_USER_HOME=`pwd`/.maven && ./mvnw package -DskipTests -Pprod jib:build -Djib.to.image=sharing-codeability.uibk.ac.at:5051/development/sharing/codeability-sharing-platform/gitsearch/$GITBRANCH -Djib.to.auth.username=gitlab-ci-token -Djib.to.auth.password=$CI_BUILD_TOKEN -Dmaven.repo.local=$MAVEN_USER_HOME
cd $GITSEARCH_PATH/src/main/docker/
docker pull sharing-codeability.uibk.ac.at:5051/development/sharing/codeability-sharing-platform/gitsearch/$GITBRANCH
docker-compose -f gitsearch.yml up -d --build --force-recreate gitsearch-app