2021-09-09 16:02:21 +08:00
name : Deploy Test
2021-09-09 14:32:27 +08:00
on :
workflow_dispatch :
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 :
mode : [ standalone,cluster]
task : [ reinstall,upgrade]
steps :
- uses : actions/checkout@v2
- name : Set up Python
uses : actions/setup-python@v2
with :
python-version : 3.8
2021-12-06 18:18:41 +08:00
- name : Install dependency
shell : bash
working-directory : tests/python_client/deploy
run : |
pip install -r requirements.txt
pip install --upgrade protobuf
2021-09-09 14:32:27 +08:00
- name : Run deploy test
2021-12-13 21:21:54 +08:00
timeout-minutes : 60
2021-09-09 14:32:27 +08:00
shell : bash
working-directory : tests/python_client/deploy
run : |
mkdir -p ${{ matrix.mode }}/logs
echo "test -m ${{ matrix.mode }} -t ${{ matrix.task }}" > ./${{ matrix.mode }}/logs/test_info.log
python scripts/get_tag.py >> ./${{ matrix.mode }}/logs/test_info.log
bash test.sh -m ${{ matrix.mode }} -t ${{ matrix.task }} -p ""
- 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
if : ${{ always() }}
uses : actions/upload-artifact@v2
with :
name : logs-${{ matrix.mode }}-${{ matrix.task }}
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 :
2021-12-20 20:16:53 +08:00
mode : [ standalone,cluster]
2021-10-13 06:50:32 +08:00
task : [ reinstall,upgrade]
steps :
- name : Creating kind cluster
uses : helm/kind-action@v1.2.0
- 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
working-directory : tests/python_client/deploy
run : |
pip install -r requirements.txt
pip install --upgrade protobuf
- name : First Milvus Deployment
2021-10-27 15:00:35 +08:00
timeout-minutes : 60
2021-10-13 06:50:32 +08:00
shell : bash
working-directory : tests/python_client/deploy
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 }}";
helm install --wait --timeout 720s deploy-testing milvus/milvus --set image.all.repository=milvusdb/milvus -f cluster-values.yaml;
fi
if [ ${{ matrix.task }} == "upgrade" ] && [ ${{ matrix.mode }} == "standalone" ]; then
echo "task: ${{ matrix.task }} mode: ${{ matrix.mode }}";
helm install --wait --timeout 720s deploy-testing milvus/milvus --set image.all.repository=milvusdb/milvus -f standalone-values.yaml;
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
# 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
# uninstall milvus
2021-10-27 15:00:35 +08:00
if [[ $(date +%w) -eq 0 || $(data +%w) -eq 6 ]]; then sleep 1800s; fi
2021-10-13 06:50:32 +08:00
helm uninstall deploy-testing
- name : Seconde Milvus Deployment
2021-12-13 21:21:54 +08:00
timeout-minutes : 60
2021-10-13 06:50:32 +08:00
shell : bash
working-directory : tests/python_client/deploy
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
if [ ${{ matrix.mode }} == "standalone" ]; then helm install --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 &
sleep 20s
# check whether port-forward success
nc -vz 127.0.0.1 19530
# 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
2021-09-09 14:32:27 +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
bash ../../scripts/export_log_k8s.sh default deploy-testing
- name : Upload logs
if : ${{ always() }}
uses : actions/upload-artifact@v2
with :
2021-10-18 10:26:41 +08:00
name : helm-deploy-logs-${{ matrix.task }}
2021-10-13 06:50:32 +08:00
path : tests/python_client/deploy/k8s_logs
2021-09-09 14:32:27 +08:00