Skip to content

Commit cea8120

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

File tree

5 files changed

+81
-12
lines changed

5 files changed

+81
-12
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 & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,71 @@ on:
99
permissions: write-all
1010

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