-
Notifications
You must be signed in to change notification settings - Fork 35
414 lines (400 loc) · 16 KB
/
kubean_e2e_test_ci.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
name: KUBEAN_E2E_TEST_CI
on:
workflow_dispatch: #manual run
workflow_call: # called by Auto Release CI
schedule:
- cron: '0 0 * * FRI' # on every weekend for P3 jobs in weekend with if condition (if: github.event.schedule == '0 0 * * FRI')
- cron: '0 7 * * *' # default: on every night for P2 jobs
- cron: '0 0 1 1 *' # next at 2024-01-01 00:00:00
env:
KUKEAN_OPERATOR_IMAGE_NAME: kubean-operator
KUBESPRAY_IMAGE_NAME: kubespray
SPRAY_JOB_IMAGE_NAME: spray-job
KUBESPRAY_TAG: latest
VSPHERE_USER: ${{ secrets.VSPHERE_USER }}
VSPHERE_PASSWD: ${{ secrets.VSPHERE_PASSWD }}
AMD_ROOT_PASSWORD: ${{ secrets.AMD_ROOT_PASSWORD }}
KYLIN_VM_PASSWORD: ${{ secrets.KYLIN_VM_PASSWORD }}
jobs:
build-push-for-e2e:
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
steps:
- name: Set env
run: |
ORGANIZATION_NAME=$(echo ${GITHUB_REPOSITORY}| awk -F "/" '{print $1}')
echo "REPO=${ORGANIZATION_NAME,,}" >> ${GITHUB_ENV}
- name: Echo env
run: |
echo "REPO: ${{ env.REPO }}"
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Log in to registry
# This is where you will update the PAT to GITHUB_TOKEN
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u $ --password-stdin
- name: kubean-operator Build image
run: docker build . --file ./build/images/$KUKEAN_OPERATOR_IMAGE_NAME/Dockerfile --tag $KUKEAN_OPERATOR_IMAGE_NAME
- name: kubean-operator Push image
run: |
IMAGE_ID=ghcr.io/${{ env.REPO }}/$KUKEAN_OPERATOR_IMAGE_NAME
# Change all uppercase to lowercase
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]')
# Strip git ref prefix from version
VERSION="$(git describe --tags --abbrev=8 --dirty)-e2e"
echo IMAGE_ID=$IMAGE_ID
echo VERSION=$VERSION
docker tag $KUKEAN_OPERATOR_IMAGE_NAME $IMAGE_ID:$VERSION
docker push $IMAGE_ID:$VERSION
- name: spray-job Build image
run: docker build . --file ./build/images/$SPRAY_JOB_IMAGE_NAME/Dockerfile --tag $SPRAY_JOB_IMAGE_NAME --build-arg SPRAY_TAG=$KUBESPRAY_TAG
- name: spray-job Push image
run: |
IMAGE_ID=ghcr.io/${{ env.REPO }}/$SPRAY_JOB_IMAGE_NAME
# Change all uppercase to lowercase
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]')
# Strip git ref prefix from version
VERSION="$(git describe --tags --abbrev=8 --dirty)-e2e"
echo IMAGE_ID=$IMAGE_ID
echo VERSION=$VERSION
docker tag $SPRAY_JOB_IMAGE_NAME $IMAGE_ID:$VERSION
docker push $IMAGE_ID:$VERSION
get_helm_version:
runs-on: ubuntu-latest
outputs:
CONTAINER_TAG: ${{ steps.get_variables.outputs.CONTAINER_TAG }}
HELM_CHART_VERSION: ${{ steps.get_variables.outputs.HELM_CHART_VERSION }}
TAG_SECOND_PART: ${{ steps.get_variables.outputs.TAG_SECOND_PART }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Get HELM_CHART_VERSION
id: get_variables
run: |
CONTAINER_TAG="$(git describe --tags --abbrev=8 --dirty)-e2e"
HELM_CHART_VERSION=`echo ${CONTAINER_TAG}|awk -F "-" '{print $1 }'`
TAG_SECOND_PART=`echo ${CONTAINER_TAG}|awk -F "-" '{print $2 }'`
if [[ ${TAG_SECOND_PART} =~ rc[0-9]+ ]];then
HELM_CHART_VERSION=`echo ${CONTAINER_TAG}|awk -F "-" '{print $1"-"$2 }'`
fi
echo "CONTAINER_TAG=$CONTAINER_TAG" >> "$GITHUB_OUTPUT"
echo "HELM_CHART_VERSION=$HELM_CHART_VERSION" >> "$GITHUB_OUTPUT"
echo "TAG_SECOND_PART=$TAG_SECOND_PART" >> "$GITHUB_OUTPUT"
centos_calico_airgap:
#runs-on: [self-hosted, offline] #for test
runs-on: ubuntu-latest
needs: [get_helm_version, build-push-for-e2e]
env:
CONTAINER_TAG: ${{ needs.get_helm_version.outputs.CONTAINER_TAG }}
HELM_CHART_VERSION: ${{ needs.get_helm_version.outputs.HELM_CHART_VERSION }}
TAG_SECOND_PART: ${{ needs.get_helm_version.outputs.TAG_SECOND_PART }}
steps:
- name: Set env for this job
run: |
OS_TYPE="CENTOS7"
ARCH="amd64"
Network_TYPE="calico"
GAP_TYPE="OFFLINE"
echo "OS_TYPE=${OS_TYPE,,}" >> ${GITHUB_ENV}
echo "ARCH=${ARCH,,}" >> ${GITHUB_ENV}
echo "Network_TYPE=${Network_TYPE,,}" >> ${GITHUB_ENV}
echo "GAP_TYPE=${GAP_TYPE,,}" >> ${GITHUB_ENV}
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-go@v4
with:
go-version: 1.20.4
- name: centos_calico_airgap
run: |
# export runner_name=${{ runner.name }}
# bash ./hack/newE2E.sh
echo "network online testcases"
centos_calico_online: # skip
#runs-on: [self-hosted, online] #for test
runs-on: ubuntu-latest
needs: [centos_calico_airgap, get_helm_version]
env:
CONTAINER_TAG: ${{ needs.get_helm_version.outputs.CONTAINER_TAG }}
HELM_CHART_VERSION: ${{ needs.get_helm_version.outputs.HELM_CHART_VERSION }}
TAG_SECOND_PART: ${{ needs.get_helm_version.outputs.TAG_SECOND_PART }}
if: github.event.schedule == '0 0 1 1 *'
steps:
- name: Set env for this job
run: |
OS_TYPE="CENTOS7"
ARCH="amd64"
Network_TYPE="calico"
GAP_TYPE="ONLINE"
echo "OS_TYPE=${OS_TYPE,,}" >> ${GITHUB_ENV}
echo "ARCH=${ARCH,,}" >> ${GITHUB_ENV}
echo "Network_TYPE=${Network_TYPE,,}" >> ${GITHUB_ENV}
echo "GAP_TYPE=${GAP_TYPE,,}" >> ${GITHUB_ENV}
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-go@v4
with:
go-version: 1.20.4
- name: centos_calico_online
continue-on-error: ${{ vars.CENTOS_CALICO_ONLINE_ALLOW_FAILURE != 'false' }}
run: |
# export runner_name=${{ runner.name }}
# bash ./hack/newE2E.sh
echo "network online testcases"
centos_cilium_online: # skip
# This is actually e2e_offline action
# runs-on: [self-hosted, offline] #for test
runs-on: ubuntu-latest # for test
needs: [centos_calico_airgap, get_helm_version]
env:
CONTAINER_TAG: ${{ needs.get_helm_version.outputs.CONTAINER_TAG }}
HELM_CHART_VERSION: ${{ needs.get_helm_version.outputs.HELM_CHART_VERSION }}
TAG_SECOND_PART: ${{ needs.get_helm_version.outputs.TAG_SECOND_PART }}
#if: github.event.schedule == '0 0 * * FRI'
if: github.event.schedule == '0 0 1 1 *'
steps:
- name: Install yq tool
uses: mikefarah/[email protected]
- name: Set env for this job
run: |
OS_TYPE="CENTOS7"
ARCH="amd64"
Network_TYPE="cilium"
GAP_TYPE="ONLINE"
echo "OS_TYPE=${OS_TYPE,,}" >> ${GITHUB_ENV}
echo "ARCH=${ARCH,,}" >> ${GITHUB_ENV}
echo "Network_TYPE=${Network_TYPE,,}" >> ${GITHUB_ENV}
echo "GAP_TYPE=${GAP_TYPE,,}" >> ${GITHUB_ENV}
- uses: actions/checkout@v3
with:
fetch-depth: 0
# - uses: actions/setup-go@v4
# with:
# go-version: 1.20.4
- name: centos_cilium_online
continue-on-error: ${{ vars.CENTOS_CILIUM_ONLINE_ALLOW_FAILURE != 'false' }}
run: |
# export runner_name=${{ runner.name }}
# bash ./hack/newE2E.sh
echo "network online testcases"
centos_cilium_airgap:
# runs-on: [self-hosted, offline]
runs-on: [self-hosted, online] # test network testcases online in Jun
needs: [centos_calico_airgap, get_helm_version]
env:
CONTAINER_TAG: ${{ needs.get_helm_version.outputs.CONTAINER_TAG }}
HELM_CHART_VERSION: ${{ needs.get_helm_version.outputs.HELM_CHART_VERSION }}
TAG_SECOND_PART: ${{ needs.get_helm_version.outputs.TAG_SECOND_PART }}
steps:
- name: Set env for this job
run: |
OS_TYPE="CENTOS7"
ARCH="amd64"
Network_TYPE="cilium"
#GAP_TYPE="OFFLINE" # for test
GAP_TYPE="ONLINE"
echo "OS_TYPE=${OS_TYPE,,}" >> ${GITHUB_ENV}
echo "ARCH=${ARCH,,}" >> ${GITHUB_ENV}
echo "Network_TYPE=${Network_TYPE,,}" >> ${GITHUB_ENV}
echo "GAP_TYPE=${GAP_TYPE,,}" >> ${GITHUB_ENV}
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-go@v4
with:
go-version: 1.20.4
- name: centos_cilium_airgap
continue-on-error: ${{ vars.CENTOS_CILIUM_AIRGAP_ALLOW_FAILURE != 'false' }}
run: |
export runner_name=${{ runner.name }}
export OS_TYPE="CENTOS7" # for test
export GAP_TYPE="ONLINE" # for test
bash ./hack/newE2E.sh
redhat_calico_online:
runs-on: [self-hosted, online]
needs: [centos_calico_airgap, get_helm_version]
env:
CONTAINER_TAG: ${{ needs.get_helm_version.outputs.CONTAINER_TAG }}
HELM_CHART_VERSION: ${{ needs.get_helm_version.outputs.HELM_CHART_VERSION }}
TAG_SECOND_PART: ${{ needs.get_helm_version.outputs.TAG_SECOND_PART }}
#if: github.event.schedule == '0 0 * * FRI' #skip
if: github.event.schedule == '0 0 1 1 *'
steps:
- name: Set env for this job
run: |
OS_TYPE="REDHAT8"
ARCH="amd64"
Network_TYPE="calico"
GAP_TYPE="ONLINE"
echo "OS_TYPE=${OS_TYPE,,}" >> ${GITHUB_ENV}
echo "ARCH=${ARCH,,}" >> ${GITHUB_ENV}
echo "Network_TYPE=${Network_TYPE,,}" >> ${GITHUB_ENV}
echo "GAP_TYPE=${GAP_TYPE,,}" >> ${GITHUB_ENV}
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-go@v4
with:
go-version: 1.20.4
- name: redhat_calico_online
continue-on-error: ${{ vars.REDHAT_CALICO_ONLINE_ALLOW_FAILURE != 'false' }}
run: |
export runner_name=${{ runner.name }}
bash ./hack/newE2E.sh
redhat_calico_airgap:
runs-on: [self-hosted, offline]
needs: [centos_calico_airgap, get_helm_version]
env:
CONTAINER_TAG: ${{ needs.get_helm_version.outputs.CONTAINER_TAG }}
HELM_CHART_VERSION: ${{ needs.get_helm_version.outputs.HELM_CHART_VERSION }}
TAG_SECOND_PART: ${{ needs.get_helm_version.outputs.TAG_SECOND_PART }}
if: github.event.schedule == '0 0 1 1 *'
steps:
- name: Set env for this job
run: |
OS_TYPE="REDHAT8"
ARCH="amd64"
Network_TYPE="calico"
GAP_TYPE="OFFLINE"
echo "OS_TYPE=${OS_TYPE,,}" >> ${GITHUB_ENV}
echo "ARCH=${ARCH,,}" >> ${GITHUB_ENV}
echo "Network_TYPE=${Network_TYPE,,}" >> ${GITHUB_ENV}
echo "GAP_TYPE=${GAP_TYPE,,}" >> ${GITHUB_ENV}
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-go@v4
with:
go-version: 1.20.4
- name: redhat_calico_airgap
continue-on-error: ${{ vars.REDHAT_CALICO_AIRGAP_ALLOW_FAILURE != 'false' }}
run: |
export runner_name=${{ runner.name }}
bash ./hack/newE2E.sh
redhat_cilium_airgap:
runs-on: [self-hosted, offline]
needs: [centos_calico_airgap, get_helm_version]
env:
CONTAINER_TAG: ${{ needs.get_helm_version.outputs.CONTAINER_TAG }}
HELM_CHART_VERSION: ${{ needs.get_helm_version.outputs.HELM_CHART_VERSION }}
TAG_SECOND_PART: ${{ needs.get_helm_version.outputs.TAG_SECOND_PART }}
if: github.event.schedule == '0 0 1 1 *'
steps:
- name: Set env for this job
run: |
OS_TYPE="REDHAT8"
ARCH="amd64"
Network_TYPE="cilium"
GAP_TYPE="OFFLINE"
echo "OS_TYPE=${OS_TYPE,,}" >> ${GITHUB_ENV}
echo "ARCH=${ARCH,,}" >> ${GITHUB_ENV}
echo "Network_TYPE=${Network_TYPE,,}" >> ${GITHUB_ENV}
echo "GAP_TYPE=${GAP_TYPE,,}" >> ${GITHUB_ENV}
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-go@v4
with:
go-version: 1.20.4
- name: redhat_cilium_airgap
continue-on-error: ${{ vars.REDHAT_CILIUM_AIRGAP_ALLOW_FAILURE != 'false' }}
run: |
export runner_name=${{ runner.name }}
bash ./hack/newE2E.sh
redhat_cilium_online:
needs: [get_helm_version, centos_calico_online, centos_cilium_online, centos_cilium_airgap, redhat_calico_online, redhat_calico_airgap, redhat_cilium_airgap]
runs-on: [self-hosted, online]
env:
CONTAINER_TAG: ${{ needs.get_helm_version.outputs.CONTAINER_TAG }}
HELM_CHART_VERSION: ${{ needs.get_helm_version.outputs.HELM_CHART_VERSION }}
TAG_SECOND_PART: ${{ needs.get_helm_version.outputs.TAG_SECOND_PART }}
# if: github.event.schedule == '0 0 * * FRI' #skip
if: github.event.schedule == '0 0 1 1 *'
steps:
- name: Set env for this job
run: |
OS_TYPE="REDHAT8"
ARCH="amd64"
Network_TYPE="cilium"
GAP_TYPE="ONLINE"
echo "OS_TYPE=${OS_TYPE,,}" >> ${GITHUB_ENV}
echo "ARCH=${ARCH,,}" >> ${GITHUB_ENV}
echo "Network_TYPE=${Network_TYPE,,}" >> ${GITHUB_ENV}
echo "GAP_TYPE=${GAP_TYPE,,}" >> ${GITHUB_ENV}
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-go@v4
with:
go-version: 1.20.4
- name: redhat_cilium_online
continue-on-error: ${{ vars.REDHAT_CILIUM_ONLINE_ALLOW_FAILURE != 'false' }}
run: |
export runner_name=${{ runner.name }}
bash ./hack/newE2E.sh
kylin_calico_online:
needs: [get_helm_version, centos_calico_online, centos_cilium_online, centos_cilium_airgap, redhat_calico_online, redhat_calico_airgap, redhat_cilium_airgap]
runs-on: [self-hosted, online]
env:
CONTAINER_TAG: ${{ needs.get_helm_version.outputs.CONTAINER_TAG }}
HELM_CHART_VERSION: ${{ needs.get_helm_version.outputs.HELM_CHART_VERSION }}
TAG_SECOND_PART: ${{ needs.get_helm_version.outputs.TAG_SECOND_PART }}
#if: github.event.schedule == '0 0 * * FRI' #skip
if: github.event.schedule == '0 0 1 1 *'
steps:
- name: Set env for this job
run: |
OS_TYPE="kylin"
ARCH="arm"
Network_TYPE="calico"
GAP_TYPE="ONLINE"
echo "OS_TYPE=${OS_TYPE,,}" >> ${GITHUB_ENV}
echo "ARCH=${ARCH,,}" >> ${GITHUB_ENV}
echo "Network_TYPE=${Network_TYPE,,}" >> ${GITHUB_ENV}
echo "GAP_TYPE=${GAP_TYPE,,}" >> ${GITHUB_ENV}
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-go@v4
with:
go-version: 1.20.4
- name: kylin_calico_online
continue-on-error: ${{ vars.KYLIN_CALICO_ONLINE_ALLOW_FAILURE != 'false' }}
run: |
export runner_name=${{ runner.name }}
bash ./hack/newE2E.sh
kylin_calico_airgap:
needs: [get_helm_version, centos_calico_online, centos_cilium_online, centos_cilium_airgap, redhat_calico_online, redhat_calico_airgap, redhat_cilium_airgap]
runs-on: [self-hosted, offline]
env:
CONTAINER_TAG: ${{ needs.get_helm_version.outputs.CONTAINER_TAG }}
HELM_CHART_VERSION: ${{ needs.get_helm_version.outputs.HELM_CHART_VERSION }}
TAG_SECOND_PART: ${{ needs.get_helm_version.outputs.TAG_SECOND_PART }}
#if: github.event.schedule == '0 0 * * FRI' #skip
if: github.event.schedule == '0 0 1 1 *'
steps:
- name: Set env for this job
run: |
OS_TYPE="kylin"
ARCH="arm"
Network_TYPE="calico"
GAP_TYPE="OFFLINE"
echo "OS_TYPE=${OS_TYPE,,}" >> ${GITHUB_ENV}
echo "ARCH=${ARCH,,}" >> ${GITHUB_ENV}
echo "Network_TYPE=${Network_TYPE,,}" >> ${GITHUB_ENV}
echo "GAP_TYPE=${GAP_TYPE,,}" >> ${GITHUB_ENV}
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-go@v4
with:
go-version: 1.20.4
- name: kylin_calico_airgap
continue-on-error: ${{ vars.KYLIN_CALICO_AIRGAP_ALLOW_FAILURE != 'false' }}
run: |
export runner_name=${{ runner.name }}
bash ./hack/newE2E.sh