milvus/.github/workflows/deploy-test.yaml
zhuwenxing a22964423f
[skip ci]Keep first deployment running longer time on weekend (#10732)
Signed-off-by: zhuwenxing <wenxing.zhu@zilliz.com>
2021-10-27 15:00:35 +08:00

163 lines
5.3 KiB
YAML

name: Deploy Test
on:
workflow_dispatch:
schedule:
- 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
- name: Run deploy test
timeout-minutes: 15
shell: bash
working-directory: tests/python_client/deploy
run: |
pip install -r requirements.txt
pip install --upgrade protobuf
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
body: "test ${{ matrix.mode }} ${{ matrix.task }} failed \n You can view it at https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}"
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
test-helm-install:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
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
timeout-minutes: 60
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
if [ ${{ matrix.task }} == "reinstall" ]; then helm install --wait --timeout 300s deploy-testing milvus/milvus -f cluster-values.yaml; fi
# if the task is upgrade, install milvus with latest rc image in repo milvusdb/milvus
if [ ${{ matrix.task }} == "upgrade" ]; then helm install --wait --timeout 300s deploy-testing milvus/milvus --set image.all.repository=milvusdb/milvus --set image.all.tag=latest -f cluster-values.yaml; fi
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
if [ ${{ matrix.task }} == "reinstall" ]; then python scripts/action_reinstall.py; fi
if [ ${{ matrix.task }} == "upgrade" ]; then python scripts/action_before_upgrade.py; fi
# uninstall milvus
if [[ $(date +%w) -eq 0 || $(data +%w) -eq 6 ]]; then sleep 1800s; fi
helm uninstall deploy-testing
- name: Seconde Milvus Deployment
timeout-minutes: 15
shell: bash
working-directory: tests/python_client/deploy
run: |
#
helm install --wait --timeout 300s deploy-testing milvus/milvus -f cluster-values.yaml
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
if [ ${{ matrix.task }} == "reinstall" ]; then python scripts/action_reinstall.py; fi
if [ ${{ matrix.task }} == "upgrade" ]; then python scripts/action_after_upgrade.py; fi
- 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:
name: helm-deploy-logs-${{ matrix.task }}
path: tests/python_client/deploy/k8s_logs