This repository has been archived by the owner on Jan 23, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy path.drone.yml
143 lines (127 loc) · 2.35 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
kind: pipeline
type: docker
name: build
steps:
- name: build
image: golang:1.15
volumes:
- name: deps
path: /go
commands:
- go get
- go build
- name: test
image: golang:1.15
volumes:
- name: deps
path: /go
environment:
DB_HOST: mysql
DB_USERNAME: tiwengo
DB_PASSWORD: password
DB_NAME: tiwengo
REDIS_HOST: redis
commands:
- go test -v
- name: code-analysis
image: aosapps/drone-sonar-plugin
settings:
sonar_host:
from_secret: sonar_host
sonar_token:
from_secret: sonar_token
volumes:
- name: deps
temp: {}
services:
- name: redis
image: redis:6-alpine
- name: mysql
image: mysql:8
environment:
MYSQL_ALLOW_EMPTY_PASSWORD: 'yes'
MYSQL_DATABASE: tiwengo
MYSQL_USER: tiwengo
MYSQL_PASSWORD: password
trigger:
event:
- push
- pull_request
---
kind: pipeline
type: docker
name: deploy-staging
steps:
- name: release
image: plugins/docker
settings:
repo: tccgov.azurecr.io/tiwengo
tags:
- ${DOCKER_TAG}
registry: tccgov.azurecr.io
username: tccgov
password:
from_secret: docker_password
- name: deploy
image: appleboy/drone-ssh
volumes:
- name: ssh_key
path: /root/.ssh
settings:
host: 10.78.0.1
username: ar0660
key_path: /root/.ssh/id_rsa
script:
- echo "cd /home/ar0660/workspace"
- echo "--- TODO ---"
- echo "sudo docker-compose down"
- echo "sudo docker-compose up -d"
- echo "--- END ---"
volumes:
- name: ssh_key
host:
path: /home/ar0660/.ssh
trigger:
event:
- promote
target:
- staging
---
kind: pipeline
type: kubernetes
name: deploy-production
steps:
- name: release
image: plugins/docker
settings:
repo: tccgov.azurecr.io/tiwengo
tags:
- ${DOCKER_TAG}
registry: tccgov.azurecr.io
username: tccgov
password:
from_secret: docker_password
- name: deploy
image: appleboy/drone-ssh
volumes:
- name: ssh_key
path: /root/.ssh
settings:
host: proxy.tccg.tw
username: ar0660
key_path: /root/.ssh/id_rsa
script:
- echo "--- TODO ---"
- echo "kubectl apply -f deployment.yaml"
- echo "--- OR ---"
- echo "helm upgrade tiwengo ar0660/tiwengo -f values.yaml -n default"
- echo "--- END ---"
volumes:
- name: ssh_key
host:
path: /home/ar0660/.ssh
trigger:
event:
- promote
target:
- production