-
Notifications
You must be signed in to change notification settings - Fork 0
/
.drone.yml
188 lines (172 loc) · 4.33 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
176
177
178
179
180
181
182
183
184
185
186
187
188
workspace:
base: /go
path: src/github.com/Rukenshia/soccerstreams
pipeline:
dependencies:
group: prep
image: golang
commands:
- make deps
temp_versions:
group: prep
image: alpine/git
commands:
- v=$(git rev-parse --short HEAD)
- echo "-$v" >> cmd/agent/version
- echo "-$v" >> cmd/sweeper/version
- echo "-$v" >> cmd/web/version
- sed -i "s#soccerstreams-web/agent:.*#soccerstreams-web/agent:$(cat cmd/agent/version)#" k8s/agent.yml
- sed -i "s#soccerstreams-web/sweeper:.*#soccerstreams-web/sweeper:$(cat cmd/sweeper/version)#" k8s/sweeper.yml
- sed -i "s#soccerstreams-web/web:.*#soccerstreams-web/web:$(cat cmd/web/version)#" k8s/web.yml
ca_certs:
group: prep
image: alpine
commands:
- apk add --update ca-certificates
- cp /etc/ssl/certs/ca-certificates.crt cmd/agent/ca-certificates.crt
- cp /etc/ssl/certs/ca-certificates.crt cmd/sweeper/ca-certificates.crt
tzdata:
group: prep
image: alpine
commands:
- apk add --update tzdata
- cp -r /usr/share/zoneinfo cmd/agent/zoneinfo
- cp -r /usr/share/zoneinfo cmd/sweeper/zoneinfo
test:
group: qa
image: golang
commands:
- make test
lint:
group: qa
image: golang
commands:
- make lint || exit 0
build-agent:
when:
branch: master
event: push
event: push
group: build
image: golang
environment:
GOPATH: /go
DOCKER_HOST: tcp://docker:2375
secrets:
- source: gcr
target: GCR_SERVICE_ACCOUNT
commands:
- cd cmd/agent && make bin
build-sweeper:
when:
branch: master
event: push
group: build
image: golang
environment:
GOPATH: /go
DOCKER_HOST: tcp://docker:2375
secrets:
- source: gcr
target: GCR_SERVICE_ACCOUNT
commands:
- cd cmd/sweeper && make bin
build-web:
when:
branch: master
event: push
group: build
image: golang
environment:
GOPATH: /go
DOCKER_HOST: tcp://docker:2375
secrets:
- source: gcr
target: GCR_SERVICE_ACCOUNT
commands:
- export PATH=$GOPATH/bin:$PATH
- cd cmd/web && make bin
docker-agent:
when:
branch: master
event: push
group: docker
image: ruken/docker-go-gcr:latest
pull: true
environment:
GOPATH: /go
DOCKER_HOST: tcp://docker:2375
secrets:
- source: gcr
target: GCR_SERVICE_ACCOUNT
commands:
- f=$(mktemp); echo "$GCR_SERVICE_ACCOUNT" > $f && gcloud auth activate-service-account --key-file $f
- make agent
docker-sweeper:
when:
branch: master
event: push
group: docker
image: ruken/docker-go-gcr:latest
pull: true
environment:
GOPATH: /go
DOCKER_HOST: tcp://docker:2375
secrets:
- source: gcr
target: GCR_SERVICE_ACCOUNT
commands:
- f=$(mktemp); echo "$GCR_SERVICE_ACCOUNT" > $f && gcloud auth activate-service-account --key-file $f
- make sweeper
docker-web:
when:
branch: master
event: push
group: docker
image: ruken/docker-go-gcr:latest
pull: true
environment:
GOPATH: /go
DOCKER_HOST: tcp://docker:2375
secrets:
- source: gcr
target: GCR_SERVICE_ACCOUNT
commands:
- f=$(mktemp); echo "$GCR_SERVICE_ACCOUNT" > $f && gcloud auth activate-service-account --key-file $f
- make web
deploy:
image: ruken/docker-gke-kubectl
when:
branch: master
event: push
secrets:
- source: k8s
target: K8S_SERVICE_ACCOUNT
commands:
- f=$(mktemp); echo "$K8S_SERVICE_ACCOUNT" > $f && gcloud auth activate-service-account --key-file $f
- gcloud container clusters get-credentials cluster-1 --zone europe-west1-b --project soccerstreams-web
- make deploy
notify:
when:
branch: master
event: push
image: appleboy/drone-telegram
format: html
secrets:
- source: telegram_user
target: telegram_to
- source: telegram_token
target: telegram_token
when:
status: [ success, failure ]
message: |
{{#success build.status}}
🚀 build {{repo.name}}#{{build.number}} succeeded.
{{else}}
🔴 build {{repo.name}}#{{build.number}} failed.
{{/success}}
services:
docker:
image: docker:dind
command: [ "--tls=false" ]
privileged: true