-
Notifications
You must be signed in to change notification settings - Fork 0
/
.drone.yml
109 lines (100 loc) · 2.44 KB
/
.drone.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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
---
kind: pipeline
name: build
trigger:
branch:
- master
event:
exclude:
- promote
- rollback
steps:
- name: api
image: plugins/docker
settings:
registry: registry.home.devmem.ru
repo: registry.home.devmem.ru/gia/api
dockerfile: .docker/django/Dockerfile-drone
cache_from: registry.home.devmem.ru/gia/api:latest
tags:
- ${DRONE_COMMIT_SHA:0:8}
- latest
- name: postgres
image: plugins/docker
settings:
registry: registry.home.devmem.ru
repo: registry.home.devmem.ru/gia/postgres
dockerfile: .docker/postgres/Dockerfile
context: .docker/postgres
cache_from: registry.home.devmem.ru/gia/postgres:latest
tags:
- latest
- name: redis
image: plugins/docker
settings:
registry: registry.home.devmem.ru
repo: registry.home.devmem.ru/gia/redis
dockerfile: .docker/redis/Dockerfile
context: .docker/redis
cache_from: registry.home.devmem.ru/gia/redis:latest
tags:
- latest
---
kind: pipeline
name: test
trigger:
event:
exclude:
- promote
- rollback
depends_on:
- build
services:
- name: postgres
image: postgres:12-alpine
environment:
POSTGRES_USER: dbuser
POSTGRES_PASSWORD: dbpass
steps:
- name: test
image: registry.home.devmem.ru/gia/api:latest
environment:
DJANGO_DATABASE_URL: postgres://dbuser:dbpass@postgres:5432/dbuser
DJANGO_SETTINGS_MODULE: config.settings.local
PYTHONPATH: ${PYTHONPATH}:/drone/src/gia-api
commands:
- pip install --no-cache-dir -r gia-api/requirements/testing.txt
- pytest
---
kind: pipeline
name: deploy
trigger:
branch:
- master
event:
- promote
steps:
- name: ansible-syntax-check
image: plugins/ansible
settings:
requirements: .ansible/requirements.txt
playbook: .ansible/playbook.yml
inventory: .ansible/hosts
extra_vars: image_tag=${DRONE_COMMIT_SHA:0:8}
vault_password:
from_secret: ansible_vault_password
syntax_check: true
- name: ansible-deploy
image: plugins/ansible
settings:
requirements: .ansible/requirements.txt
playbook: .ansible/playbook.yml
inventory: .ansible/hosts
extra_vars: image_tag=${DRONE_COMMIT_SHA:0:8}
vault_password:
from_secret: ansible_vault_password
private_key:
from_secret: ansible_private_key
when:
target:
- prod