-
-
Notifications
You must be signed in to change notification settings - Fork 276
/
.drone.yml
215 lines (187 loc) · 4.4 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
---
kind: pipeline
name: default
clone:
disable: true
workspace:
base: /workspace
path: src/github.com/bitpoke/mysql-operator
steps:
- name: git
image: plugins/git
settings:
depth: 0
tags: true
- name: install dependencies
image: docker.io/bitpoke/build:v0.8.3
commands:
- make -j4 build.tools
- name: verify generated code
image: docker.io/bitpoke/build:v0.8.3
commands:
- make generate
- git diff --exit-code
- name: lint
image: docker.io/bitpoke/build:v0.8.3
commands:
- make -j4 lint
- name: test
image: docker.io/bitpoke/build:v0.8.3
environment:
ACK_GINKGO_DEPRECATIONS: 1.16.4
commands:
- make test
- name: build
image: docker.io/bitpoke/build:v0.8.3
commands:
- make build
services:
- name: docker
image: docker:20.10.8-dind-rootless
environment:
DOCKER_TLS_CERTDIR: ""
trigger:
ref:
- refs/pull/**
- refs/heads/master
- refs/heads/release-*
# CI related changes SHOULD be prefixed with drone-
- refs/heads/drone-*
---
kind: pipeline
name: publish
trigger:
ref:
- refs/tags/**
clone:
disable: true
workspace:
base: /workspace
path: src/github.com/bitpoke/mysql-operator
steps:
- name: git
image: plugins/git
settings:
depth: 0
tags: true
- name: build
image: docker.io/bitpoke/build:v0.8.3
commands:
- make build
- name: publish
image: docker.io/bitpoke/build:v0.8.3
environment:
DOCKER_REGISTRY: docker.io/bitpoke
DOCKER_USERNAME: bitpokebot
DOCKER_PASSWORD:
from_secret: DOCKER_PASSWORD
SSH_KEY:
from_secret: SSH_KEY
# make build system happy by setting a branch name on tags
BRANCH_NAME: release-${DRONE_TAG}
commands:
- /usr/local/bin/setup-credentials-helper.sh
- git config --global user.email "[email protected]"
- git config --global user.name "Bitpoke Bot"
- git config --global push.default current
- ssh-keyscan -H github.com > /etc/ssh/ssh_known_hosts
- make publish
services:
- name: docker
image: docker:20.10.8-dind-rootless
environment:
DOCKER_TLS_CERTDIR: ""
---
kind: pipeline
name: e2e testing
trigger:
ref:
- refs/heads/master
- refs/heads/release-*
# e2e CI related changes SHOULD be prefixed with drone-e2e-
- refs/heads/drone-e2e-*
clone:
disable: true
workspace:
base: /workspace
path: src/github.com/bitpoke/mysql-operator
steps:
- name: git
image: plugins/git
settings:
depth: 0
tags: true
- name: create gke cluster
image: docker.io/bitpoke/build:v0.8.3
environment: &e2eEnvironment
# set version in stone, as we need stable tags for e2e testing
VERSION: ${DRONE_COMMIT}
DOCKER_REGISTRY: eu.gcr.io/bitpoke-mysql-operator-testing
GOOGLE_CREDENTIALS:
from_secret: E2E_GOOGLE_CREDENTIALS
GOOGLE_CLOUD_PROJECT: bitpoke-mysql-operator-testing
GOOGLE_CLOUD_ZONE: europe-west4-b
CLUSTER_NAME: mysql-operator-e2e-testing-${DRONE_COMMIT:0:8}
BACKUP_BUCKET_NAME: bitpoke-mysql-operator-testing-backup
commands:
- /usr/local/bin/setup-credentials-helper.sh
- gcloud container clusters create $CLUSTER_NAME
--zone $GOOGLE_CLOUD_ZONE
--preemptible
--cluster-version 1.28
--addons=GcePersistentDiskCsiDriver
--monitoring=NONE
- name: build
image: docker.io/bitpoke/build:v0.8.3
volumes:
- name: dockersock
path: /var/run
# <<: *e2eEnvironment
commands:
- make -j4 build
depends_on:
- git
- name: publish e2e images
image: docker.io/bitpoke/build:v0.8.3
environment:
<<: *e2eEnvironment
commands:
- /usr/local/bin/setup-credentials-helper.sh
- make .img.release.build
- make img.publish
depends_on:
- build
- name: e2e test
image: docker.io/bitpoke/build:v0.8.3
environment:
<<: *e2eEnvironment
GOOGLE_CLOUD_CLUSTER: mysql-operator-e2e-testing-${DRONE_COMMIT:0:8}
ACK_GINKGO_DEPRECATIONS: 1.16.4
commands:
- /usr/local/bin/setup-credentials-helper.sh
- make e2e
depends_on:
- publish e2e images
- create gke cluster
- name: delete gke cluster
image: docker.io/bitpoke/build:v0.8.3
environment:
<<: *e2eEnvironment
commands:
- /usr/local/bin/setup-credentials-helper.sh
- gcloud container clusters delete $CLUSTER_NAME
--quiet
--async
--zone $GOOGLE_CLOUD_ZONE
failure: ignore
depends_on:
- e2e test
when:
status:
- success
- failure
services:
- name: docker
image: docker:20.10.8-dind-rootless
environment:
DOCKER_TLS_CERTDIR: ""