2021-09-09 16:02:21 +08:00
name : Deploy Test
2021-09-09 14:32:27 +08:00
on :
workflow_dispatch :
2022-04-01 14:09:29 +08:00
inputs :
old_image_repo :
description : The image repository name to use for the deploy test
required : true
2022-04-20 15:45:40 +08:00
default : 'milvusdb/milvus'
2022-04-01 14:09:29 +08:00
old_image_tag :
description : The old image tag to use for the deploy test
required : true
default : 'latest'
previous_release_version :
description : The previous release version to use for the deploy test
required : true
2022-04-12 14:21:33 +08:00
default : 'v2.0.2'
2022-04-01 14:09:29 +08:00
new_image_repo :
description : The image repository name to use for the deploy test
required : true
default : 'milvusdb/milvus-dev'
new_image_tag :
description : The new image tag to use for the deploy test
required : true
default : 'master-latest'
2021-09-09 14:32:27 +08:00
schedule :
2021-11-11 19:42:53 +08:00
# * is a special character in YAML so you have to quote this string
# ┌───────────── minute (0 - 59)
# │ ┌───────────── hour (0 - 23)
# │ │ ┌───────────── day of the month (1 - 31)
# │ │ │ ┌───────────── month (1 - 12 or JAN-DEC)
# │ │ │ │ ┌───────────── day of the week (0 - 6 or SUN-SAT)
# │ │ │ │ │
# │ │ │ │ │
# │ │ │ │ │
2021-09-09 14:32:27 +08:00
- cron : "30 20 * * *"
jobs :
test-docker-compose :
runs-on : ubuntu-latest
strategy :
fail-fast : false
matrix :
2022-04-01 14:09:29 +08:00
mode : [ standalone, cluster]
task : [ reinstall, upgrade]
2021-09-09 14:32:27 +08:00
steps :
2022-04-01 14:09:29 +08:00
- name : Set env param
env :
DEFAULT_OLD_IMAGE_REPO : "milvusdb/milvus"
DEFAULT_OLD_IMAGE_TAG : "latest"
2022-04-12 14:21:33 +08:00
DEFAULT_PREVIOUS_RELEASE_VERSION : "v2.0.2"
2022-04-01 14:09:29 +08:00
DEFAULT_NEW_IMAGE_REPO : "milvusdb/milvus-dev"
DEFAULT_NEW_IMAGE_TAG : "master-latest"
run : |
echo "OLD_IMAGE_REPO=${{ github.event.inputs.old_image_repo || env.DEFAULT_OLD_IMAGE_REPO }}" >> $GITHUB_ENV
echo "OLD_IMAGE_TAG=${{ github.event.inputs.old_image_tag || env.DEFAULT_OLD_IMAGE_TAG }}" >> $GITHUB_ENV
echo "PREVIOUS_RELEASE_VERSION=${{ github.event.inputs.previous_release_version || env.DEFAULT_PREVIOUS_RELEASE_VERSION }}" >> $GITHUB_ENV
echo "NEW_IMAGE_REPO=${{ github.event.inputs.new_image_repo || env.DEFAULT_NEW_IMAGE_REPO }}" >> $GITHUB_ENV
echo "NEW_IMAGE_TAG=${{ github.event.inputs.new_image_tag || env.DEFAULT_NEW_IMAGE_TAG }}" >> $GITHUB_ENV
2022-04-20 15:45:40 +08:00
2021-09-09 14:32:27 +08:00
- uses : actions/checkout@v2
- name : Set up Python
uses : actions/setup-python@v2
with :
python-version : 3.8
2022-04-20 15:45:40 +08:00
2021-12-06 18:18:41 +08:00
- name : Install dependency
shell : bash
2022-04-01 14:09:29 +08:00
working-directory : tests/python_client
2021-12-06 18:18:41 +08:00
run : |
2022-04-01 14:09:29 +08:00
pip install -r requirements.txt --trusted-host https://test.pypi.org
2022-04-20 15:45:40 +08:00
2022-04-01 14:09:29 +08:00
- name : First Milvus deployment
2022-04-20 15:45:40 +08:00
timeout-minutes : 15
2021-09-09 14:32:27 +08:00
shell : bash
2022-04-01 14:09:29 +08:00
working-directory : tests/python_client/deploy/${{ matrix.mode }}
2021-09-09 14:32:27 +08:00
run : |
2022-04-24 18:11:45 +08:00
source ../utils.sh
2022-04-20 15:45:40 +08:00
if [ ${{ matrix.task }} == "reinstall" ]; then
2022-04-01 14:09:29 +08:00
wget https://raw.githubusercontent.com/milvus-io/milvus/master/deployments/docker/${{ matrix.mode }}/docker-compose.yml -O docker-compose.yml;
2022-04-24 18:11:45 +08:00
replace_image_tag ${{ env.NEW_IMAGE_REPO }} ${{ env.NEW_IMAGE_TAG }};
2022-04-20 15:45:40 +08:00
2022-04-01 14:09:29 +08:00
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;
2022-04-24 18:11:45 +08:00
replace_image_tag ${{ env.OLD_IMAGE_REPO }} ${{ env.OLD_IMAGE_TAG }};
2022-04-01 14:09:29 +08:00
fi
2022-04-24 18:11:45 +08:00
docker-compose up -d
2022-04-01 14:09:29 +08:00
bash ../check_healthy.sh
docker-compose ps -a
sleep 10s
- name : Run first test
2022-04-20 15:45:40 +08:00
timeout-minutes : 15
2022-04-01 14:09:29 +08:00
shell : bash
working-directory : tests/python_client/deploy/scripts
run : |
2022-04-20 15:45:40 +08:00
if [ ${{ matrix.task }} == "reinstall" ]; then
2022-04-01 14:09:29 +08:00
python3 action_before_reinstall.py
fi
if [ ${{ matrix.task }} == "upgrade" ]; then
python3 action_before_upgrade.py
fi
2022-05-26 10:38:01 +08:00
- name : Milvus Idle Time
timeout-minutes : 5
shell : bash
working-directory : tests/python_client/deploy
run : |
sleep 60s
2022-05-25 18:41:59 +08:00
- name : Export logs
if : ${{ always() }}
shell : bash
working-directory : tests/python_client/deploy/${{ matrix.mode }}
run : |
docker-compose ps -a || true
mkdir -p logs/first_deploy
bash ../../../scripts/export_log_docker.sh ./logs/first_deploy || echo "export logs failed"
2022-04-01 14:09:29 +08:00
- name : Second Milvus deployment
2022-04-20 15:45:40 +08:00
timeout-minutes : 15
2022-04-01 14:09:29 +08:00
shell : bash
working-directory : tests/python_client/deploy/${{ matrix.mode }}
run : |
2022-04-24 18:11:45 +08:00
source ../utils.sh
2022-04-01 14:09:29 +08:00
if [ ${{ matrix.task }} == "reinstall" ]; then
2022-04-20 15:45:40 +08:00
docker-compose restart
2022-04-01 14:09:29 +08:00
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;
2022-04-24 18:11:45 +08:00
replace_image_tag ${{ env.NEW_IMAGE_REPO }} ${{ env.NEW_IMAGE_TAG }};
docker-compose up -d;
2022-04-01 14:09:29 +08:00
fi
bash ../check_healthy.sh
docker-compose ps -a
2022-04-20 15:45:40 +08:00
2022-04-01 14:09:29 +08:00
echo "sleep 120s for the second deployment to be ready"
sleep 120s
- name : Run second test
timeout-minutes : 60
shell : bash
working-directory : tests/python_client/deploy/scripts
run : |
2022-04-20 15:45:40 +08:00
if [ ${{ matrix.task }} == "reinstall" ]; then
2022-04-01 14:09:29 +08:00
python3 action_after_reinstall.py
fi
if [ ${{ matrix.task }} == "upgrade" ]; then
python3 action_after_upgrade.py
fi
- name : Export logs
if : ${{ always() }}
shell : bash
working-directory : tests/python_client/deploy/${{ matrix.mode }}
run : |
docker-compose ps -a || true
2022-05-25 18:41:59 +08:00
mkdir -p logs/second_deploy
bash ../../../scripts/export_log_docker.sh ./logs/second_deploy || echo "export logs failed"
2021-09-09 14:32:27 +08:00
- name : 'Send mail'
if : ${{ failure() }}
uses : dawidd6/action-send-mail@v3
with :
server_address : ${{ secrets.EMAIL_SERVICE_NAME }}
server_port : 465
username : ${{ secrets.TEST_EMAIL_USERNAME }}
password : ${{ secrets.TEST_EMAIL_PASSWORD }}
subject : Deploy Test
2021-09-13 21:20:28 +08:00
body : "test ${{ matrix.mode }} ${{ matrix.task }} failed \n You can view it at https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}"
2021-09-09 14:32:27 +08:00
to : ${{ secrets.QA_EMAIL_ADDRESS }}
from : GitHub Actions
- name : Upload logs
2022-04-01 14:09:29 +08:00
if : ${{ failure() }}
2021-09-09 14:32:27 +08:00
uses : actions/upload-artifact@v2
with :
2022-01-04 16:27:33 +08:00
name : docker-compose-logs-${{ matrix.mode }}-${{ matrix.task }}
2021-09-09 14:32:27 +08:00
path : tests/python_client/deploy/${{ matrix.mode }}/logs
2021-10-13 06:50:32 +08:00
test-helm-install :
runs-on : ubuntu-latest
strategy :
fail-fast : false
matrix :
2022-04-20 15:45:40 +08:00
mq_type : [ pulsar, kafka]
2021-12-20 20:16:53 +08:00
mode : [ standalone,cluster]
2022-04-20 15:45:40 +08:00
task : [ reinstall,upgrade]
exclude :
- mq_type : kafka
mode : standalone
- mq_type : kafka
task : upgrade
2021-10-13 06:50:32 +08:00
steps :
2022-04-20 15:45:40 +08:00
2021-10-13 06:50:32 +08:00
- name : Creating kind cluster
uses : helm/kind-action@v1.2.0
2022-04-20 15:45:40 +08:00
2021-10-13 06:50:32 +08:00
- name : Print cluster information
run : |
kubectl config view
kubectl cluster-info
kubectl get nodes
kubectl get pods -n kube-system
helm version
kubectl version
- uses : actions/checkout@v2
- name : Set up Python
uses : actions/setup-python@v2
with :
python-version : 3.8
- name : Install dependency
shell : bash
2022-05-07 14:47:51 +08:00
working-directory : tests/python_client
2021-10-13 06:50:32 +08:00
run : |
2022-05-07 14:47:51 +08:00
pip install -r requirements.txt --trusted-host https://test.pypi.org
2022-04-20 15:45:40 +08:00
- name : Modify chart value config
timeout-minutes : 1
shell : bash
working-directory : tests/python_client/deploy
run : |
yq -i ".kafka.enabled = false" cluster-values.yaml
yq -i ".pulsar.enabled = false" cluster-values.yaml
yq -i ".${{ matrix.mq_type }}.enabled = true" cluster-values.yaml
2021-10-13 06:50:32 +08:00
- name : First Milvus Deployment
2022-04-20 15:45:40 +08:00
timeout-minutes : 15
2021-10-13 06:50:32 +08:00
shell : bash
2022-04-20 15:45:40 +08:00
working-directory : tests/python_client/deploy
2021-10-13 06:50:32 +08:00
run : |
helm repo add milvus https://milvus-io.github.io/milvus-helm
helm repo update
# if the task is reinstall, install milvus with latest image in repo milvusdb/milvus-dev
2021-12-20 20:16:53 +08:00
# for cluster mode
if [ ${{ matrix.task }} == "reinstall" ] && [ ${{ matrix.mode }} == "cluster" ]; then
echo "task: ${{ matrix.task }} mode: ${{ matrix.mode }}";
helm install --wait --timeout 720s deploy-testing milvus/milvus -f cluster-values.yaml;
fi
# for standalone mode
if [ ${{ matrix.task }} == "reinstall" ] && [ ${{ matrix.mode }} == "standalone" ]; then
echo "task: ${{ matrix.task }} mode: ${{ matrix.mode }}";
helm install --wait --timeout 720s deploy-testing milvus/milvus -f standalone-values.yaml;
fi
2021-10-13 06:50:32 +08:00
# if the task is upgrade, install milvus with latest rc image in repo milvusdb/milvus
2021-12-20 20:16:53 +08:00
if [ ${{ matrix.task }} == "upgrade" ] && [ ${{ matrix.mode }} == "cluster" ]; then
echo "task: ${{ matrix.task }} mode: ${{ matrix.mode }}";
2022-04-12 14:21:33 +08:00
helm install --wait --timeout 720s deploy-testing milvus/milvus --set image.all.repository=milvusdb/milvus --set image.all.tag=latest -f cluster-values.yaml;
2021-12-20 20:16:53 +08:00
fi
if [ ${{ matrix.task }} == "upgrade" ] && [ ${{ matrix.mode }} == "standalone" ]; then
echo "task: ${{ matrix.task }} mode: ${{ matrix.mode }}";
2022-04-12 14:21:33 +08:00
helm install --wait --timeout 720s deploy-testing milvus/milvus --set image.all.repository=milvusdb/milvus --set image.all.tag=latest -f standalone-values.yaml;
2021-12-20 20:16:53 +08:00
fi
2021-10-13 06:50:32 +08:00
kubectl get pods
sleep 20s
kubectl get pods
kubectl port-forward service/deploy-testing-milvus 19530 >/dev/null 2>&1 &
sleep 20s
# check whether port-forward success
nc -vz 127.0.0.1 19530
2022-04-20 15:45:40 +08:00
- name : Run first test
timeout-minutes : 15
shell : bash
working-directory : tests/python_client/deploy
run : |
2021-10-13 06:50:32 +08:00
# first test
2021-12-17 18:49:30 +08:00
if [ ${{ matrix.task }} == "reinstall" ]; then python scripts/action_before_reinstall.py; fi
2021-10-13 06:50:32 +08:00
if [ ${{ matrix.task }} == "upgrade" ]; then python scripts/action_before_upgrade.py; fi
2022-05-26 10:38:01 +08:00
- name : Milvus Idle Time
timeout-minutes : 5
shell : bash
working-directory : tests/python_client/deploy
run : |
sleep 60s
2022-05-25 18:41:59 +08:00
- name : Export logs
if : ${{ always() }}
shell : bash
working-directory : tests/python_client/deploy
run : |
kubectl get pod
# export k8s log for milvus
bash ../../scripts/export_log_k8s.sh default deploy-testing k8s_logs/first_deploy
2022-04-20 15:45:40 +08:00
- name : Restart Milvus
timeout-minutes : 15
shell : bash
working-directory : tests/python_client/deploy
run : |
2021-10-13 06:50:32 +08:00
# uninstall milvus
2022-04-20 15:45:40 +08:00
if [ ${{ matrix.mode }} == "standalone" ];
2021-12-27 09:22:20 +08:00
then
kubectl delete pod -l app.kubernetes.io/instance=deploy-testing --grace-period=0 --force;
kubectl delete pod -l release=deploy-testing --grace-period=0 --force;
else
helm uninstall deploy-testing
fi
2022-04-20 15:45:40 +08:00
2021-10-13 06:50:32 +08:00
- name : Seconde Milvus Deployment
2022-04-20 15:45:40 +08:00
timeout-minutes : 15
2021-10-13 06:50:32 +08:00
shell : bash
2022-04-20 15:45:40 +08:00
working-directory : tests/python_client/deploy
2021-10-13 06:50:32 +08:00
run : |
2021-12-20 20:16:53 +08:00
if [ ${{ matrix.mode }} == "cluster" ]; then helm install --wait --timeout 720s deploy-testing milvus/milvus -f cluster-values.yaml; fi
2021-12-27 09:22:20 +08:00
if [ ${{ matrix.mode }} == "standalone" ]; then helm upgrade --wait --timeout 720s deploy-testing milvus/milvus -f standalone-values.yaml; fi
2021-10-13 06:50:32 +08:00
kubectl get pods
sleep 20s
kubectl get pods
ps aux|grep forward|grep -v grep|awk '{print $2}'|xargs kill -9
kubectl port-forward service/deploy-testing-milvus 19530 >/dev/null 2>&1 &
2022-01-14 14:35:34 +08:00
sleep 120s
2021-10-13 06:50:32 +08:00
# check whether port-forward success
nc -vz 127.0.0.1 19530
2022-04-20 15:45:40 +08:00
- name : Run second test
timeout-minutes : 15
shell : bash
working-directory : tests/python_client/deploy
run : |
2021-10-13 06:50:32 +08:00
# second test
2021-12-17 18:49:30 +08:00
if [ ${{ matrix.task }} == "reinstall" ]; then python scripts/action_after_reinstall.py; fi
2021-10-13 06:50:32 +08:00
if [ ${{ matrix.task }} == "upgrade" ]; then python scripts/action_after_upgrade.py; fi
2022-04-20 15:45:40 +08:00
2021-10-13 06:50:32 +08:00
- name : Export logs
if : ${{ always() }}
shell : bash
working-directory : tests/python_client/deploy
run : |
kubectl get pod
# export k8s log for milvus
2022-05-25 18:41:59 +08:00
bash ../../scripts/export_log_k8s.sh default deploy-testing k8s_logs/second_deploy
2022-04-20 15:45:40 +08:00
2021-10-13 06:50:32 +08:00
- name : Upload logs
2022-05-25 18:41:59 +08:00
if : ${{ failure() }}
2021-10-13 06:50:32 +08:00
uses : actions/upload-artifact@v2
with :
2022-01-04 16:27:33 +08:00
name : helm-log-${{ matrix.mode }}-${{ matrix.task }}
2022-04-20 15:45:40 +08:00
path : tests/python_client/deploy/k8s_logs