Skip to content
Snippets Groups Projects
Commit fb4fb42e authored by iaibrys's avatar iaibrys
Browse files

Put CI deployment into a script since it’s repeated everywhere.

parent a20e3815
Branches
No related tags found
No related merge requests found
Pipeline #376 failed
...@@ -43,16 +43,7 @@ deploy_devel: ...@@ -43,16 +43,7 @@ deploy_devel:
- deploy-devel - deploy-devel
stage: deploy stage: deploy
script: script:
- echo "Deploy to ${CI_BUILD_REF_SLUG} server" - /enote/src/dtu-enote/scripts/redeploy.sh ${CI_BUILD_REF_SLUG} ${CI_JOB_TOKEN} ${CI_REGISTRY} ${CI_PROJECT_PATH}
- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
- cd /enote/src/dtu-enote
- ../../gen/docker-stop.sh
- git pull
- bundle exec rake deploy:all
- docker images | grep ${CI_PROJECT_PATH}
- docker ps -q -f status=exited | xargs -I '{}' docker rm -f '{}'
- docker ps -q -f status=dead | xargs -I '{}' docker rm -f '{}'
- docker image prune -f
environment: environment:
name: develop name: develop
url: https://enote-devel3.compute.dtu.dk url: https://enote-devel3.compute.dtu.dk
...@@ -64,17 +55,7 @@ deploy_production: ...@@ -64,17 +55,7 @@ deploy_production:
- deploy-prod-2019 - deploy-prod-2019
stage: deploy stage: deploy
script: script:
- echo "Deploy to ${CI_BUILD_REF_SLUG} server" - /enote/src/dtu-enote/scripts/redeploy.sh ${CI_BUILD_REF_SLUG} ${CI_JOB_TOKEN} ${CI_REGISTRY} ${CI_PROJECT_PATH}
- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
- cd /enote/src/dtu-enote
- ../../gen/docker-stop.sh
- git submodule update --init --recursive
- git pull
- bundle exec rake deploy:all
- docker images | grep ${CI_PROJECT_PATH}
- docker ps -q -f status=exited | xargs -I '{}' docker rm -f '{}'
- docker ps -q -f status=dead | xargs -I '{}' docker rm -f '{}'
- docker image prune -f
environment: environment:
name: production name: production
url: https://quiz.compute.dtu.dk url: https://quiz.compute.dtu.dk
......
#!/bin/bash
# - cd /enote/src/dtu-enote/scripts/redeploy.sh ${CI_BUILD_REF_SLUG} ${CI_JOB_TOKEN} ${CI_REGISTRY} ${CI_PROJECT_PATH}
CI_BUILD_REF_SLUG=$1
CI_JOB_TOKEN=$2
CI_REGISTRY=$3
CI_PROJECT_PATH=$4
echo "Deploy to ${CI_BUILD_REF_SLUG} server"
docker login -u gitlab-ci-token -p ${CI_JOB_TOKEN} ${CI_REGISTRY}
cd /enote/src/dtu-enote
../../gen/docker-stop.sh
git submodule update --init --recursive
git pull
bundle exec rake deploy:all
docker images | grep ${CI_PROJECT_PATH}
docker ps -q -f status=exited | xargs -I '{}' docker rm -f '{}'
docker ps -q -f status=dead | xargs -I '{}' docker rm -f '{}'
docker image prune -f
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment