forked from bitpoke/mysql-operator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.drone.yml
177 lines (161 loc) · 4.59 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
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
commands:
- make dependencies
lint:
group: lint
image: quay.io/presslabs/bfc
commands:
- make lint
lint-chart:
group: lint
image: quay.io/presslabs/kluster-toolbox
pull: true
commands:
- helm lint hack/charts/mysql-operator
- helm dep build hack/charts/mysql-operator
test:
group: test
image: quay.io/presslabs/bfc
commands:
- make test
build-chart:
group: build
image: quay.io/presslabs/bfc
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-helm-chart:
image: quay.io/presslabs/kluster-toolbox
pull: true
environment:
- GH_USER=presslabs-bot
commands:
- cd hack/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/"
secrets:
- GH_PASSWORD
when:
event: tag
#
# end to end testing
#
start-kubernetes:
image: quay.io/presslabs/kluster-toolbox
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.11
# initialize cluster
- kubectl create serviceaccount -n kube-system tiller
- kubectl create clusterrolebinding tiller --clusterrole=cluster-admin --serviceaccount=kube-system:tiller
- helm init --service-account tiller --wait
- helm repo add presslabs https://presslabs.github.io/charts
- helm dependency update hack/charts/mysql-operator
when:
branch: master
event: push
e2e-tests:
image: quay.io/presslabs/bfc
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:
- 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}
--pod-wait-timeout 150
--dump-logs-on-failure=false
-timeout 30m
-ginkgo.slowSpecThreshold 300
when:
branch: master
event: push
stop-kubernetes:
image: quay.io/presslabs/kluster-toolbox
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