Skip to content

Commit 5cd791e

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

File tree

5 files changed

+89
-14
lines changed

5 files changed

+89
-14
lines changed

.github/workflows/auto-release.yaml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -135,18 +135,19 @@ 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 }}
152+
type: "release"
152153

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

Lines changed: 72 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,79 @@ on:
66
ref:
77
required: true
88
type: string
9-
permissions: write-all
9+
type:
10+
description: 'E2E type'
11+
required: true
12+
type: string
13+
default: pullrequest
1014

1115
jobs:
12-
upgrade-e2e:
13-
runs-on: ubuntu-latest
16+
e2e-upgrade-test:
17+
strategy:
18+
matrix:
19+
include:
20+
- device: nvidia
21+
type: tesla-p4
22+
# - device: nvidia
23+
# type: rtx-4090
24+
# - device: huawei
25+
# type: ascend-910b
26+
runs-on: [ "${{ matrix.device }}", "${{ matrix.type }}" ]
27+
environment: ${{ matrix.device }}
28+
env:
29+
HAMI_VERSION: ${{ inputs.ref }}
30+
E2E_TYPE: ${{ inputs.type }}
1431
steps:
15-
- name: e2e upgrade test
16-
# https://github.com/actions/virtual-environments/issues/709
32+
- name: checkout code
33+
uses: actions/checkout@v4
34+
35+
- name: install Go
36+
uses: actions/setup-go@v5
37+
with:
38+
go-version: "1.21"
39+
40+
- name: setup e2e env
41+
run: |
42+
make e2e-env-setup
43+
44+
- name: download hami helm
45+
if: inputs.type == 'pullrequest'
46+
uses: actions/download-artifact@v4
47+
with:
48+
name: chart_package_artifact
49+
path: charts/
50+
51+
- name: download hami image
52+
if: inputs.type == 'pullrequest'
53+
uses: actions/download-artifact@v4
54+
with:
55+
name: hami-image
56+
path: ./image
57+
58+
- name: load e2e image
59+
if: inputs.type == 'pullrequest'
60+
run: |
61+
echo "Loading Docker image from image.tar..."
62+
if [ -z "${VSPHERE_GPU_VM_IP}" ]; then
63+
echo "Error: VSPHERE_GPU_VM_IP is not defined!"
64+
exit 1
65+
fi
66+
scp ./image/image.tar root@$VSPHERE_GPU_VM_IP:/home/
67+
ssh root@$VSPHERE_GPU_VM_IP "nerdctl load -i /home/image.tar"
68+
ssh root@$VSPHERE_GPU_VM_IP "nerdctl image ls | grep hami"
69+
70+
- name: deploy previous release hami helm
71+
run: |
72+
HAMI_VERSION=$(git tag -l --sort=-v:refname | grep -v ${{ env.HAMI_VERSION }} | head -n3 )
73+
E2E_TYPE="upgrade"
74+
echo "Previous release tag is: ${HAMI_VERSION}"
75+
make helm-deploy
76+
77+
- name: deploy release hami helm
78+
run: |
79+
E2E_TYPE="upgrade"
80+
make helm-deploy
81+
82+
- name: e2e test
1783
run: |
18-
echo "Need to add e2e upgrade test"
84+
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: 3 additions & 3 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
@@ -88,7 +88,7 @@ echo "Kubeconfig: ${KUBE_CONF}"
8888
if ! helm --debug upgrade --install --create-namespace --cleanup-on-fail \
8989
"${HAMI_ALIAS}" "${HELM_SOURCE}" -n "${TARGET_NS}" \
9090
--set devicePlugin.passDeviceSpecsEnabled=false \
91-
--version "${HELM_VER}" --wait --timeout 10m --kubeconfig "${KUBE_CONF}"; then
91+
--version "${HELM_VER}" --wait --timeout 15m --kubeconfig "${KUBE_CONF}"; then
9292
echo "Error: Failed to deploy/upgrade Helm Chart. Please check the Helm logs above for more details."
9393
exit 1
9494
fi
@@ -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)