This is the codeAbility Sharing Platform! Learn more about the codeAbility Sharing Platform.

Skip to content
Snippets Groups Projects
manual_deploy.sh 1.84 KiB
Newer Older
#!/bin/bash
Michael Breu's avatar
Michael Breu committed
echo "Deploying Gitsearch in directory ${GITSEARCH_PATH}" 
Cont Deploy's avatar
Cont Deploy committed


if [[ -z "${CI_COMMIT_REF_NAME}" ]]; then
Cont Deploy's avatar
Cont Deploy committed
  source src/main/docker/.env && echo "CI_COMMIT_REF_NAME is not set defaulting to development"
  export GITBRANCH="${CI_COMMIT_REF_NAME,,}"
Cont Deploy's avatar
Cont Deploy committed
  # 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
Michael Breu's avatar
Michael Breu committed
    echo "Using default or other branch settings for ${GITBRANCH}"
Cont Deploy's avatar
Cont Deploy committed
  fi
Cont Deploy's avatar
Cont Deploy committed
  echo "Deploying via pipeline"
  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
Eduard Frankford's avatar
Eduard Frankford committed
  git fetch && git stash && git checkout development && git pull
else
  echo "GITBRANCH is set to '$GITBRANCH'"
Eduard Frankford's avatar
Eduard Frankford committed
  export CHECKOUT="${CI_COMMIT_REF_NAME}"
  git fetch && git stash && git checkout $CHECKOUT && git pull
Cont Deploy's avatar
Cont Deploy committed
export COMMIT_ID="$(git rev-parse HEAD)"
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