You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by ju...@apache.org on 2020/10/21 09:56:14 UTC

[apisix-dashboard] branch master updated: fix: API CICD error (#575)

This is an automated email from the ASF dual-hosted git repository.

juzhiyuan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apisix-dashboard.git


The following commit(s) were added to refs/heads/master by this push:
     new eebaec0  fix: API CICD error (#575)
eebaec0 is described below

commit eebaec01b0e90466ba23c215a5829fba21dc53a7
Author: nic-chen <33...@users.noreply.github.com>
AuthorDate: Wed Oct 21 17:56:02 2020 +0800

    fix: API CICD error (#575)
    
    * fix: API CICD -- testing
    
    * test
    
    * test
    
    * test
    
    * fix mv force
    
    * fix use `-u` to move
    
    * fix remove first
    
    * test
    
    * test
    
    * fix: only build when merging into master
    
    * fix doc style
---
 .github/workflows/api_ci.yml   | 12 +++++++-----
 .github/workflows/api_cicd.yml | 15 ++++++++++-----
 api/Dockerfile                 | 11 ++++++-----
 3 files changed, 23 insertions(+), 15 deletions(-)

diff --git a/.github/workflows/api_ci.yml b/.github/workflows/api_ci.yml
index 787525c..a5b42f4 100644
--- a/.github/workflows/api_ci.yml
+++ b/.github/workflows/api_ci.yml
@@ -11,9 +11,8 @@ on:
 jobs:
 
   run-test:
-
     runs-on: ubuntu-latest
-
+    
     services:
       etcd:
         image: bitnami/etcd:3.4.13
@@ -24,18 +23,19 @@ jobs:
           ALLOW_NONE_AUTHENTICATION: yes
 
     steps:
-
     - uses: actions/checkout@v2
 
     - name: run Makefile
       run: |
         make license-check
+
     - name: get lua lib
       run: |
         wget https://github.com/api7/dag-to-lua/archive/v1.1.tar.gz
         sudo mkdir -p /go/manager-api/dag-to-lua/
         tar -zxvf v1.1.tar.gz
         sudo mv ./dag-to-lua-1.1/lib/* /go/manager-api/dag-to-lua/
+
     - name: install runtime
       run: |
         sudo apt-get update
@@ -44,17 +44,19 @@ jobs:
         sudo apt update
         export GO111MOUDULE=on
         sudo apt install golang-1.14-go
+
     - name: generate json schema
       working-directory: ./api
       run: |
         wget https://github.com/apache/apisix/archive/master.zip
-        mkdir ./build-tools/apisix/
+        mkdir -p ./build-tools/apisix/
         unzip master.zip
         sudo mv ./apisix-master/apisix/* ./build-tools/apisix/
         rm -rf ./apisix-master
         cd ./build-tools/ && lua schema-sync.lua > ../conf/schema.json
+
     - name: run test
       working-directory: ./api
       run: |
         export APIX_ETCD_ENDPOINTS=127.0.0.1:2379
-        go test ./...
\ No newline at end of file
+        go test ./...
diff --git a/.github/workflows/api_cicd.yml b/.github/workflows/api_cicd.yml
index a4c31ba..d45d853 100644
--- a/.github/workflows/api_cicd.yml
+++ b/.github/workflows/api_cicd.yml
@@ -2,7 +2,7 @@ name: API CI && CD
 
 on:
   push:
-    branches: 
+    branches:
       - master
 
 jobs:
@@ -21,15 +21,17 @@ jobs:
     steps:
     - uses: actions/checkout@v2
 
-    - name: run Makefile
+    - name: license check
       run: |
         make license-check
+
     - name: get lua lib
       run: |
         wget https://github.com/api7/dag-to-lua/archive/v1.1.tar.gz
         sudo mkdir -p /go/manager-api/dag-to-lua/
         tar -zxvf v1.1.tar.gz
         sudo mv ./dag-to-lua-1.1/lib/* /go/manager-api/dag-to-lua/
+
     - name: install runtime
       run: |
         sudo apt-get update
@@ -38,28 +40,31 @@ jobs:
         sudo apt update
         export GO111MOUDULE=on
         sudo apt install golang-1.14-go
+
     - name: generate json schema
       working-directory: ./api
       run: |
         wget https://github.com/apache/apisix/archive/master.zip
-        mkdir ./build-tools/apisix/
+        mkdir -p ./build-tools/apisix/
         unzip master.zip
         sudo mv ./apisix-master/apisix/* ./build-tools/apisix/
         rm -rf ./apisix-master
         cd ./build-tools/ && lua schema-sync.lua > ../conf/schema.json
+
     - name: run test
       working-directory: ./api
       run: |
         export APIX_ETCD_ENDPOINTS=127.0.0.1:2379
         go test ./...
+
     - uses: Azure/docker-login@v1
       with:
         login-server: apisixacr.azurecr.cn
         username: ${{ secrets.REGISTRY_USERNAME }}
         password: ${{ secrets.REGISTRY_PASSWORD }}
 
-    - name: build and push docker image   
+    - name: build and push docker image
+      working-directory: ./api
       run: |
-        cd ./api
         docker build . -t apisixacr.azurecr.cn/managerapi:${{ github.sha }}
         docker push apisixacr.azurecr.cn/managerapi:${{ github.sha }}
\ No newline at end of file
diff --git a/api/Dockerfile b/api/Dockerfile
index d8e7c6d..5b5d627 100644
--- a/api/Dockerfile
+++ b/api/Dockerfile
@@ -19,8 +19,8 @@ FROM golang:1.13.8 AS build-env
 
 WORKDIR /go/src/github.com/apisix/manager-api
 COPY . .
-RUN mkdir /go/manager-api \
-    && mkdir /go/manager-api/build-tools \
+RUN mkdir -p /go/manager-api \
+    && mkdir -p /go/manager-api/build-tools \
     && go env -w GOPROXY=https://goproxy.io,direct \
     && export GOPROXY=https://goproxy.io \
     && go build -o /go/manager-api/manager-api \
@@ -34,13 +34,14 @@ RUN mkdir /go/manager-api \
 
 RUN wget https://github.com/api7/dag-to-lua/archive/v1.1.tar.gz \
     && tar -zxvf v1.1.tar.gz \
-    && mkdir /go/manager-api/dag-to-lua \
-    && mv ./dag-to-lua-1.1/lib/* /go/manager-api/dag-to-lua/
+    && mkdir -p /go/manager-api/dag-to-lua \
+    && mv -u ./dag-to-lua-1.1/lib/* /go/manager-api/dag-to-lua/
 
 RUN  wget https://github.com/apache/apisix/archive/master.zip \
-     && mkdir /go/manager-api/build-tools/apisix \
      && apt-get update && apt-get install zip -y \
      && unzip master.zip \
+     && rm -rf /go/manager-api/build-tools/apisix/ \
+     && mkdir -p /go/manager-api/build-tools/apisix \
      && mv ./apisix-master/apisix/* /go/manager-api/build-tools/apisix/
 
 FROM alpine:3.11