Browse Source

test check action

nameczz 3 years ago
parent
commit
e6c2f419a3
3 changed files with 60 additions and 5 deletions
  1. 50 3
      .github/workflows/check.yml
  2. 9 1
      .github/workflows/dev.yml
  3. 1 1
      checkInsight.js

+ 50 - 3
.github/workflows/check.yml

@@ -5,8 +5,9 @@ on:
     branches: [feat/check-insight]
 
 jobs:
-  dev:
+  build:
     runs-on: ubuntu-latest
+    if: github.event.pull_request.merged == true
     steps:
       - uses: actions/checkout@v2
       - name: Setup Node.js
@@ -14,9 +15,55 @@ jobs:
         with:
           node-version: 12
 
-      - name: Check insight status
+      - name: Login to DockerHub
+        uses: docker/login-action@v1
+        with:
+          username: ${{ secrets.DOCKER_USERNAME }}
+          password: ${{ secrets.DOCKER_PWD }}
+
+      - name: Docker Build
+        run: docker build -t milvusdb/milvus-insight:dev --build-arg VERSION=dev .
+
+      - name: Docker Push Dev
+        run: docker push milvusdb/milvus-insight:dev
+
+  kbs:
+    runs-on: ubuntu-latest
+    need: build
+    steps:
+      - name: Install OpenVPN and kubectl
+        run: |
+          sudo apt-get update
+          sudo apt-get install openvpn -y
+          sudo apt-get install -y apt-transport-https ca-certificates curl
+          sudo curl -fsSLo /usr/share/keyrings/kubernetes-archive-keyring.gpg https://packages.cloud.google.com/apt/doc/apt-key.gpg
+          echo "deb [signed-by=/usr/share/keyrings/kubernetes-archive-keyring.gpg] https://apt.kubernetes.io/ kubernetes-xenial main" | sudo tee /etc/apt/sources.list.d/kubernetes.list
+          sudo apt-get update
+          sudo apt-get install kubectl -y
+
+      - name: Connect VPN
+        uses: golfzaptw/action-connect-ovpn@master
+        id: connect_vpn
+        with:
+          FILE_OVPN: '.github/workflows/client.ovpn'
         env:
-          INSIGHT_URL: ${{ secrets.INSIGHT_URL }}
+          CA_CRT: ${{ secrets.VPN_CA}}
+          USER_CRT: ${{ secrets.VPN_CRT }}
+          USER_KEY: ${{ secrets.VPN_KEY }}
+
+      - name: Deploy to cluster
+        run: |
+          echo ${{ secrets.kubeconfig }} > config64
+          base64 -d config64 > kubeconfig
+          kubectl set image deployment/milvus-insight milvus-insight=milvusdb/milvus-insight:dev:${{ github.sha }} -n ued --kubeconfig=kubeconfig
+          kubectl -n ued rollout status deploy milvus-insight
+          sleep 60
+
+  check:
+    runs-on: ubuntu-latest
+    need: [build, kbs]
+    steps:
+      - name: Check insight status
         run: |
           yarn add axios
           node checkInsight.js

+ 9 - 1
.github/workflows/dev.yml

@@ -6,7 +6,7 @@ on:
     types: [closed]
 
 jobs:
-  dev:
+  build:
     runs-on: ubuntu-latest
     if: github.event.pull_request.merged == true
     steps:
@@ -28,6 +28,10 @@ jobs:
       - name: Docker Push Dev
         run: docker push milvusdb/milvus-insight:dev
 
+  kbs:
+    runs-on: ubuntu-latest
+    need: build
+    steps:
       - name: Install OpenVPN and kubectl
         run: |
           sudo apt-get update
@@ -56,6 +60,10 @@ jobs:
           kubectl -n ued rollout status deploy milvus-insight
           sleep 60
 
+  check:
+    runs-on: ubuntu-latest
+    need: [build, kbs]
+    steps:
       - name: Check insight status
         run: |
           yarn add axios

+ 1 - 1
checkInsight.js

@@ -4,7 +4,7 @@ const BASE_URL = process.env.INSIGHT_URL;
 console.log('---- check start ----- ', BASE_URL);
 
 axios
-  .get(`${BASE_URL}/api/v1/healthy`)
+  .get(`${BASE_URL}/api/v1/collections`)
   .then(res => {
     console.log(res.data);
     if (res.data.statusCode === 200) {