|
1 | | -branches: |
2 | | - - master |
3 | | - - 1.x |
4 | | - - 2.x |
5 | | - # This is very useful when debugging drone related issues. Just prefix your branch with "drone-" |
6 | | - # to trigger a drone build. |
7 | | - - drone-* |
8 | | - |
9 | | -workspace: |
10 | | - base: /root/go |
11 | | - path: src/github.com/presslabs/mysql-operator |
| 1 | +--- |
| 2 | +kind: pipeline |
| 3 | +name: default |
12 | 4 |
|
13 | 5 | clone: |
14 | | - git: |
15 | | - image: plugins/git |
16 | | - depth: 100 |
17 | | - tags: true |
18 | | - |
19 | | -pipeline: |
20 | | - dependencies: |
21 | | - image: quay.io/presslabs/bfc:0.11 |
22 | | - commands: |
23 | | - - make dependencies |
24 | | - |
25 | | - lint: |
26 | | - group: lint |
27 | | - image: quay.io/presslabs/bfc:0.11 |
28 | | - commands: |
29 | | - - make lint |
30 | | - |
31 | | - lint-chart: |
32 | | - group: lint |
33 | | - image: quay.io/presslabs/kluster-toolbox |
34 | | - pull: true |
35 | | - commands: |
36 | | - - helm lint charts/mysql-operator |
37 | | - - helm dep build charts/mysql-operator |
38 | | - |
39 | | - test: |
40 | | - group: test |
41 | | - image: quay.io/presslabs/bfc:0.11 |
42 | | - commands: |
43 | | - - make test |
44 | | - |
45 | | - verify-generate: |
46 | | - image: quay.io/presslabs/bfc:0.11 |
47 | | - commands: |
48 | | - - make -s fmt generate manifests |
49 | | - - git diff --exit-code |
50 | | - |
51 | | - publish-images: |
52 | | - group: publish |
53 | | - image: quay.io/presslabs/bfc:0.11 |
54 | | - environment: |
55 | | - DOCKER_HOST: tcp://docker:2375 |
56 | | - DOCKER_USER: presslabs+drone |
57 | | - APP_VERSION: ${DRONE_TAG:-${DRONE_BRANCH/master/latest}} |
58 | | - secrets: |
59 | | - - source: QUAY_TOKEN |
60 | | - target: DOCKER_PASSWORD |
61 | | - commands: |
62 | | - - docker login -u $DOCKER_USER -p $DOCKER_PASSWORD quay.io |
63 | | - - make publish |
64 | | - when: |
65 | | - event: |
66 | | - - push |
67 | | - - tag |
| 6 | + disable: true |
68 | 7 |
|
69 | | - build-chart: |
70 | | - group: build |
71 | | - image: quay.io/presslabs/bfc:0.11 |
72 | | - environment: |
73 | | - APP_VERSION: ${DRONE_TAG:-${DRONE_BRANCH/master/latest}} |
74 | | - commands: |
75 | | - - make chart |
76 | | - |
77 | | - publish-helm-chart: |
78 | | - image: quay.io/presslabs/kluster-toolbox |
79 | | - pull: true |
80 | | - environment: |
81 | | - - GH_USER=presslabs-bot |
82 | | - commands: |
83 | | - - cd charts |
84 | | - - (cd mysql-operator && helm dep build) |
85 | | - - helm package mysql-operator |
86 | | - - CHART="$(basename *.tgz)" ; MESSAGE="Publish $(basename $CHART .tgz)" |
87 | | - - /usr/local/bin/gh put --skip-existing -m "$MESSAGE" "$CHART" "presslabs/charts/docs/" |
88 | | - - rm *.tgz |
89 | | - # publish cluster chart |
90 | | - - (cd mysql-cluster && helm dep build) |
91 | | - - helm package mysql-cluster |
92 | | - - CHART="$(basename *.tgz)" ; MESSAGE="Publish $(basename $CHART .tgz)" |
93 | | - - /usr/local/bin/gh put --skip-existing -m "$MESSAGE" "$CHART" "presslabs/charts/docs/" |
94 | | - secrets: |
95 | | - - GH_PASSWORD |
96 | | - when: |
97 | | - event: tag |
98 | | - |
99 | | -# |
100 | | -# Documentation |
101 | | -# |
102 | | - |
103 | | - trigger-docs-build: |
104 | | - image: plugins/downstream |
105 | | - server: https://drone.presslabs.net |
106 | | - fork: true |
107 | | - secrets: |
108 | | - - DRONE_TOKEN |
109 | | - repositories: |
110 | | - - presslabs/docs |
111 | | - when: |
112 | | - branch: master |
113 | | - event: push |
114 | | - |
115 | | -# |
116 | | -# end to end testing |
117 | | -# |
118 | | - |
119 | | - start-kubernetes: |
120 | | - image: quay.io/presslabs/bfc:0.11 |
121 | | - group: publish |
122 | | - secrets: |
123 | | - - GOOGLE_CREDENTIALS |
124 | | - environment: |
125 | | - - CLUSTER_NAME=mysql-op-x${DRONE_BUILD_NUMBER} |
126 | | - - KUBECONFIG=/root/go/.kube/config |
127 | | - - HELM_HOME=/root/go/.helm/ |
128 | | - commands: |
129 | | - - setup-credentials-helper.sh |
130 | | - - gcloud container clusters create $CLUSTER_NAME |
131 | | - --zone europe-west3-b --project testing-reactor |
132 | | - --preemptible --cluster-version 1.19 |
133 | | - # update chart deps |
134 | | - - helm dependency update charts/mysql-operator |
135 | | - when: |
136 | | - branch: master |
137 | | - event: push |
138 | | - |
139 | | - e2e-tests: |
140 | | - image: quay.io/presslabs/bfc:0.11 |
141 | | - secrets: |
142 | | - - GOOGLE_CREDENTIALS |
143 | | - environment: |
144 | | - - APP_VERSION=${DRONE_TAG:-${DRONE_BRANCH/master/latest}} |
145 | | - - KUBECONFIG=/root/go/.kube/config |
146 | | - - HELM_HOME=/root/go/.helm/ |
147 | | - - CLUSTER_NAME=mysql-op-x${DRONE_BUILD_NUMBER} |
148 | | - - BACKUP_BUCKET_NAME=pl-test-mysql-operator |
149 | | - commands: |
150 | | - - setup-credentials-helper.sh |
151 | | - - go test ./test/e2e -v --kubernetes-config /root/go/.kube/config --kubernetes-context gke_testing-reactor_europe-west3-b_$CLUSTER_NAME |
152 | | - --operator-image quay.io/presslabs/mysql-operator:$APP_VERSION |
153 | | - --sidecar-mysql57-image quay.io/presslabs/mysql-operator-sidecar-mysql57:$APP_VERSION |
154 | | - --sidecar-mysql8-image quay.io/presslabs/mysql-operator-sidecar-mysql8:$APP_VERSION |
155 | | - --orchestrator-image quay.io/presslabs/mysql-operator-orchestrator:$APP_VERSION |
156 | | - --pod-wait-timeout 150 |
157 | | - --dump-logs-on-failure=false |
158 | | - -timeout 40m |
159 | | - -ginkgo.slowSpecThreshold 300 |
160 | | - when: |
161 | | - branch: master |
162 | | - event: push |
163 | | - |
164 | | - stop-kubernetes: |
165 | | - image: quay.io/presslabs/bfc:0.11 |
166 | | - secrets: |
167 | | - - GOOGLE_CREDENTIALS |
168 | | - environment: |
169 | | - - CLUSTER_NAME=mysql-op-x${DRONE_BUILD_NUMBER} |
170 | | - - KUBECONFIG=/root/go/.kube/config |
171 | | - commands: |
172 | | - - setup-credentials-helper.sh |
173 | | - - gcloud container clusters delete $CLUSTER_NAME --quiet --zone europe-west3-b --project testing-reactor |
174 | | - when: |
175 | | - status: [ success, failure ] |
176 | | - branch: master |
177 | | - event: push |
| 8 | +workspace: |
| 9 | + base: /workspace |
| 10 | + path: src/github.com/bitpoke/mysql-operator |
| 11 | + |
| 12 | +steps: |
| 13 | +- name: git |
| 14 | + pull: default |
| 15 | + image: plugins/git |
| 16 | + settings: |
| 17 | + depth: 0 |
| 18 | + tags: true |
178 | 19 |
|
| 20 | +- name: install dependencies |
| 21 | + pull: always |
| 22 | + image: docker.io/bitpoke/build:v0.3.0-3.g7069e76 |
| 23 | + commands: |
| 24 | + - make -j4 build.tools |
| 25 | + |
| 26 | +- name: verify generated code |
| 27 | + image: docker.io/bitpoke/build:v0.3.0-3.g7069e76 |
| 28 | + commands: |
| 29 | + - make generate |
| 30 | + - git diff --exit-code |
| 31 | + |
| 32 | +- name: lint |
| 33 | + image: docker.io/bitpoke/build:v0.3.0-3.g7069e76 |
| 34 | + commands: |
| 35 | + - make -j4 lint |
| 36 | + |
| 37 | +- name: test |
| 38 | + image: docker.io/bitpoke/build:v0.3.0-3.g7069e76 |
| 39 | + commands: |
| 40 | + - make test |
| 41 | + |
| 42 | +- name: build |
| 43 | + image: docker.io/bitpoke/build:v0.3.0-3.g7069e76 |
| 44 | + commands: |
| 45 | + - make -j4 build |
| 46 | + |
| 47 | +- name: publish |
| 48 | + image: docker.io/bitpoke/build:v0.3.0-3.g7069e76 |
| 49 | + environment: |
| 50 | + DOCKER_REGISTRY: |
| 51 | + from_secret: DOCKER_REGISTRY |
| 52 | + DOCKER_USERNAME: |
| 53 | + from_secret: DOCKER_USERNAME |
| 54 | + DOCKER_PASSWORD: |
| 55 | + from_secret: DOCKER_PASSWORD |
| 56 | + commands: |
| 57 | + - /usr/local/bin/setup-credentials-helper.sh |
| 58 | + - make publish |
| 59 | + when: |
| 60 | + ref: |
| 61 | + - refs/heads/master |
| 62 | + - refs/heads/release-* |
179 | 63 |
|
180 | 64 | services: |
181 | | - docker: |
182 | | - image: docker:dind |
183 | | - privileged: true |
184 | | - commands: |
185 | | - - mkdir -p "$CI_WORKSPACE/.work/docker" "$CI_WORKSPACE/.cache/docker" |
186 | | - - /usr/local/bin/dockerd-entrypoint.sh dockerd --host "unix://$CI_WORKSPACE/.work/docker/docker.sock" --storage-driver overlay2 --log-level error |
| 65 | +- name: docker |
| 66 | + image: docker:20.10.8-dind |
| 67 | + privileged: true |
| 68 | + commands: |
| 69 | + - /usr/local/bin/dockerd-entrypoint.sh dockerd --host "unix:///workspace/docker.sock" --storage-driver overlay2 --log-level error |
| 70 | + |
| 71 | +trigger: |
| 72 | + ref: |
| 73 | + - refs/pull/** |
| 74 | + - refs/heads/master |
| 75 | + - refs/heads/release-* |
| 76 | + - refs/tags/** |
| 77 | + # CI related changes SHOULD be prefixed with drone- |
| 78 | + - refs/heads/drone-* |
187 | 79 |
|
188 | | - when: |
189 | | - event: |
190 | | - - push |
191 | | - - tag |
0 commit comments