Skip to content

Commit 0cdb3bb

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

File tree

5 files changed

+88
-15
lines changed

5 files changed

+88
-15
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: 70 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,77 @@ on:
66
ref:
77
required: true
88
type: string
9-
permissions: write-all
9+
type:
10+
description: 'E2E type'
11+
type: string
12+
default: pullrequest
1013

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

.github/workflows/call-e2e.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ on:
99
type: string
1010
type:
1111
description: 'E2E type'
12-
required: true
1312
type: string
1413
default: pullrequest
1514

@@ -27,8 +26,8 @@ jobs:
2726
runs-on: [ "${{ matrix.device }}", "${{ matrix.type }}" ]
2827
environment: ${{ matrix.device }}
2928
env:
30-
E2E_TYPE: ${{ inputs.type }}
3129
HAMI_VERSION: ${{ inputs.ref }}
30+
E2E_TYPE: ${{ inputs.type }}
3231
steps:
3332
- name: checkout code
3433
uses: actions/checkout@v4

.github/workflows/ci.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,3 +249,12 @@ 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 }}
260+
type: 'pullrequest'

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)