[skip e2e]Fix deployment step in deploy test (#16582)

Signed-off-by: zhuwenxing <wenxing.zhu@zilliz.com>
pull/16571/head
zhuwenxing 2022-04-24 18:11:45 +08:00 committed by GitHub
parent 5c66300408
commit a88e4a90ae
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 64 additions and 4 deletions

View File

@ -84,15 +84,17 @@ jobs:
shell: bash
working-directory: tests/python_client/deploy/${{ matrix.mode }}
run: |
source ../utils.sh
if [ ${{ matrix.task }} == "reinstall" ]; then
wget https://raw.githubusercontent.com/milvus-io/milvus/master/deployments/docker/${{ matrix.mode }}/docker-compose.yml -O docker-compose.yml;
MILVUS_IMAGE="${{ env.NEW_IMAGE_REPO }}:${{ env.NEW_IMAGE_TAG }}" docker-compose up -d;
replace_image_tag ${{ env.NEW_IMAGE_REPO }} ${{ env.NEW_IMAGE_TAG }};
fi
if [ ${{ matrix.task }} == "upgrade" ]; then
wget https://github.com/milvus-io/milvus/releases/download/${{ env.PREVIOUS_RELEASE_VERSION }}/milvus-${{ matrix.mode }}-docker-compose.yml -O docker-compose.yml;
MILVUS_IMAGE="${{ env.OLD_IMAGE_REPO }}:${{ env.OLD_IMAGE_TAG }}" docker-compose up -d;
replace_image_tag ${{ env.OLD_IMAGE_REPO }} ${{ env.OLD_IMAGE_TAG }};
fi
docker-compose up -d
bash ../check_healthy.sh
docker-compose ps -a
sleep 10s
@ -112,12 +114,14 @@ jobs:
shell: bash
working-directory: tests/python_client/deploy/${{ matrix.mode }}
run: |
source ../utils.sh
if [ ${{ matrix.task }} == "reinstall" ]; then
docker-compose restart
fi
if [ ${{ matrix.task }} == "upgrade" ]; then
wget https://raw.githubusercontent.com/milvus-io/milvus/master/deployments/docker/${{ matrix.mode }}/docker-compose.yml -O docker-compose.yml;
MILVUS_IMAGE="${{ env.NEW_IMAGE_REPO }}:${{ env.NEW_IMAGE_TAG }}" docker-compose up -d;
replace_image_tag ${{ env.NEW_IMAGE_REPO }} ${{ env.NEW_IMAGE_TAG }};
docker-compose up -d;
fi
bash ../check_healthy.sh
docker-compose ps -a

View File

@ -11,7 +11,7 @@ function check_healthy {
echo "healthy num $healthy expect num $Expect_health"
while [[ $cnt -ne $Expect || $healthy -ne 1 ]];
do
printf "waiting all containers get running\n"
printf "waiting all containers getting running\n"
sleep 5
let time_cnt+=5
# if time is greater than 300s, the condition still not satisfied, we regard it as a failure

View File

@ -0,0 +1,56 @@
#!/bin/bash
function replace_image_tag {
image_repo=$1
image_tag=$2
image_repo=${image_repo//\//\\\/}
platform='unknown'
unamestr=$(uname)
if [[ "$unamestr" == 'Linux' ]]; then
platform='Linux'
elif [[ "$unamestr" == 'Darwin' ]]; then
platform='Mac'
fi
echo "before replace: "
cat docker-compose.yml | grep milvusdb
if [[ "$platform" == "Mac" ]];
then
# for mac os
echo "replace image tag for mac start"
sed -i "" "s/milvusdb.*/${image_repo}\:${image_tag}/g" docker-compose.yml
echo "replace image tag for mac done"
else
#for linux os
sed -i "s/milvusdb.*/${image_repo}\:${image_tag}/g" docker-compose.yml
fi
echo "after replace: "
cat docker-compose.yml | grep milvusdb
}
#to check containers all running and minio is healthy
function check_healthy {
Expect=$(grep "container_name" docker-compose.yml | wc -l)
Expect_health=$(grep "healthcheck" docker-compose.yml | wc -l)
cnt=$(docker-compose ps | grep -E "running|Running|Up|up" | wc -l)
healthy=$(docker-compose ps | grep "healthy" | wc -l)
time_cnt=0
echo "running num $cnt expect num $Expect"
echo "healthy num $healthy expect num $Expect_health"
while [[ $cnt -ne $Expect || $healthy -ne 1 ]];
do
printf "waiting all containers getting running\n"
sleep 5
let time_cnt+=5
# if time is greater than 300s, the condition still not satisfied, we regard it as a failure
if [ $time_cnt -gt 300 ];
then
printf "timeout,there are some issues with deployment!"
exit 1
fi
cnt=$(docker-compose ps | grep -E "running|Running|Up|up" | wc -l)
healthy=$(docker-compose ps | grep "healthy" | wc -l)
echo "running num $cnt expect num $Expect"
echo "healthy num $healthy expect num $Expect_health"
done
}