/
.drone.yml
191 lines (172 loc) · 5.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
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
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
publish-images:
group: publish
image: quay.io/presslabs/bfc:latest
environment:
DOCKER_HOST: tcp://docker:2375
DOCKER_USER: presslabs+drone
APP_VERSION: ${DRONE_TAG:-${DRONE_BRANCH/master/latest}}
secrets:
- source: QUAY_TOKEN
target: DOCKER_PASSWORD
commands:
- docker login -u $DOCKER_USER -p $DOCKER_PASSWORD quay.io
- make publish
when:
event:
- push
- tag
build-chart:
group: build
image: quay.io/presslabs/bfc:0.4
environment:
APP_VERSION: ${DRONE_TAG:-${DRONE_BRANCH/master/latest}}
commands:
- make chart
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:-${DRONE_BRANCH/master/latest}}
- 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:$APP_VERSION
--sidecar-mysql57-image quay.io/presslabs/mysql-operator-sidecar-mysql57:$APP_VERSION
--sidecar-mysql8-image quay.io/presslabs/mysql-operator-sidecar-mysql8:$APP_VERSION
--orchestrator-image quay.io/presslabs/mysql-operator-orchestrator:$APP_VERSION
--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
services:
docker:
image: docker:dind
privileged: true
commands:
- mkdir -p "$CI_WORKSPACE/.work/docker" "$CI_WORKSPACE/.cache/docker"
- /usr/local/bin/dockerd-entrypoint.sh dockerd --host "unix://$CI_WORKSPACE/.work/docker/docker.sock" --storage-driver overlay2 --log-level error
when:
event:
- push
- tag