Skip to content

Commit

Permalink
Add autodeploy to sandbox server
Browse files Browse the repository at this point in the history
  • Loading branch information
FedeG committed Oct 22, 2019
1 parent 0bbccfc commit 1d36ffb
Showing 1 changed file with 2 additions and 135 deletions.
137 changes: 2 additions & 135 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -1,145 +1,12 @@
stages:
- testing
- styling
- build
- deploy

variables:
CONTAINER_DEPLOY_IMAGE: $CI_REGISTRY_IMAGE:$CI_BUILD_REF_NAME
CONTAINER_RELEASE_IMAGE: $CI_REGISTRY_IMAGE:latest
IMAGE_NAME: eventol

docker master image:
stage: build
image: docker:git
tags:
- docker
services:
- docker:dind
script:
- VERSION=$(date +"%y%m%d")
- docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN $CI_REGISTRY
- docker pull $CONTAINER_RELEASE_IMAGE || true
- docker build --cache-from $CONTAINER_RELEASE_IMAGE -t $CONTAINER_RELEASE_IMAGE .
- docker tag $CONTAINER_RELEASE_IMAGE $CI_REGISTRY_IMAGE:$VERSION
- docker push $CONTAINER_RELEASE_IMAGE
- docker push $CI_REGISTRY_IMAGE:$VERSION
only:
- master

docker dev image:
stage: build
image: docker:git
tags:
- docker
services:
- docker:dind
script:
- docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN $CI_REGISTRY
- docker pull $CI_REGISTRY_IMAGE:latest-dev || true
- docker build --cache-from $CI_REGISTRY_IMAGE:latest-dev -t $CI_REGISTRY_IMAGE:latest-dev .
- docker push $CI_REGISTRY_IMAGE:latest-dev
only:
- develop

docker image:
stage: build
image: docker:git
tags:
- docker
services:
- docker:dind
script:
- docker build .
except:
- develop
- master

python-testing:
services:
- postgres:9.6
variables:
PSQL_USER: eventol
PSQL_DBNAME: eventol
PSQL_HOST: postgres
POSTGRES_DB: eventol
POSTGRES_USER: eventol
POSTGRES_PASSWORD: secret
image: python:3.7
stage: testing
script:
- make gitlab-python-testing
artifacts:
paths:
- eventol/htmlcov

react-testing:
image: node:10
stage: testing
script:
- make gitlab-react-testing
artifacts:
paths:
- eventol/front/coverage

python-lint:
image: python:3.7
stage: styling
allow_failure: true
script:
- make gitlab-python-lint

react-lint-report:
image: node:10
stage: styling
allow_failure: true
script:
- make gitlab-react-lint-with-report
artifacts:
paths:
- eventol/front/report.html

react-lint:
image: node:10
stage: styling
allow_failure: true
script:
- make gitlab-react-lint

sass-lint-report:
image: node:10
stage: styling
allow_failure: true
script:
- make gitlab-react-sasslint-with-report
artifacts:
paths:
- eventol/front/scss-lint-report.html

sass-lint:
image: node:10
stage: styling
allow_failure: true
script:
- make gitlab-react-sasslint

deploy:
stage: deploy
when: manual
only:
- master
image: docker:git
script:
- apk update && apk add sshpass
- export SSHPASS=$SSH_PASS
- sshpass -e ssh -p$SSH_PORT -o stricthostkeychecking=no -x $SSH_USER@$SSH_HOST $SSH_SCRIPT

deploy-sandbox:
stage: deploy
only:
- develop
- testci
image: docker:git
script:
- apk update && apk add sshpass
- export SSHPASS=$SANDBOX_PASS
- sshpass -e ssh -p$SANDBOX_PORT -o stricthostkeychecking=no -x $SANDBOX_USER@$SANDBOX_HOST $SANDBOX_SCRIPT
- echo "sshpass -e ssh -p$SANDBOX_PORT -o stricthostkeychecking=no -x $SANDBOX_USER@$SANDBOX_HOST $SANDBOX_SCRIPT"

0 comments on commit 1d36ffb

Please sign in to comment.