-
Notifications
You must be signed in to change notification settings - Fork 23
/
.gitlab-ci.yml
86 lines (80 loc) · 3.14 KB
/
.gitlab-ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
py_style:
stage: build
script:
- cd server
- python -m venv env
- source env/bin/activate
- pip install -U pip wheel setuptools
- XDG_CACHE_HOME=/cache pip install black flake8 isort==5.*
- black --check venueless tests
- flake8 venueless tests
- isort -rc -c venueless tests
interruptible: true
allow_failure: true # We check this in Github, and if it's urgent, we don't want to skip deployments because of this
tags:
- python3
py_test:
stage: build
retry: 2
services:
- redis:latest
- postgres:15
script:
- cd server
- python -m venv env
- source env/bin/activate
- pip install -U pip wheel setuptools
- XDG_CACHE_HOME=/cache pip install -Ur requirements.txt
- python manage.py collectstatic
- VENUELESS_REDIS_HOST=redis VENUELESS_DB_TYPE=postgresql VENUELESS_DB_NAME=venueless VENUELESS_DB_USER=venueless VENUELESS_DB_PASS=venueless VENUELESS_DB_HOST=postgres py.test tests/ --reruns 3 --reruns-delay 1
interruptible: true
allow_failure: true # We check this in Github, and if it's urgent, we don't want to skip deployments because of this
tags:
- python3
variables:
POSTGRES_DB: stayseeated
POSTGRES_USER: venueless
POSTGRES_PASSWORD: venueless
POSTGRES_HOST_AUTH_METHOD: trust
build_container:
stage: build
script:
- echo $CI_COMMIT_SHA > release.txt
- docker build --build-arg=COMMIT=$(git rev-parse --short HEAD) -t venueless .
- docker tag venueless docker.rami.io/venueless/venueless:$CI_COMMIT_REF_NAME
tags:
- docker
- venuelessbuild
upload_container:
stage: upload
script:
- docker login -u ciuser -p $DOCKERPW docker.rami.io
- docker push docker.rami.io/venueless/venueless:$CI_COMMIT_REF_NAME
only:
- prod
- master
tags:
- docker
- venuelessbuild
deploy:
stage: deploy
script:
- ssh -o UserKnownHostsFile=/keys/known_hosts -i /keys/id_rsa [email protected] $CI_COMMIT_REF_NAME pull
- ssh -o UserKnownHostsFile=/keys/known_hosts -i /keys/id_rsa [email protected] $CI_COMMIT_REF_NAME pull
- ssh -o UserKnownHostsFile=/keys/known_hosts -i /keys/id_rsa [email protected] $CI_COMMIT_REF_NAME pull
- ssh -o UserKnownHostsFile=/keys/known_hosts -i /keys/id_rsa [email protected] $CI_COMMIT_REF_NAME pull
- ssh -o UserKnownHostsFile=/keys/known_hosts -i /keys/id_rsa [email protected] $CI_COMMIT_REF_NAME pull
- ssh -o UserKnownHostsFile=/keys/known_hosts -i /keys/id_rsa [email protected] $CI_COMMIT_REF_NAME upgrade
- ssh -o UserKnownHostsFile=/keys/known_hosts -i /keys/id_rsa [email protected] $CI_COMMIT_REF_NAME upgrade
- ssh -o UserKnownHostsFile=/keys/known_hosts -i /keys/id_rsa [email protected] $CI_COMMIT_REF_NAME upgrade
- ssh -o UserKnownHostsFile=/keys/known_hosts -i /keys/id_rsa [email protected] $CI_COMMIT_REF_NAME upgrade
- ssh -o UserKnownHostsFile=/keys/known_hosts -i /keys/id_rsa [email protected] $CI_COMMIT_REF_NAME upgrade
only:
- prod
- master
tags:
- venuelessdeploy
stages:
- build
- upload
- deploy