mirror of
https://gitee.com/milvus-io/milvus.git
synced 2024-12-04 04:49:08 +08:00
f95d051eb2
Signed-off-by: zhuwenxing <wenxing.zhu@zilliz.com>
199 lines
7.4 KiB
YAML
199 lines
7.4 KiB
YAML
name: Deploy Test
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
schedule:
|
|
# * 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)
|
|
# │ │ │ │ │
|
|
# │ │ │ │ │
|
|
# │ │ │ │ │
|
|
- 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: Install dependency
|
|
shell: bash
|
|
working-directory: tests/python_client/deploy
|
|
run: |
|
|
pip install -r requirements.txt
|
|
|
|
- name: Run deploy test
|
|
timeout-minutes: 60
|
|
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
|
|
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: docker-compose-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:
|
|
mode: [standalone,cluster]
|
|
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
|
|
|
|
- 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
|
|
# 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
|
|
|
|
# if the task is upgrade, install milvus with latest rc image in repo milvusdb/milvus
|
|
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.tag=master-20211225-6177d46 -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.tag=master-20211225-6177d46 -f standalone-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_before_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
|
|
if [ ${{ matrix.mode }} == "standalone" ];
|
|
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
|
|
- name: Seconde Milvus Deployment
|
|
timeout-minutes: 60
|
|
shell: bash
|
|
working-directory: tests/python_client/deploy
|
|
run: |
|
|
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 upgrade --wait --timeout 720s deploy-testing milvus/milvus -f standalone-values.yaml; fi
|
|
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_after_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-log-${{ matrix.mode }}-${{ matrix.task }}
|
|
path: tests/python_client/deploy/k8s_logs
|
|
|
|
|
|
|
|
|
|
|
|
|