forked from bitpoke/mysql-operator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.drone.yml
239 lines (217 loc) · 5.96 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
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
branches:
- master
- 1.x
- 2.x
# This is very useful when debugging drone related issues. Just prefix your branch with "drone-"
# to trigger a drone build.
- drone-*
workspace:
base: /root/go
path: src/github.com/presslabs/mysql-operator
clone:
git:
image: plugins/git
depth: 100
tags: true
pipeline:
dependencies:
image: quay.io/presslabs/bfc:0.4
commands:
- make dependencies
lint:
group: lint
image: quay.io/presslabs/bfc:0.4
commands:
- make lint
lint-chart:
group: lint
image: quay.io/presslabs/kluster-toolbox
pull: true
commands:
- helm lint charts/mysql-operator
- helm dep build charts/mysql-operator
test:
group: test
image: quay.io/presslabs/bfc:0.4
commands:
- make test
verify-generate:
image: quay.io/presslabs/bfc:0.4
commands:
- make -s fmt generate manifests
- git diff --exit-code
build-chart:
group: build
image: quay.io/presslabs/bfc:0.4
commands:
- make chart
publish-operator:
group: publish
image: plugins/docker
registry: quay.io
repo: quay.io/presslabs/mysql-operator
username: presslabs+drone
tags: ["${DRONE_BRANCH/master/latest}"]
secrets:
- source: QUAY_TOKEN
target: DOCKER_PASSWORD
when:
event: push
publish-operator:
group: publish
image: plugins/docker
registry: quay.io
repo: quay.io/presslabs/mysql-operator
username: presslabs+drone
auto_tag: true
secrets:
- source: QUAY_TOKEN
target: DOCKER_PASSWORD
when:
event: tag
publish-sidecar:
group: publish
image: plugins/docker
registry: quay.io
repo: quay.io/presslabs/mysql-operator-sidecar
username: presslabs+drone
dockerfile: Dockerfile.sidecar
tags: ["${DRONE_BRANCH/master/latest}"]
secrets:
- source: QUAY_TOKEN
target: DOCKER_PASSWORD
when:
event: push
publish-sidecar:
group: publish
image: plugins/docker
registry: quay.io
repo: quay.io/presslabs/mysql-operator-sidecar
username: presslabs+drone
dockerfile: Dockerfile.sidecar
auto_tag: true
secrets:
- source: QUAY_TOKEN
target: DOCKER_PASSWORD
when:
event: tag
publish-orchestrator:
group: publish
image: plugins/docker
registry: quay.io
repo: quay.io/presslabs/mysql-operator-orchestrator
username: presslabs+drone
dockerfile: Dockerfile.orchestrator
tags: ["${DRONE_BRANCH/master/latest}"]
secrets:
- source: QUAY_TOKEN
target: DOCKER_PASSWORD
when:
event: push
publish-orchestrator:
group: publish
image: plugins/docker
registry: quay.io
repo: quay.io/presslabs/mysql-operator-orchestrator
username: presslabs+drone
dockerfile: Dockerfile.orchestrator
auto_tag: true
secrets:
- source: QUAY_TOKEN
target: DOCKER_PASSWORD
when:
event: tag
publish-helm-chart:
image: quay.io/presslabs/kluster-toolbox
pull: true
environment:
- GH_USER=presslabs-bot
commands:
- cd charts
- (cd mysql-operator && helm dep build)
- helm package mysql-operator
- CHART="$(basename *.tgz)" ; MESSAGE="Publish $(basename $CHART .tgz)"
- /usr/local/bin/gh put --skip-existing -m "$MESSAGE" "$CHART" "presslabs/charts/docs/"
- rm *.tgz
# publish cluster chart
- (cd mysql-cluster && helm dep build)
- helm package mysql-cluster
- CHART="$(basename *.tgz)" ; MESSAGE="Publish $(basename $CHART .tgz)"
- /usr/local/bin/gh put --skip-existing -m "$MESSAGE" "$CHART" "presslabs/charts/docs/"
secrets:
- GH_PASSWORD
when:
event: tag
#
# Documentation
#
trigger-docs-build:
image: plugins/downstream
server: https://drone.presslabs.net
fork: true
secrets:
- DRONE_TOKEN
repositories:
- presslabs/docs
when:
branch: master
event: push
#
# end to end testing
#
start-kubernetes:
image: quay.io/presslabs/bfc:0.4
group: publish
secrets:
- GOOGLE_CREDENTIALS
environment:
- CLUSTER_NAME=mysql-op-x${DRONE_BUILD_NUMBER}
- KUBECONFIG=/root/go/.kube/config
- HELM_HOME=/root/go/.helm/
commands:
- setup-credentials-helper.sh
- gcloud container clusters create $CLUSTER_NAME
--zone europe-west3-b --project testing-reactor
--preemptible --cluster-version 1.16
# update chart deps
- helm dependency update charts/mysql-operator
when:
branch: master
event: push
e2e-tests:
image: quay.io/presslabs/bfc:0.4
secrets:
- GOOGLE_CREDENTIALS
environment:
- APP_VERSION=${DRONE_TAG}
- KUBECONFIG=/root/go/.kube/config
- HELM_HOME=/root/go/.helm/
- CLUSTER_NAME=mysql-op-x${DRONE_BUILD_NUMBER}
- BACKUP_BUCKET_NAME=pl-test-mysql-operator
commands:
- setup-credentials-helper.sh
- go test ./test/e2e -v --kubernetes-config /root/go/.kube/config --kubernetes-context gke_testing-reactor_europe-west3-b_$CLUSTER_NAME
--operator-image quay.io/presslabs/mysql-operator:${DRONE_BRANCH/master/latest}
--sidecar-image quay.io/presslabs/mysql-operator-sidecar:${DRONE_BRANCH/master/latest}
--orchestrator-image quay.io/presslabs/mysql-operator-orchestrator:${DRONE_BRANCH/master/latest}
--pod-wait-timeout 150
--dump-logs-on-failure=false
-timeout 40m
-ginkgo.slowSpecThreshold 300
when:
branch: master
event: push
stop-kubernetes:
image: quay.io/presslabs/bfc:0.4
secrets:
- GOOGLE_CREDENTIALS
environment:
- CLUSTER_NAME=mysql-op-x${DRONE_BUILD_NUMBER}
- KUBECONFIG=/root/go/.kube/config
commands:
- setup-credentials-helper.sh
- gcloud container clusters delete $CLUSTER_NAME --quiet --zone europe-west3-b --project testing-reactor
when:
status: [ success, failure ]
branch: master
event: push