-
Notifications
You must be signed in to change notification settings - Fork 31
79 lines (67 loc) · 2.58 KB
/
e2e-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
name: Run e2e test case on ACK
on:
push:
branches:
- main
pull_request:
branches:
- main
# Environment variables available to all jobs and steps in this workflow.
env:
REGION_ID: cn-zhangjiakou
REGISTRY: registry.cn-zhangjiakou.aliyuncs.com
NAMESPACE: polardbx-ci
TAG: ${{ github.sha }}
ACK_CLUSTER_ID: c5ef7e2fffca74f4286bd91d6a9a47b2f
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
# 1 Setup go environment
- name: Setup go environment
uses: actions/setup-go@v3
with:
go-version: '1.21'
# 2 Set ACK context
- name: Set K8s context
uses: aliyun/ack-set-context@v1
with:
access-key-id: "${{ secrets.ACK_ACCESS_KEY_ID }}"
access-key-secret: "${{ secrets.ACK_ACCESS_KEY_SECRET }}"
cluster-id: "${{ env.ACK_CLUSTER_ID }}"
# 3 Login to ACR
- name: Login to ACR with the AccessKey pair
uses: aliyun/acr-login@v1
with:
login-server: https://registry.cn-zhangjiakou.aliyuncs.com
username: "${{ secrets.ACR_USERNAME }}"
password: "${{ secrets.ACR_PASSWORD }}"
region-id: "${{ env.REGION_ID }}"
# 4 Build images and push to registry
- name: Build and push images
run: |-
make push REPO=$REGISTRY/$NAMESPACE TAG=$TAG
# 5 Generate helm chart
- name: Generate helm chart
run: |-
make helm-package
# 6 Install helm chart into ACK
- name: Install helm chart
run: |-
OPERATOR_FILE=$(ls target/charts | grep polardbx-operator)
helm upgrade --install --set imageRepo=$REGISTRY/$NAMESPACE --set imageTag=$TAG -f .github/config/values.yaml --namespace polardbx-operator-system polardbx-operator target/charts/$OPERATOR_FILE
MONITOR_HELM_FILE=$(ls target/charts | grep polardbx-monitor)
helm upgrade --install --namespace polardbx-monitor polardbx-monitor target/charts/$MONITOR_HELM_FILE
# 7 Run e2e test
- name: Run e2e test
run: |-
go install github.com/onsi/ginkgo/ginkgo@v1.16.5
ginkgo --skip="parameter template" --skip="read-write parameters" --skip="restart parameters" -nodes=2 -v -progress -p ./test/e2e
# 8 Uninstall helm chart and crds
- name: Uninstall helm chart
run: |-
helm uninstall polardbx-operator --namespace polardbx-operator-system
helm uninstall polardbx-monitor --namespace polardbx-monitor
kubectl get crd -o name | grep polardbx | xargs kubectl delete