-
Notifications
You must be signed in to change notification settings - Fork 18
/
.gitlab-ci.yml
88 lines (84 loc) · 2.82 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
87
88
py_style:
image:
name: python:3.11-bookworm
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
py_test:
stage: build
retry: 2
image:
name: python:3.11-bookworm
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
variables:
POSTGRES_DB: stayseeated
POSTGRES_USER: venueless
POSTGRES_PASSWORD: venueless
POSTGRES_HOST_AUTH_METHOD: trust
build:
stage: build
image:
name: gcr.io/kaniko-project/executor:v1.22.0-debug
entrypoint: [""]
script:
- echo $CI_COMMIT_SHA > release.txt
- mv $KANIKO_CONFIG /kaniko/.docker/config.json
- /kaniko/executor
--context "."
--dockerfile "./Dockerfile"
--build-arg=COMMIT=$CI_COMMIT_SHORT_SHA
--destination "docker.rami.io/venueless/venueless:$CI_COMMIT_REF_NAME"
only:
- prod
- master
deploy:
image:
name: debian:12
stage: deploy
before_script:
- apt update -y && apt install -y openssh-client
- eval $(ssh-agent -s)
- chmod 400 "$SSH_PRIVATE_KEY"
- ssh-add "$SSH_PRIVATE_KEY"
- mkdir -p ~/.ssh
- chmod 700 ~/.ssh
- cp "$SSH_KNOWN_HOSTS" ~/.ssh/known_hosts
- chmod 644 ~/.ssh/known_hosts
script:
- ssh deployer@venueless-web1.rami.io $CI_COMMIT_REF_NAME pull
- ssh deployer@venueless-web2.rami.io $CI_COMMIT_REF_NAME pull
- ssh deployer@venueless-web3.rami.io $CI_COMMIT_REF_NAME pull
- ssh deployer@venueless-web4.rami.io $CI_COMMIT_REF_NAME pull
- ssh deployer@venueless-web5.rami.io $CI_COMMIT_REF_NAME pull
- ssh deployer@venueless-web1.rami.io $CI_COMMIT_REF_NAME upgrade
- ssh deployer@venueless-web2.rami.io $CI_COMMIT_REF_NAME upgrade
- ssh deployer@venueless-web3.rami.io $CI_COMMIT_REF_NAME upgrade
- ssh deployer@venueless-web4.rami.io $CI_COMMIT_REF_NAME upgrade
- ssh deployer@venueless-web5.rami.io $CI_COMMIT_REF_NAME upgrade
only:
- prod
- master
stages:
- build
- deploy