Skip to content

Commit 469833b

Browse files
committed
Support upgrade scenario
Signed-off-by: wen.rui <[email protected]>
1 parent c022221 commit 469833b

File tree

5 files changed

+81
-13
lines changed

5 files changed

+81
-13
lines changed

.github/workflows/auto-release.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -135,17 +135,17 @@ jobs:
135135
uses: ./.github/workflows/call-release-website.yaml
136136
with:
137137
ref: ${{ needs.ensure-tag.outputs.tag }}
138-
# excute a full e2e test when hami release
138+
# execute a full e2e test when hami release
139139
release-e2e:
140-
needs: [release-notes]
140+
needs: [ensure-tag, release-notes]
141141
uses: ./.github/workflows/call-e2e.yaml
142142
with:
143143
ref: ${{ needs.ensure-tag.outputs.tag }}
144144
type: "release"
145145

146-
# excute a compatibility test when hami release
146+
# execute a compatibility test when hami release
147147
release-e2e-upgrade:
148-
needs: [release-notes]
148+
needs: [ensure-tag, release-notes]
149149
uses: ./.github/workflows/call-e2e-upgrade.yaml
150150
with:
151151
ref: ${{ needs.ensure-tag.outputs.tag }}

.github/workflows/call-e2e-upgrade.yaml

Lines changed: 66 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,73 @@ on:
66
ref:
77
required: true
88
type: string
9-
permissions: write-all
109

1110
jobs:
12-
upgrade-e2e:
13-
runs-on: ubuntu-latest
11+
e2e-test:
12+
strategy:
13+
matrix:
14+
include:
15+
- device: nvidia
16+
type: tesla-p4
17+
# - device: nvidia
18+
# type: rtx-4090
19+
# - device: huawei
20+
# type: ascend-910b
21+
runs-on: [ "${{ matrix.device }}", "${{ matrix.type }}" ]
22+
environment: ${{ matrix.device }}
23+
env:
24+
HAMI_VERSION: ${{ inputs.ref }}
25+
E2E_TYPE: ${{ inputs.type }}
1426
steps:
15-
- name: e2e upgrade test
16-
# https://github.com/actions/virtual-environments/issues/709
27+
- name: checkout code
28+
uses: actions/checkout@v4
29+
30+
- name: install Go
31+
uses: actions/setup-go@v5
32+
with:
33+
go-version: "1.21"
34+
35+
- name: setup e2e env
36+
run: |
37+
make e2e-env-setup
38+
39+
- name: download hami helm
40+
if: inputs.type == 'pullrequest'
41+
uses: actions/download-artifact@v4
42+
with:
43+
name: chart_package_artifact
44+
path: charts/
45+
46+
- name: download hami image
47+
if: inputs.type == 'pullrequest'
48+
uses: actions/download-artifact@v4
49+
with:
50+
name: hami-image
51+
path: ./image
52+
53+
- name: load e2e image
54+
if: inputs.type == 'pullrequest'
55+
run: |
56+
echo "Loading Docker image from image.tar..."
57+
if [ -z "${VSPHERE_GPU_VM_IP}" ]; then
58+
echo "Error: VSPHERE_GPU_VM_IP is not defined!"
59+
exit 1
60+
fi
61+
scp ./image/image.tar root@$VSPHERE_GPU_VM_IP:/home/
62+
ssh root@$VSPHERE_GPU_VM_IP "nerdctl load -i /home/image.tar"
63+
ssh root@$VSPHERE_GPU_VM_IP "nerdctl image ls | grep hami"
64+
65+
- name: deploy previous release hami helm
66+
run: |
67+
HAMI_VERSION=$(git tag -l --sort=-v:refname | grep -v ${{ env.HAMI_VERSION }} | head -n3 )
68+
E2E_TYPE="upgrade"
69+
echo "Previous release tag is: ${HAMI_VERSION}"
70+
make helm-deploy
71+
72+
- name: deploy release hami helm
73+
run: |
74+
make helm-deploy
75+
76+
- name: e2e test
1777
run: |
18-
echo "Need to add e2e upgrade test"
78+
make e2e-test

.github/workflows/call-e2e.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ jobs:
2727
runs-on: [ "${{ matrix.device }}", "${{ matrix.type }}" ]
2828
environment: ${{ matrix.device }}
2929
env:
30-
E2E_TYPE: ${{ inputs.type }}
3130
HAMI_VERSION: ${{ inputs.ref }}
31+
E2E_TYPE: ${{ inputs.type }}
3232
steps:
3333
- name: checkout code
3434
uses: actions/checkout@v4

.github/workflows/ci.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,3 +249,11 @@ jobs:
249249
with:
250250
ref: ${{ needs.get_info.outputs.version }}
251251
type: "pullrequest"
252+
253+
# execute a full e2e test when hami code merge
254+
e2e_upgrade_test:
255+
uses: ./.github/workflows/call-e2e-upgrade.yaml
256+
needs: [ package_chart, get_info, build ]
257+
if: needs.get_info.outputs.e2e_run == 'true'
258+
with:
259+
ref: ${{ needs.get_info.outputs.version }}

hack/deploy-helm.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ if [ "${E2E_TYPE}" == "pullrequest" ]; then
5353
echo "Error: No .tgz file found in the charts directory."
5454
exit 1
5555
fi
56-
elif [ "${E2E_TYPE}" == "release" ]; then
56+
elif [ "${E2E_TYPE}" == "release" ] || [ "${E2E_TYPE}" == "upgrade" ]; then
5757
HELM_SOURCE="${HELM_NAME}/${HAMI_ALIAS}"
5858
echo "Using remote chart: ${HELM_SOURCE}"
5959
else
@@ -102,4 +102,4 @@ if ! util::check_pods_status "${KUBE_CONF}" ; then
102102
exit 1
103103
fi
104104

105-
echo "HAMI Helm Chart deployed successfully."
105+
echo "HAMI Helm Chart deployed successfully."

0 commit comments

Comments
 (0)