forked from debionetwork/debio-frontend
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.debio.pipeline.yml
255 lines (236 loc) · 6.29 KB
/
.debio.pipeline.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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
---
kind: pipeline
type: docker
name: debio frontend deployment
trigger:
branch:
- development
- master
- staging
event:
- pull_request
platform:
os: linux
arch: amd64
volumes:
- name: dockersock
host:
path: /var/run/docker.sock
- name: whitelist
host:
path: /etc/docker/daemon.json
- name: toolkit
host:
path: /data/drone_data
steps:
- name: verify pull request
pull: if-not-exists
image: alpine/git
volumes:
- name: toolkit
path: /data/drone_data
commands:
- /data/drone_data/debio_toolkit -approval -repo=debionetwork/debio-frontend -id=${DRONE_PULL_REQUEST}
when:
branch:
- master
- staging
- development
- name: build - devel
pull: if-not-exists
image: google/cloud-sdk:alpine
volumes:
- name: toolkit
path: /data/drone_data
commands:
- /data/drone_data/debio_toolkit -vault -env -secret=debio_development/data/frontend_dashboard
- /data/drone_data/debio_toolkit -vault -raw -secret=debio_development/data/frontend_file
- /data/drone_data/gcmd/build_frontend
when:
branch:
- development
- name: build - staging
pull: if-not-exists
image: google/cloud-sdk:alpine
volumes:
- name: toolkit
path: /data/drone_data
commands:
- /data/drone_data/debio_toolkit -vault -env -secret=debio_staging/data/frontend_dashboard
- /data/drone_data/debio_toolkit -vault -raw -secret=debio_staging/data/frontend_file
- /data/drone_data/gcmd/build_frontend_stg
when:
branch:
- staging
- name: build - demo
pull: if-not-exists
image: google/cloud-sdk:alpine
volumes:
- name: toolkit
path: /data/drone_data
commands:
- /data/drone_data/debio_toolkit -vault -env -secret=debio_production/data/frontend_dashboard
- /data/drone_data/gcmd/build_frontend_prod
when:
branch:
- master
- name: merge pull request
pull: if-not-exists
image: alpine/git
volumes:
- name: toolkit
path: /data/drone_data
commands:
- /data/drone_data/debio_toolkit -squash -repo=debionetwork/debio-frontend -id=${DRONE_PULL_REQUEST}
when:
branch:
- master
- staging
- development
- name: reload service - devel
pull: if-not-exists
image: appleboy/drone-ssh
volumes:
- name: toolkit
path: /data/drone_data
settings:
host:
from_secret: devel_host
username:
from_secret: devel_uname
key_path: /data/drone_data/.ssh/id_rsa
port: 22
script:
- docker stop debio_frontend_dev || true && docker rm debio_frontend_dev || true
- docker rmi hub.debio.network/debio_frontend_dev:latest && docker pull hub.debio.network/debio_frontend_dev:latest
- docker run -d --name=debio_frontend_dev --env=debioenv=development -v /etc/localtime:/etc/localtime:ro -p 0.0.0.0:8080:80 --restart=always hub.debio.network/debio_frontend_dev:latest
when:
branch:
- development
- name: reload service - staging
pull: if-not-exists
image: appleboy/drone-ssh
volumes:
- name: toolkit
path: /data/drone_data
settings:
host:
from_secret: stg_host
username:
from_secret: stg_uname
key_path: /data/drone_data/.ssh/id_rsa
port: 22
script:
- docker stop debio_frontend_staging || true && docker rm debio_frontend_staging || true
- docker rmi hub.debio.network/debio_frontend_staging:latest && docker pull hub.debio.network/debio_frontend_staging:latest
- docker run -d --network=host --name=debio_frontend_staging --env=DEBIOENV=demo -v /etc/localtime:/etc/localtime:ro --restart=always hub.debio.network/debio_frontend_staging:latest
when:
branch:
- staging
- name: reload service - demo
pull: if-not-exists
image: appleboy/drone-ssh
volumes:
- name: toolkit
path: /data/drone_data
settings:
host:
from_secret: stg_host
username:
from_secret: stg_uname
key_path: /data/drone_data/.ssh/id_rsa
port: 22
script:
- docker stop debio_frontend_demo || true && docker rm debio_frontend_demo || true
- docker rmi hub.debio.network/debio_frontend_demo:latest && docker pull hub.debio.network/debio_frontend_demo:latest
- docker run -d --network=host --name=debio_frontend_demo --env=DEBIOENV=demo -v /etc/localtime:/etc/localtime:ro --restart=always hub.debio.network/debio_frontend_demo:latest
when:
branch:
- master
- name: notify deployment
image: appleboy/drone-discord
pull: if-not-exists
settings:
webhook_id:
from_secret: discord_id
webhook_token:
from_secret: discord_token
message: >
{{#success build.status}}
✅ Build #{{build.number}} of `{{repo.name}}` succeeded.
📝 Commit by {{commit.author}} on
`{{commit.branch}}`:
```
{{commit.message}}
```
🌐 {{ build.link }}
{{else}}
❌ Build #{{build.number}} of `{{repo.name}}` failed.
📝 Commit by {{commit.author}} on
`{{commit.branch}}`:
```
{{commit.message}}
```
🌐 {{ build.link }}
🌐 {{ commit.link }}
{{/success}}
when:
status: [ success, failure ]
branch:
- master
- staging
- development
---
kind: secret
name: devel_host
get:
path: drone_development/deploy_target
name: devel_host
---
kind: secret
name: devel_key
get:
path: drone_development/deploy_target
name: devel_key
---
kind: secret
name: devel_uname
get:
path: drone_development/deploy_target
name: devel_uname
---
kind: secret
name: stg_host
get:
path: drone_staging/deploy_target
name: stg_host
---
kind: secret
name: stg_key
get:
path: drone_staging/deploy_target
name: stg_key
---
kind: secret
name: stg_uname
get:
path: drone_staging/deploy_target
name: stg_uname
---
kind: secret
name: discord_id
get:
path: drone_common_config/webhook
name: discord_id
---
kind: secret
name: discord_token
get:
path: drone_common_config/webhook
name: discord_token
---
kind: secret
name: deploy_auth
get:
path: drone_common_config/file_path
name: deploy_auth