-
Notifications
You must be signed in to change notification settings - Fork 421
429 lines (365 loc) · 14.4 KB
/
test-job.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
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
name: Go-build-and-test
on:
push:
branches:
- master
pull_request:
branches: [ master ]
jobs:
lint:
name: Lint (pre-commit)
runs-on: ubuntu-latest
steps:
- name: Install golangci-lint
run: |
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s v1.60.3
mv ./bin/golangci-lint /usr/local/bin/golangci-lint
shell: bash
- name: Install kubeconform
run: |
curl -L https://github.com/yannh/kubeconform/releases/download/v0.6.7/kubeconform-linux-amd64.tar.gz -o kubeconform.tar.gz
tar -xzf kubeconform.tar.gz
mv kubeconform /usr/local/bin/
- uses: actions/checkout@v3
- uses: actions/setup-python@v3
- uses: pre-commit/[email protected]
build_apiserver:
env:
working-directory: ./apiserver
name: Build Apiserver and Docker Images
runs-on: ubuntu-latest
steps:
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: v1.22
- name: Check out code into the Go module directory
uses: actions/checkout@v2
with:
# When checking out the repository that
# triggered a workflow, this defaults to the reference or SHA for that event.
# Default value should work for both pull_request and merge(push) event.
ref: ${{github.event.pull_request.head.sha}}
- name: list directories
working-directory: ${{env.working-directory}}
run: |
pwd
ls -R
- name: install kubebuilder
run: |
wget https://github.com/kubernetes-sigs/kubebuilder/releases/download/v3.0.0/kubebuilder_$(go env GOOS)_$(go env GOARCH)
sudo mv kubebuilder_$(go env GOOS)_$(go env GOARCH) /usr/local/bin/kubebuilder
- name: Get revision SHA
id: vars
run: echo "::set-output name=sha_short::$(git rev-parse --short HEAD)"
- name: Get dependencies
run: go mod download
working-directory: ${{env.working-directory}}
- name: Build
run: go build ./...
working-directory: ${{env.working-directory}}
- name: Test
run: go test ./pkg/... ./cmd/... -race -parallel 4
working-directory: ${{env.working-directory}}
- name: Set up Docker
uses: docker-practice/actions-setup-docker@master
- name: Build Docker Image - Apiserver
run: |
docker build -t kuberay/apiserver:${{ steps.vars.outputs.sha_short }} -f apiserver/Dockerfile .
docker save -o /tmp/apiserver.tar kuberay/apiserver:${{ steps.vars.outputs.sha_short }}
- name: Upload Artifact Apiserver
uses: actions/upload-artifact@v4
with:
name: apiserver_img
path: /tmp/apiserver.tar
- name: Log in to Quay.io
uses: docker/login-action@v2
with:
registry: quay.io
username: ${{ secrets.QUAY_USERNAME }}
password: ${{ secrets.QUAY_ROBOT_TOKEN }}
if: contains(fromJson('["refs/heads/master"]'), github.ref)
- name: Push Apiserver to Quay.io
run: |
docker image tag kuberay/apiserver:${{ steps.vars.outputs.sha_short }} quay.io/kuberay/apiserver:${{ steps.vars.outputs.sha_short }};
docker push quay.io/kuberay/apiserver:${{ steps.vars.outputs.sha_short }};
docker image tag kuberay/apiserver:${{ steps.vars.outputs.sha_short }} quay.io/kuberay/apiserver:nightly;
docker push quay.io/kuberay/apiserver:nightly
if: contains(fromJson('["refs/heads/master"]'), github.ref)
build_security_proxy:
env:
working-directory: ./experimental
name: Build security proxy Binaries and Docker Images
runs-on: ubuntu-latest
steps:
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: v1.22
- name: Check out code into the Go module directory
uses: actions/checkout@v2
with:
# When checking out the repository that
# triggered a workflow, this defaults to the reference or SHA for that event.
# Default value should work for both pull_request and merge(push) event.
ref: ${{github.event.pull_request.head.sha}}
- name: list directories
working-directory: ${{env.working-directory}}
run: |
pwd
ls -R
- name: install kubebuilder
run: |
wget https://github.com/kubernetes-sigs/kubebuilder/releases/download/v3.0.0/kubebuilder_$(go env GOOS)_$(go env GOARCH)
sudo mv kubebuilder_$(go env GOOS)_$(go env GOARCH) /usr/local/bin/kubebuilder
- name: Get revision SHA
id: vars
run: echo "::set-output name=sha_short::$(git rev-parse --short HEAD)"
- name: Get dependencies
run: go mod download
working-directory: ${{env.working-directory}}
- name: Build
run: make build
working-directory: ${{env.working-directory}}
- name: Set up Docker
uses: docker-practice/actions-setup-docker@master
- name: Build Docker Image - security proxy
run: |
IMG=kuberay/security-proxy:${{ steps.vars.outputs.sha_short }} make docker-image
docker save -o /tmp/security-proxy.tar kuberay/security-proxy:${{ steps.vars.outputs.sha_short }}
working-directory: ${{env.working-directory}}
- name: Upload security proxy artifact
uses: actions/upload-artifact@v4
with:
name: security-proxy_img
path: /tmp/security-proxy.tar
- name: Log in to Quay.io
uses: docker/login-action@v2
with:
registry: quay.io
username: ${{ secrets.QUAY_USERNAME }}
password: ${{ secrets.QUAY_ROBOT_TOKEN }}
if: contains(fromJson('["refs/heads/master"]'), github.ref)
- name: Push security proxy to Quay.io
run: |
docker image tag kuberay/security-proxy:${{ steps.vars.outputs.sha_short }} quay.io/kuberay/security-proxy:${{ steps.vars.outputs.sha_short }};
docker push quay.io/kuberay/security-proxy:${{ steps.vars.outputs.sha_short }};
docker image tag kuberay/security-proxy:${{ steps.vars.outputs.sha_short }} quay.io/kuberay/security-proxy:nightly;
docker push quay.io/kuberay/security-proxy:nightly
if: contains(fromJson('["refs/heads/master"]'), github.ref)
build_operator:
env:
working-directory: ./ray-operator
name: Build Operator Binaries and Docker Images
runs-on: ubuntu-latest
steps:
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: v1.22
- name: Check out code into the Go module directory
uses: actions/checkout@v2
with:
# When checking out the repository that
# triggered a workflow, this defaults to the reference or SHA for that event.
# Default value should work for both pull_request and merge(push) event.
ref: ${{github.event.pull_request.head.sha}}
- name: list directories
working-directory: ${{env.working-directory}}
run: |
pwd
ls -R
- name: install kubebuilder
run: |
wget https://github.com/kubernetes-sigs/kubebuilder/releases/download/v3.0.0/kubebuilder_$(go env GOOS)_$(go env GOARCH)
sudo mv kubebuilder_$(go env GOOS)_$(go env GOARCH) /usr/local/bin/kubebuilder
- name: Get revision SHA
id: vars
run: echo "::set-output name=sha_short::$(git rev-parse --short HEAD)"
- name: Get dependencies
run: go mod download
working-directory: ${{env.working-directory}}
- name: Build
run: make build
working-directory: ${{env.working-directory}}
- name: Test
run: make test
working-directory: ${{env.working-directory}}
- name: Set up Docker
uses: docker-practice/actions-setup-docker@master
- name: Build Docker Image - Operator
run: |
IMG=kuberay/operator:${{ steps.vars.outputs.sha_short }} make docker-image
docker save -o /tmp/operator.tar kuberay/operator:${{ steps.vars.outputs.sha_short }}
working-directory: ${{env.working-directory}}
- name: Upload Artifact Operator
uses: actions/upload-artifact@v4
with:
name: operator_img
path: /tmp/operator.tar
- name: Log in to Quay.io
uses: docker/login-action@v2
with:
registry: quay.io
username: ${{ secrets.QUAY_USERNAME }}
password: ${{ secrets.QUAY_ROBOT_TOKEN }}
if: contains(fromJson('["refs/heads/master"]'), github.ref)
# Build operators inside the gh runner vm directly and then copy the go binaries to docker images using the Dockerfile.buildx
- name: Compile linux/amd64 Operator go binary
env:
CGO_ENABLED: 1
GOOS: linux
GOARCH: amd64
run: |
CGO_ENABLED=$CGO_ENABLED GOOS=$GOOS GOARCH=$GOARCH go build -tags strictfipsruntime -a -o manager-$GOARCH main.go
working-directory: ${{env.working-directory}}
if: contains(fromJson('["refs/heads/master"]'), github.ref)
- name: Cross Compile linux/arm64 Operator binary
env:
CC: aarch64-linux-gnu-gcc
CGO_ENABLED: 1
GOOS: linux
GOARCH: arm64
run: |
sudo apt-get update
sudo apt-get install -y gcc-aarch64-linux-gnu libc6-dev-arm64-cross
CC=$CC CGO_ENABLED=$CGO_ENABLED GOOS=$GOOS GOARCH=$GOARCH go build -tags strictfipsruntime -a -o manager-$GOARCH main.go
working-directory: ${{env.working-directory}}
if: contains(fromJson('["refs/heads/master"]'), github.ref)
- name: Build MultiArch Docker Image and Push on Merge
uses: docker/build-push-action@v5
env:
REPO_ORG: kuberay
REPO_NAME: operator
with:
platforms: linux/amd64,linux/arm64
context: ${{env.working-directory}}
file: ${{env.working-directory}}/Dockerfile.buildx
push: true
provenance: false
tags: |
quay.io/${{env.REPO_ORG}}/${{env.REPO_NAME}}:${{ steps.vars.outputs.sha_short }}
quay.io/${{env.REPO_ORG}}/${{env.REPO_NAME}}:nightly
if: contains(fromJson('["refs/heads/master"]'), github.ref)
build_kubectl-plugin:
env:
working-directory: ./kubectl-plugin
name: Build Ray Kubectl plugin
runs-on: ubuntu-latest
steps:
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: v1.22
- name: Check out code into the Go module directory
uses: actions/checkout@v2
with:
# When checking out the repository that
# triggered a workflow, this defaults to the reference or SHA for that event.
# Default value should work for both pull_request and merge(push) event.
ref: ${{github.event.pull_request.head.sha}}
- name: Get dependencies
run: go mod download
working-directory: ${{env.working-directory}}
- name: Build CLI
run: go build -o kubectl-ray -a ./cmd/kubectl-ray.go
working-directory: ${{env.working-directory}}
- name: Test
run: go test ./pkg/... -race -parallel 4
working-directory: ${{env.working-directory}}
test-compatibility-2_7_0:
needs:
- build_operator
- build_apiserver
- lint
runs-on: ubuntu-latest
name: Compatibility Test - 2.7.0
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v2
with:
# When checking out the repository that
# triggered a workflow, this defaults to the reference or SHA for that event.
# Default value should work for both pull_request and merge(push) event.
ref: ${{github.event.pull_request.head.sha}}
- uses: ./.github/workflows/actions/compatibility
with:
ray_version: 2.7.0
test-compatibility-2_8_0:
needs:
- build_operator
- build_apiserver
- lint
runs-on: ubuntu-latest
name: Compatibility Test - 2.8.0
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v2
with:
# When checking out the repository that
# triggered a workflow, this defaults to the reference or SHA for that event.
# Default value should work for both pull_request and merge(push) event.
ref: ${{github.event.pull_request.head.sha}}
- uses: ./.github/workflows/actions/compatibility
with:
ray_version: 2.8.0
test-compatibility-2_9_0:
needs:
- build_operator
- build_apiserver
- lint
runs-on: ubuntu-latest
name: Compatibility Test - 2.9.0
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v2
with:
# When checking out the repository that
# triggered a workflow, this defaults to the reference or SHA for that event.
# Default value should work for both pull_request and merge(push) event.
ref: ${{github.event.pull_request.head.sha}}
- uses: ./.github/workflows/actions/compatibility
with:
ray_version: 2.9.0
test-compatibility-nightly:
needs:
- build_operator
- build_apiserver
- lint
runs-on: ubuntu-latest
name: Compatibility Test - Nightly
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v2
with:
# When checking out the repository that
# triggered a workflow, this defaults to the reference or SHA for that event.
# Default value should work for both pull_request and merge(push) event.
ref: ${{github.event.pull_request.head.sha}}
- uses: ./.github/workflows/actions/compatibility
with:
ray_version: nightly
python-client-test:
runs-on: ubuntu-latest
name: Python Client Test
steps:
- name: Set up Docker
uses: docker-practice/actions-setup-docker@master
- name: Install Kind
run: |
curl -Lo ./kind https://kind.sigs.k8s.io/dl/v0.22.0/kind-linux-amd64
chmod +x ./kind
sudo mv ./kind /usr/local/bin/kind
kind create cluster
shell: bash
- name: Checkout Python
uses: actions/checkout@v2
- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: Install package and run unittest for Python client
working-directory: ./clients/python-client
run: |
pip install -e .
python3 -m unittest discover 'python_client_test/'