-
Notifications
You must be signed in to change notification settings - Fork 1
/
.drone.yml
175 lines (156 loc) · 4.02 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
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
---
kind: pipeline
type: docker
name: test
steps:
- name: lint
image: python:3.8.6-slim
commands:
- python -m pip install --upgrade pip
- pip install flake8
- flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# - name: test
# image: python:3.8.6-slim
# commands:
# - apt-get update && apt-get install -y build-essential
# - python -m pip install --upgrade pip
# - pip install --no-cache-dir -r requirements_test.txt
# - pytest
- name: code_analysis
image: aosapps/drone-sonar-plugin
settings:
sonar_host:
from_secret: sonar_host
sonar_token:
from_secret: sonar_token
- name: discord_notification
image: appleboy/drone-discord
when:
status:
- success
- failure
settings:
webhook_id:
from_secret: webhook_id
webhook_token:
from_secret: webhook_token
message: >
{{#success build.status}}
✅ Build #{{build.number}} of `{{repo.name}}` succeeded.
📝 Commit by {{commit.author}} on `{{commit.branch}}`:
```
{{commit.message}}
```
{{else}}
❌ Build #{{build.number}} of `{{repo.name}}` failed.
📝 Commit by {{commit.author}} on `{{commit.branch}}`:
```
{{commit.message}}
```
{{/success}}
services:
- name: mariadb
image: mariadb:10.2
ports:
- 3306
environment:
MYSQL_ROOT_PASSWORD: password
- name: redis
image: redis:6.0.8
ports:
- 6379
trigger:
event:
- push
- pull_request
---
kind: pipeline
type: docker
name: deploy
steps:
- name: deploy
image: node:14-buster-slim
commands:
- apt-get update
- apt-get install -y curl git
- curl -fsSL https://get.docker.com | bash
- curl -L "https://github.com/docker/compose/releases/download/1.27.4/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
- chmod +x /usr/local/bin/docker-compose
- npm install -g @quasar/cli
- docker-compose -f /drone/prod/docker-compose.yml -p Zogwine down
- cp /drone/prod/docker-compose.yml /drone/docker-compose.yml
- ls /drone
- rm -rf /drone/prod/*
- cp -R /drone/src/* /drone/prod/
- ls /drone/prod
- git clone --depth 1 https://github.com/drosoCode/Zogwine_UI /drone/Zogwine_UI
- cd /drone/Zogwine_UI && npm i --save-dev && quasar build
- mkdir -p /drone/prod/static/
- cp -R /drone/Zogwine_UI/dist/spa/* /drone/prod/static/
- cp -R /drone/Zogwine_UI/pwa/* /drone/prod/static/
- cp /drone/docker-compose.yml /drone/prod/docker-compose.yml
- ls /drone/prod
- docker-compose -f /drone/prod/docker-compose.yml -p Zogwine build
- docker-compose -f /drone/prod/docker-compose.yml -p Zogwine up -d
volumes:
- name: prod
path: /drone/prod
- name: sock
path: /var/run/docker.sock
- name: discord_notification
image: appleboy/drone-discord
when:
status:
- success
- failure
settings:
webhook_id:
from_secret: webhook_id
webhook_token:
from_secret: webhook_token
message: >
{{#success build.status}}
✅ Deployment succeeded. 💾 Build #{{build.number}} for `{{repo.name}}`.
{{else}}
❌ Deployment failed. 💾 Build #{{build.number}} for `{{repo.name}}`.
{{/success}}
volumes:
- name: prod
host:
path: /app/docker/run/Zogwine
- name: sock
host:
path: /var/run/docker.sock
trigger:
event:
- promote
target:
- production
---
kind: secret
name: webhook_id
get:
path: kv/data/discord/webhook/drone
name: id
---
kind: secret
name: webhook_token
get:
path: kv/data/discord/webhook/drone
name: token
---
kind: secret
name: sonar_host
get:
path: kv/data/sonarqube
name: host
---
kind: secret
name: sonar_token
get:
path: kv/data/sonarqube
name: token
---
kind: signature
hmac: 49643b1b73302b967f8b45b71a2f7e9fd76024c7cd6719d99571f93d7634e513
...