-
Notifications
You must be signed in to change notification settings - Fork 121
378 lines (333 loc) · 12.9 KB
/
vineyard-operator.yaml
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
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
# Copyright 2020-2023 Alibaba Group Holding Limited.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
name: Vineyard Operator
on:
push:
branches:
- main
tags:
- 'v*'
paths:
- '.github/workflows/vineyard-operator.yaml'
- 'charts/vineyard-operator/**'
- 'docker/Dockerfile.vineyardd*'
- 'k8s/**'
- 'src/server/util/kubectl*'
pull_request:
branches:
- main
- dev/kubernetes
paths:
- '.github/workflows/vineyard-operator.yaml'
- 'charts/vineyard-operator/**'
- 'docker/Dockerfile.vineyardd*'
- 'k8s/**'
- 'src/server/util/kubectl*'
workflow_dispatch:
concurrency:
group: ${{ github.repository }}-${{ github.event.number || github.head_ref || github.sha }}-${{ github.workflow }}
cancel-in-progress: true
env:
REGISTRY: ghcr.io/v6d-io/v6d
IMG: vineyardcloudnative/vineyard-operator:latest
NIGHTLY_IMG: ghcr.io/v6d-io/v6d/vineyard-operator:nightly
LATEST_IMG: ghcr.io/v6d-io/v6d/vineyard-operator:latest
KUBECONFIG: /tmp/e2e-k8s.config
jobs:
ci:
runs-on: ubuntu-20.04
if: ${{ github.repository == 'v6d-io/v6d' }}
strategy:
fail-fast: false
matrix:
job:
- release
- unit-tests
- e2e-tests-airflow-integration
- e2e-tests-assembly-local
- e2e-tests-assembly-distributed
- e2e-tests-autogenerated-helm-chart
- e2e-tests-failover
- e2e-tests-repartition-dask
- e2e-tests-schedule-workflow
- e2e-tests-schedule-workflow-without-crd
- e2e-tests-schedule-workload
- e2e-tests-serialize
- e2e-tests-sidecar
- e2e-tests-spill
- e2e-tests-workflow
- e2e-tests-mars-examples
- e2e-tests-vineyardctl
- e2e-tests-vineyardctl-python-api
- e2e-tests-deploy-raw-backup-and-recover
- e2e-tests-three-etcd-nodes-failover
- e2e-tests-five-etcd-nodes-failover
steps:
- uses: actions/checkout@v3
with:
submodules: true
- name: Free disk space
run: |
bash .github/free-disk-space.sh
- uses: actions/setup-go@v3
with:
go-version: 1.19
- name: Cache for golang
uses: actions/cache@v3
with:
path: ~/go
key: vineyard-kubernetes-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
vineyard-kubernetes-go-
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
version: v1.50.0
working-directory: k8s
skip-pkg-cache: true
- name: Golang format
run: |
function prepend() { while read line; do echo "${1}${line}"; done; }
make -C k8s fmt
GIT_DIFF=$(git diff --ignore-submodules)
if [[ -n $GIT_DIFF ]]; then
echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
echo "| gofmt failures found!"
echo "|"
echo "$GIT_DIFF" | prepend "| "
echo "|"
echo "| Run: "
echo "|"
echo "| make -C k8s fmt"
echo "|"
echo "| to fix this error."
echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
exit -1
fi
- name: Log in to GitHub Docker Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build docker image
run: |
make -C k8s docker-build
- name: Extract tag name
id: tag
if: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') }}
run: echo "TAG=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
- name: Set up qemu
if: ${{ matrix.job == 'release' && github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') && github.repository == 'v6d-io/v6d' }}
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
if: ${{ matrix.job == 'release' && github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') && github.repository == 'v6d-io/v6d' }}
uses: docker/setup-buildx-action@v2
- name: Upload latest docker image of vineyard-operator
if: ${{ matrix.job == 'release' && github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') && github.repository == 'v6d-io/v6d' }}
run: |
# pre-publish to ghcr.io to avoid the "no basic auth credentials" error
export IMG=ghcr.io/v6d-io/v6d/vineyard-operator:${{ steps.tag.outputs.TAG }}
make -C k8s docker-build-push-multi-arch REGISTRY=${{ env.REGISTRY }} VERSION=${{ steps.tag.outputs.TAG }}
export IMG=ghcr.io/v6d-io/v6d/vineyard-operator:latest
make -C k8s docker-build-push-multi-arch REGISTRY=${{ env.REGISTRY }} VERSION=latest
- name: Generate the python and vineyardd image for tests
run: |
go build -a -o python/vineyard/bdist/vineyardctl k8s/cmd/main.go && \
make -C k8s/test/e2e build-base-images
- name: unit-tests
if: ${{ matrix.job == 'unit-tests' }}
run: |
make -C k8s/test/e2e unittest
- name: Prepare directories for logs
run: |
# create log directories for all tasks to prevent the "Path to upload does not exist" warnings
for job in e2e-tests-airflow-integration \
e2e-tests-assembly-local \
e2e-tests-assembly-distributed \
e2e-tests-autogenerated-helm-chart \
e2e-tests-failover \
e2e-tests-repartition-dask \
e2e-tests-schedule-workflow \
e2e-tests-schedule-workflow-without-crd \
e2e-tests-schedule-workload \
e2e-tests-serialize \
e2e-tests-sidecar \
e2e-tests-spill \
e2e-tests-workflow \
e2e-tests-mars-examples \
e2e-tests-vineyardctl \
e2e-tests-deploy-raw-backup-and-recover \
e2e-tests-three-etcd-nodes-failover \
e2e-tests-five-etcd-nodes-failover \
unit-tests; do
mkdir -p $job-logs
chmod a+rwx $job-logs
done
- name: Start to export kubernetes logs
uses: dashanji/kubernetes-log-export-action@v6
env:
SHOW_TIMESTAMPS: 'true'
OUTPUT_DIR: ${{ github.workspace }}/${{ matrix.job }}-logs
NAMESPACES: vineyard*
RESOURCES: configmap
MODE: start
- name: e2e-tests-airflow-integration
if: ${{ matrix.job == 'e2e-tests-airflow-integration' }}
run: |
make -C k8s/test/e2e e2e-tests-airflow-integration
- name: e2e-tests-assembly-local
if: ${{ matrix.job == 'e2e-tests-assembly-local' }}
run: |
make -C k8s/test/e2e e2e-tests-assembly-local
- name: e2e-tests-assembly-distributed
if: ${{ matrix.job == 'e2e-tests-assembly-distributed' }}
run: |
make -C k8s/test/e2e e2e-tests-assembly-distributed
- name: e2e-tests-autogenerated-helm-chart
if: ${{ matrix.job == 'e2e-tests-autogenerated-helm-chart' }}
run: |
make -C k8s/test/e2e e2e-tests-autogenerated-helm-chart
- name: e2e-tests-failover
if: ${{ matrix.job == 'e2e-tests-failover' }}
run: |
make -C k8s/test/e2e e2e-tests-failover
- name: e2e-tests-repartition-dask
if: ${{ matrix.job == 'e2e-tests-repartition-dask' }}
run: |
make -C k8s/test/e2e e2e-tests-repartition-dask
- name: e2e-tests-schedule-workflow
if: ${{ matrix.job == 'e2e-tests-schedule-workflow' }}
run: |
make -C k8s/test/e2e e2e-tests-schedule-workflow
- name: e2e-tests-schedule-workflow-without-crd
if: ${{ matrix.job == 'e2e-tests-schedule-workflow-without-crd' }}
run: |
make -C k8s/test/e2e e2e-tests-schedule-workflow-without-crd
- name: e2e-tests-schedule-workload
if: ${{ matrix.job == 'e2e-tests-schedule-workload' }}
run: |
make -C k8s/test/e2e e2e-tests-schedule-workload
- name: e2e-tests-serialize
if: ${{ matrix.job == 'e2e-tests-serialize' }}
run: |
make -C k8s/test/e2e e2e-tests-serialize
- name: e2e-tests-sidecar
if: ${{ matrix.job == 'e2e-tests-sidecar' }}
run: |
make -C k8s/test/e2e e2e-tests-sidecar
- name: e2e-tests-spill
if: ${{ matrix.job == 'e2e-tests-spill' }}
run: |
make -C k8s/test/e2e e2e-tests-spill
- name: e2e-tests-workflow
if: ${{ matrix.job == 'e2e-tests-workflow' }}
run: |
make -C k8s/test/e2e e2e-tests-workflow
- name: e2e-tests-mars-examples
if: false # temporarily disabled, we need some changes in mars
# if: ${{ matrix.job == 'e2e-tests-mars-examples' }}
run: |
make -C k8s/test/e2e e2e-tests-mars-examples
- name: e2e-tests-vineyardctl
if: ${{ matrix.job == 'e2e-tests-vineyardctl' }}
run: |
make -C k8s/test/e2e e2e-tests-vineyardctl
- name: e2e-tests-vineyardctl-python-api
if: ${{ matrix.job == 'e2e-tests-vineyardctl-python-api' }}
run: |
make -C k8s/test/e2e e2e-tests-vineyardctl-python-api
- name: e2e-tests-deploy-raw-backup-and-recover
if: ${{ matrix.job == 'e2e-tests-deploy-raw-backup-and-recover' }}
run: |
make -C k8s/test/e2e e2e-tests-deploy-raw-backup-and-recover
- name: e2e-tests-three-etcd-nodes-failover
if: ${{ matrix.job == 'e2e-tests-three-etcd-nodes-failover' }}
run: |
make -C k8s/test/e2e e2e-tests-three-etcd-nodes-failover
- name: e2e-tests-five-etcd-nodes-failover
if: ${{ matrix.job == 'e2e-tests-five-etcd-nodes-failover' }}
run: |
make -C k8s/test/e2e e2e-tests-five-etcd-nodes-failover
- name: Stop to export kubernetes logs
uses: dashanji/kubernetes-log-export-action@v6
if: ${{ failure() }}
env:
MODE: stop
OUTPUT_DIR: ${{ github.workspace }}/${{ matrix.job }}-logs
WITH_STOAT: true
- name: Setup tmate session
if: false
uses: mxschmitt/action-tmate@v3
- uses: stoat-dev/stoat-action@v0
if: ${{ failure() }}
- name: Leave a message for logs URL
if: ${{ failure() }}
run: |
sha=${{ github.event.pull_request.head.sha || github.sha }}
short_sha=$(git rev-parse --short $sha)
case ${{ matrix.job }} in
e2e-tests-spill)
signed_url_key=0707
;;
e2e-tests-sidecar)
signed_url_key=eb62
;;
e2e-tests-failover)
signed_url_key=4302
;;
e2e-tests-workflow)
signed_url_key=2355
;;
e2e-tests-serialize)
signed_url_key=ab53
;;
e2e-tests-vineyardctl)
signed_url_key=cb83
;;
e2e-tests-assembly-local)
signed_url_key=2cdf
;;
e2e-tests-repartition-dask)
signed_url_key=fb84
;;
e2e-tests-assembly-distributed)
signed_url_key=2573
;;
e2e-tests-autogenerated-helm-chart)
signed_url_key=7a77
;;
e2e-tests-schedule-workload)
signed_url_key=3d07
;;
e2e-tests-schedule-workflow)
signed_url_key=44c1
;;
e2e-tests-schedule-workflow-without-crd)
signed_url_key=9a01
;;
e2e-tests-deploy-raw-backup-and-recover)
signed_url_key=6552
;;
e2e-tests-airflow-integration)
signed_url_key=2e12
;;
e2e-tests-three-etcd-nodes-failover)
signed_url_key=5c91
;;
e2e-tests-five-etcd-nodes-failover)
signed_url_key=7793
;;
esac
echo "::notice:: ${{ matrix.job }}: https://www.stoat.dev/file-viewer?root=https://v6d-io--v6d--$short_sha--e2e-tests-$signed_url_key.stoat.page"