Browse Source

Update workflows (#1034)

* chore(CI): update build docker

Signed-off-by: zhanghongtong <rory-z@outlook.com>

* chore(CI): update build docker for kubernetes tools

Signed-off-by: zhanghongtong <rory-z@outlook.com>

* chore(CI): format yaml file

Signed-off-by: zhanghongtong <rory-z@outlook.com>
Rory Z 3 years ago
parent
commit
5fe6982ecd

+ 307 - 302
.github/workflows/build_packages.yaml

@@ -14,321 +14,326 @@ on:
       - published
 
 jobs:
-    build:
-        runs-on: ubuntu-latest
+  build:
+    runs-on: ubuntu-latest
 
-        strategy:
-            matrix:
-                golang:
-                - 1.15.11
-                arch:
-                - linux/amd64
-                - linux/arm64
-                os:
-                - debian
-                - centos
+    strategy:
+      matrix:
+        golang:
+          - 1.15.11
+        arch:
+          - linux/amd64
+          - linux/arm64
+        os:
+          - debian
+          - centos
 
-        steps:
-        - uses: actions/checkout@v2
-          with:
-            fetch-depth: 0
-        - uses: docker/setup-buildx-action@v1
-        - uses: docker/setup-qemu-action@v1
-          with:
-            image: tonistiigi/binfmt:latest
-            platforms: all
-        - name: get docker sha256
-          id: disgest
-          run: |
-              digest=$(docker buildx imagetools inspect ghcr.io/${{ github.repository }}/base:${{ matrix.golang }}-${{ matrix.os }} --raw | jq --raw-output '.manifests[] | select(.platform.architecture=="amd64").digest')
-              echo "::set-output name=image::ghcr.io/${{ github.repository }}/base@${digest}"
-        - run: docker pull ${{ steps.disgest.outputs.image }}
-        - name: build base image
-          uses: docker/build-push-action@v2
-          with:
-            pull: true
-            load: true
-            cache-from: ${{ steps.disgest.outputs.image }}
-            platforms: ${{ matrix.arch }}
-            build-args: GO_VERSION=${{ matrix.golang }}
-            tags: ghcr.io/${{ github.repository }}/base:${{ matrix.golang }}-${{ matrix.os }}
-            file: .github/dockerfile/Dockerfile.${{ matrix.os }}
-        - name: build
-          run: |
-            docker run -i --rm \
-            -v $(pwd):/ekuiper \
-            --workdir /ekuiper \
-            --platform ${{ matrix.arch }} \
-            ghcr.io/${{ github.repository }}/base:${{ matrix.golang }}-${{ matrix.os }} \
-            bash -euc "make pkg  && .github/scripts/test.sh"
-            cd _packages && for var in $(ls); do sudo bash -c "echo $(sha256sum $var | awk '{print $1}') > $var.sha256"; done && cd -
-        - uses: actions/upload-artifact@v1
-          with:
-            name: packages
-            path: _packages/.
+    steps:
+    - uses: actions/checkout@v2
+      with:
+        fetch-depth: 0
+    - uses: docker/setup-buildx-action@v1
+    - uses: docker/setup-qemu-action@v1
+      with:
+        image: tonistiigi/binfmt:latest
+        platforms: all
+    - name: get docker sha256
+      id: disgest
+      run: |
+          digest=$(docker buildx imagetools inspect ghcr.io/${{ github.repository }}/base:${{ matrix.golang }}-${{ matrix.os }} --raw | jq --raw-output '.manifests[] | select(.platform.architecture=="amd64").digest')
+          echo "::set-output name=image::ghcr.io/${{ github.repository }}/base@${digest}"
+    - run: docker pull ${{ steps.disgest.outputs.image }}
+    - name: build base image
+      uses: docker/build-push-action@v2
+      with:
+        pull: true
+        load: true
+        cache-from: ${{ steps.disgest.outputs.image }}
+        platforms: ${{ matrix.arch }}
+        build-args: GO_VERSION=${{ matrix.golang }}
+        tags: ghcr.io/${{ github.repository }}/base:${{ matrix.golang }}-${{ matrix.os }}
+        file: .github/dockerfile/Dockerfile.${{ matrix.os }}
+    - name: build
+      run: |
+        docker run -i --rm \
+        -v $(pwd):/ekuiper \
+        --workdir /ekuiper \
+        --platform ${{ matrix.arch }} \
+        ghcr.io/${{ github.repository }}/base:${{ matrix.golang }}-${{ matrix.os }} \
+        bash -euc "make pkg  && .github/scripts/test.sh"
+        cd _packages && for var in $(ls); do sudo bash -c "echo $(sha256sum $var | awk '{print $1}') > $var.sha256"; done && cd -
+    - uses: actions/upload-artifact@v1
+      with:
+        name: packages
+        path: _packages/.
 
-    build-on-mac:
-        runs-on: macos-latest
+  build-on-mac:
+    runs-on: macos-latest
 
-        steps:
-        - uses: actions/checkout@v2
-          with:
-            fetch-depth: 0
-        - uses: actions/setup-go@v2
-          with:
-            go-version: '1.15.1'
-        - name: prepare
-          run: |
-              brew install curl zip unzip gnu-sed upx pkg-config zmq
-              echo "/usr/local/bin:$PATH" >> ~/.bashrc
-        - name: build
-          run: |
-            make pkg
-            cd _packages && for var in $(ls); do openssl dgst -sha256 $var | awk '{print $2}' > $var.sha256; done && cd -
-        - uses: actions/upload-artifact@v1
-          with:
-            name: packages-mac
-            path: _packages/.
+    steps:
+    - uses: actions/checkout@v2
+      with:
+        fetch-depth: 0
+    - uses: actions/setup-go@v2
+      with:
+        go-version: '1.15.1'
+    - name: prepare
+      run: |
+          brew install curl zip unzip gnu-sed upx pkg-config zmq
+          echo "/usr/local/bin:$PATH" >> ~/.bashrc
+    - name: build
+      run: |
+        make pkg
+        cd _packages && for var in $(ls); do openssl dgst -sha256 $var | awk '{print $2}' > $var.sha256; done && cd -
+    - uses: actions/upload-artifact@v1
+      with:
+        name: packages-mac
+        path: _packages/.
 
-    build-docker-images:
-        runs-on: ubuntu-latest
+  build-docker-images:
+    runs-on: ubuntu-latest
 
-        steps:
-        - uses: actions/checkout@v2
-          with:
-            fetch-depth: 0
-        - uses: docker/setup-buildx-action@v1
-        - uses: docker/setup-qemu-action@v1
-          with:
-            image: tonistiigi/binfmt:latest
-            platforms: all
-        - name: build docker image
-          run: |
-            make docker -j4
-            docker save lfedge/ekuiper:$(git describe --tags --always)-slim > kuiper-image.tar.gz
-        - name: test docker image
-          run: |
-            for image_id in $(docker images lfedge/ekuiper -q); do
-              container_id=$(docker run -d $image_id)
-              ip_address=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' $container_id)
-              sleep 5
-              if ! curl ${ip_address}:9081  >/dev/null 2>&1; then echo "docker image failed"; exit 1; fi
-            done
-        - uses: actions/upload-artifact@v2
-          with:
-            name: kuiper-image
-            path: "kuiper-image.tar.gz"
+    strategy:
+        fail-fast: false
+        matrix:
+            suffix:
+            - ""
+            - "-slim"
+            - "-alpine"
 
-    build-plugins:
-        runs-on: ubuntu-latest
+    steps:
+    - uses: actions/checkout@v2
+      with:
+        fetch-depth: 0
+    - uses: docker/setup-buildx-action@v1
+    - uses: docker/setup-qemu-action@v1
+      with:
+        image: tonistiigi/binfmt:latest
+        platforms: all
+    - name: Build single platform image
+      id: single_image
+      uses: docker/build-push-action@v2
+      with:
+        context: .
+        platforms: linux/amd64
+        push: false
+        load: true
+        tags: ${{ github.repository }}
+        file: deploy/docker/Dockerfile${{ matrix.suffix }}
+    - name: Test docker image
+      run: |
+        docker run -d --name ekuiper ${{ github.repository }}
+        ip_address=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' ekuiper)
+        sleep 5
+        if ! curl ${ip_address}:9081  >/dev/null 2>&1; then echo "docker image failed"; exit 1; fi
+    - uses: docker/metadata-action@v3
+      id: meta
+      with:
+        images: ${{ github.repository }}
+        flavor: |
+          latest=${{ github.event_name == 'release' && !github.event.release.prerelease}}
+          suffix=${{ matrix.suffix }}
+        tags: |
+          type=ref,event=branch
+          type=ref,event=pr
+          type=ref,event=tag
+          type=semver,pattern={{version}}
+          type=semver,pattern={{major}}.{{minor}}
+    - uses: docker/login-action@v1
+      if: github.event_name == 'release'
+      with:
+        username: ${{ secrets.DOCKER_HUB_USER }}
+        password: ${{ secrets.DOCKER_HUB_TOKEN }}
+    - name: Build multi platform image
+      uses: docker/build-push-action@v2
+      with:
+        context: .
+        platforms: linux/amd64,linux/arm64,linux/arm/v7,linux/386
+        push: ${{ github.event_name == 'release' }}
+        tags: ${{ steps.meta.outputs.tags }}
+        labels: ${{ steps.meta.outputs.labels }}
+        file: deploy/docker/Dockerfile${{ matrix.suffix }}
 
-        needs: build-docker-images
+  build-plugins:
+    runs-on: ubuntu-latest
 
-        strategy:
-            fail-fast: false
-            matrix:
-                plugin:
-                - sinks/file
-                - sinks/image
-                - sinks/influx
-                - sinks/tdengine
-                - sinks/zmq
-                - sinks/redis
-                - sources/random
-                - sources/zmq
-                - functions/accumulateWordCount
-                - functions/countPlusOne
-                - functions/echo
-                - functions/image
-                - functions/geohash
-                - functions/labelImage
+    strategy:
+      fail-fast: false
+      matrix:
+        plugin:
+          - sinks/file
+          - sinks/image
+          - sinks/influx
+          - sinks/tdengine
+          - sinks/zmq
+          - sinks/redis
+          - sources/random
+          - sources/zmq
+          - functions/accumulateWordCount
+          - functions/countPlusOne
+          - functions/echo
+          - functions/image
+          - functions/geohash
+          - functions/labelImage
 
-        steps:
-        - uses: actions/checkout@v2
-          with:
-            fetch-depth: 0
-        - uses: docker/setup-buildx-action@v1
-        - uses: docker/setup-qemu-action@v1
-          with:
-            image: tonistiigi/binfmt:latest
-            platforms: all
-        - name: build debian plugins
-          env:
-            PLUGIN: ${{ matrix.plugin }}
-          run: |
-              make ${PLUGIN}
-        - uses: actions/download-artifact@v1
-          with:
-            name: kuiper-image
-            path: .
-        - name: test docker and plugins
-          env:
-            PLUGIN: ${{ matrix.plugin }}
-          run: |
-            set -e -x -u
-            docker load < kuiper-image.tar.gz
-            plugin_type=$(echo ${PLUGIN%%/*})
-            plugin_name=$(echo ${PLUGIN##*/})
+    steps:
+    - uses: actions/checkout@v2
+      with:
+        fetch-depth: 0
+    - uses: docker/setup-buildx-action@v1
+    - uses: docker/setup-qemu-action@v1
+      with:
+        image: tonistiigi/binfmt:latest
+        platforms: all
+    - name: Build single platform image
+      uses: docker/build-push-action@v2
+      with:
+        context: .
+        platforms: linux/amd64
+        push: false
+        load: true
+        tags: ${{ github.repository }}
+        file: deploy/docker/Dockerfile
+    - name: build debian plugins
+      env:
+        PLUGIN: ${{ matrix.plugin }}
+      run: |
+          make ${PLUGIN}
+    - name: test docker and plugins
+      env:
+        PLUGIN: ${{ matrix.plugin }}
+      run: |
+        set -e -x -u
+        plugin_type=$(echo ${PLUGIN%%/*})
+        plugin_name=$(echo ${PLUGIN##*/})
 
-            for image_id in $(docker images lfedge/ekuiper -q); do
-                container_id=$(docker run -d -v $(pwd)/_plugins:/var/plugins $image_id)
-                ip_address=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' $container_id)
-                os=$(docker exec -i ${container_id} sh -c "sed -n '/^ID=/p' /etc/os-release | sed -r 's/ID=(.*)/\1/g'" )
-                sleep 5
-                if ! curl ${ip_address}:9081  >/dev/null 2>&1; then echo "docker image failed"; exit 1; fi
-                if [ ${os} = alpine ]; then continue; fi
-                if [ "${plugin_name}" = "tdengine" ]; then
-                    curl \
-                    ${ip_address}:9081/plugins/${plugin_type} \
-                    -X POST \
-                    -d "{\"name\":\"${plugin_name}\", \"file\":\"file:///var/plugins/${os}/${plugin_type}/${plugin_name}_amd64.zip\", \"shellParas\": [\"2.0.3.1\"]}"
-                elif [ "${plugin_name}" = "image" ]; then
-                     curl \
-                     ${ip_address}:9081/plugins/${plugin_type} \
-                     -X POST \
-                     -d "{\"name\":\"${plugin_name}\", \"file\":\"file:///var/plugins/${os}/${plugin_type}/${plugin_name}_amd64.zip\", \"functions\": [\"resize\",\"thumbnail\"]}"
-                elif [ "${plugin_name}" = "geohash" ]; then
-                     curl \
-                     ${ip_address}:9081/plugins/${plugin_type} \
-                     -X POST \
-                     -d "{\"name\":\"${plugin_name}\", \"file\":\"file:///var/plugins/${os}/${plugin_type}/${plugin_name}_amd64.zip\", \"functions\": [\"geohashEncode\", \"geohashEncodeInt\", \"geohashDecode\", \"geohashDecodeInt\", \"geohashBoundingBox\", \"geohashBoundingBoxInt\", \"geohashNeighbor\", \"geohashNeighborInt\", \"geohashNeighbors\", \"geohashNeighborsInt\"]}"
-                else
-                    curl \
-                    ${ip_address}:9081/plugins/${plugin_type} \
-                    -X POST \
-                    -d "{\"name\":\"${plugin_name}\", \"file\":\"file:///var/plugins/${os}/${plugin_type}/${plugin_name}_amd64.zip\"}"
-                fi
-                docker logs ${container_id}
-                [ $plugin_name = $(curl ${ip_address}:9081/plugins/${plugin_type}/${plugin_name} | jq '.name'| sed 's/\"//g' ) ] || exit 1
-            done
-        - uses: actions/upload-artifact@v2
-          with:
-            name: plugins
-            path: "_plugins/"
+        container_id=$(docker run -d -v $(pwd)/_plugins:/var/plugins ${{ github.repository }})
+        ip_address=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' $container_id)
+        os=$(docker exec -i ${container_id} sh -c "sed -n '/^ID=/p' /etc/os-release | sed -r 's/ID=(.*)/\1/g'" )
+        sleep 5
+        if ! curl ${ip_address}:9081  >/dev/null 2>&1; then echo "docker image failed"; exit 1; fi
+        if [ "${plugin_name}" = "tdengine" ]; then
+            curl \
+            ${ip_address}:9081/plugins/${plugin_type} \
+            -X POST \
+            -d "{\"name\":\"${plugin_name}\", \"file\":\"file:///var/plugins/${os}/${plugin_type}/${plugin_name}_amd64.zip\", \"shellParas\": [\"2.0.3.1\"]}"
+        elif [ "${plugin_name}" = "image" ]; then
+             curl \
+             ${ip_address}:9081/plugins/${plugin_type} \
+             -X POST \
+             -d "{\"name\":\"${plugin_name}\", \"file\":\"file:///var/plugins/${os}/${plugin_type}/${plugin_name}_amd64.zip\", \"functions\": [\"resize\",\"thumbnail\"]}"
+        elif [ "${plugin_name}" = "geohash" ]; then
+             curl \
+             ${ip_address}:9081/plugins/${plugin_type} \
+             -X POST \
+             -d "{\"name\":\"${plugin_name}\", \"file\":\"file:///var/plugins/${os}/${plugin_type}/${plugin_name}_amd64.zip\", \"functions\": [\"geohashEncode\", \"geohashEncodeInt\", \"geohashDecode\", \"geohashDecodeInt\", \"geohashBoundingBox\", \"geohashBoundingBoxInt\", \"geohashNeighbor\", \"geohashNeighborInt\", \"geohashNeighbors\", \"geohashNeighborsInt\"]}"
+        else
+            curl \
+            ${ip_address}:9081/plugins/${plugin_type} \
+            -X POST \
+            -d "{\"name\":\"${plugin_name}\", \"file\":\"file:///var/plugins/${os}/${plugin_type}/${plugin_name}_amd64.zip\"}"
+        fi
+        docker logs ${container_id}
+        [ $plugin_name = $(curl ${ip_address}:9081/plugins/${plugin_type}/${plugin_name} | jq '.name'| sed 's/\"//g' ) ] || exit 1
+    - uses: actions/upload-artifact@v2
+      with:
+        name: plugins
+        path: "_plugins/"
 
-    build-docker-manifest-images:
-        runs-on: ubuntu-latest
+  build-kubernetes-tool:
+    runs-on: ubuntu-latest
 
-        needs: build-docker-images
+    steps:
+    - uses: actions/checkout@v2
+      with:
+        fetch-depth: 0
+    - uses: docker/setup-buildx-action@v1
+    - uses: docker/setup-qemu-action@v1
+      with:
+        image: tonistiigi/binfmt:latest
+        platforms: all
+    - name: Build single platform image
+      uses: docker/build-push-action@v2
+      with:
+        context: .
+        platforms: linux/amd64
+        push: false
+        load: true
+        tags: lfedge/ekuiper-kubernetes-tool
+        file: deploy/docker/Dockerfile-kubernetes-tool
+    - name: Test docker image
+      run: |
+        docker run -d --name kuiper-kubernetes-tool lfedge/ekuiper-kubernetes-tool
+        sleep 5
+        if [[ "$(docker logs kuiper-kubernetes-tool)" != *"Kuiper kubernetes tool is started successfully!"*  ]]; then exit 1; fi
+    - uses: docker/metadata-action@v3
+      id: meta
+      with:
+        images: deploy/docker/Dockerfile-kubernetes-tool
+        flavor: |
+          latest=${{ github.event_name == 'release' && !github.event.release.prerelease}}
+        tags: |
+          type=ref,event=branch
+          type=ref,event=pr
+          type=ref,event=tag
+          type=semver,pattern={{version}}
+          type=semver,pattern={{major}}.{{minor}}
+    - uses: docker/login-action@v1
+      if: github.event_name == 'release'
+      with:
+        username: ${{ secrets.DOCKER_HUB_USER }}
+        password: ${{ secrets.DOCKER_HUB_TOKEN }}
+    - name: Build multi platform image
+      uses: docker/build-push-action@v2
+      with:
+        context: .
+        platforms: linux/amd64,linux/arm64,linux/arm/v7,linux/386
+        push: ${{ github.event_name == 'release' }}
+        tags: ${{ steps.meta.outputs.tags }}
+        labels: ${{ steps.meta.outputs.labels }}
+        file: deploy/docker/Dockerfile-kubernetes-tool
 
-        if: github.event_name == 'release'
-
-        strategy:
-            matrix:
-                suffix:
-                - fat
-                - slim
-                - alpine
-
-        steps:
-        - uses: actions/checkout@v2
-          with:
-            fetch-depth: 0
-        - uses: docker/setup-buildx-action@v1
-        - uses: docker/setup-qemu-action@v1
-          with:
-            image: tonistiigi/binfmt:latest
-            platforms: all
-        - uses: docker/login-action@v1
-          with:
-            username: ${{ secrets.DOCKER_HUB_USER }}
-            password: ${{ secrets.DOCKER_HUB_TOKEN }}
-        - name: cross build docker images
-          if: matrix.suffix == 'fat'
-          run: |
-            set -e -u -x
-            docker buildx build --no-cache \
-            --platform=linux/amd64,linux/arm64,linux/arm/v7,linux/386 \
-            -t lfedge/ekuiper:$(git describe --tags --always) \
-            -f deploy/docker/Dockerfile . \
-            --push
-        - name: cross build docker images
-          if: matrix.suffix != 'fat'
-          env:
-              SUFFIX: ${{ matrix.suffix }}
-          run: |
-            set -e -u -x
-            docker buildx build --no-cache \
-            --platform=linux/amd64,linux/arm64,linux/arm/v7,linux/386 \
-            -t lfedge/ekuiper:$(git describe --tags --always)-$SUFFIX \
-            -f deploy/docker/Dockerfile-$SUFFIX . \
-            --push
-
-    build-kubernetes-tool:
-        runs-on: ubuntu-latest
-
-        steps:
-        - uses: actions/checkout@v2
-          with:
-            fetch-depth: 0
-        - uses: docker/setup-buildx-action@v1
-        - uses: docker/setup-qemu-action@v1
-          with:
-            image: tonistiigi/binfmt:latest
-            platforms: all
-        - name: build docker image
-          run: docker build --no-cache -t lfedge/ekuiper-kubernetes-tool:$(git describe --tags --always) -f deploy/docker/Dockerfile-kubernetes-tool .
-        - name: test docker image
-          run: |
-            set -e -u -x
-            docker run -d --name kuiper-kubernetes-tool lfedge/ekuiper-kubernetes-tool:$(git describe --tags --always)
-            sleep 5
-            if [[ "$(docker logs kuiper-kubernetes-tool)" != *"Kuiper kubernetes tool is started successfully!"*  ]]; then exit 1; fi
-        - uses: docker/login-action@v1
-          if: github.event_name == 'release'
-          with:
-            username: ${{ secrets.DOCKER_HUB_USER }}
-            password: ${{ secrets.DOCKER_HUB_TOKEN }}
-        - name: buildx docker image
-          if: github.event_name == 'release'
-          run: |
-            docker buildx build --no-cache \
-                --platform=linux/amd64,linux/arm64,linux/arm/v7,linux/386 \
-                -t lfedge/ekuiper-kubernetes-tool:$(git describe --tags --always) \
-                -f deploy/docker/Dockerfile-kubernetes-tool . \
-                --push
-
-    release:
-        runs-on: ubuntu-latest
+  release:
+    runs-on: ubuntu-latest
 
-        needs:
-        - build
-        - build-on-mac
-        - build-plugins
+    needs:
+    - build
+    - build-on-mac
+    - build-plugins
 
-        steps:
-        - uses: actions/checkout@v2
-        - uses: actions/download-artifact@v1
-          with:
-            name: packages
-            path: _packages
-        - uses: actions/download-artifact@v1
-          with:
-            name: packages-mac
-            path: _packages
-        - uses: actions/download-artifact@v1
-          with:
-            name: plugins
-            path: _plugins
-        - name: check packages
-          run: |
-            cd _packages && for var in $( ls |grep -v sha256); do
-              echo "$(cat $var.sha256) $var" | sha256sum -c || exit 1
-            done
-        - uses: Rory-Z/upload-release-asset@v1
-          if: github.event_name == 'release'
-          with:
-            repo: ekuiper
-            path: "_packages/kuiper-*"
-            token: ${{ secrets.GITHUB_TOKEN }}
-        - name: upload plugins to s3
-          if: github.event_name == 'release'
-          run: |
-            version=$(echo ${{ github.ref }} | sed -r  "s .*/.*/(.*) \1 g")
-            aws configure set aws_access_key_id ${{ secrets.AWS_ACCESS_KEY_ID }}
-            aws configure set aws_secret_access_key ${{ secrets.AWS_SECRET_ACCESS_KEY }}
-            aws configure set default.region us-west-2
-            aws s3 rm --quiet --recursive s3://packages.emqx/kuiper/$version
-            aws s3 cp --quiet --recursive ./_packages s3://packages.emqx/kuiper/$version
-            aws s3 cp --quiet --recursive ./_plugins s3://packages.emqx/kuiper-plugins/$version
-            aws cloudfront create-invalidation --distribution-id E170YEULGLT8XB --paths "/kuiper/$version/*,/kuiper-plugins/$version/*"
+    steps:
+    - uses: actions/checkout@v2
+    - uses: actions/download-artifact@v1
+      with:
+        name: packages
+        path: _packages
+    - uses: actions/download-artifact@v1
+      with:
+        name: packages-mac
+        path: _packages
+    - uses: actions/download-artifact@v1
+      with:
+        name: plugins
+        path: _plugins
+    - name: check packages
+      run: |
+        cd _packages && for var in $( ls |grep -v sha256); do
+          echo "$(cat $var.sha256) $var" | sha256sum -c || exit 1
+        done
+    - uses: Rory-Z/upload-release-asset@v1
+      if: github.event_name == 'release'
+      with:
+        repo: ekuiper
+        path: "_packages/kuiper-*"
+        token: ${{ secrets.GITHUB_TOKEN }}
+    - name: upload plugins to s3
+      if: github.event_name == 'release'
+      run: |
+        version=$(echo ${{ github.ref }} | sed -r  "s .*/.*/(.*) \1 g")
+        aws configure set aws_access_key_id ${{ secrets.AWS_ACCESS_KEY_ID }}
+        aws configure set aws_secret_access_key ${{ secrets.AWS_SECRET_ACCESS_KEY }}
+        aws configure set default.region us-west-2
+        aws s3 rm --quiet --recursive s3://packages.emqx/kuiper/$version
+        aws s3 cp --quiet --recursive ./_packages s3://packages.emqx/kuiper/$version
+        aws s3 cp --quiet --recursive ./_plugins s3://packages.emqx/kuiper-plugins/$version
+        aws cloudfront create-invalidation --distribution-id E170YEULGLT8XB --paths "/kuiper/$version/*,/kuiper-plugins/$version/*"

+ 190 - 190
.github/workflows/run_fvt_tests.yaml

@@ -14,197 +14,197 @@ on:
       - published
 
 jobs:
-    fvt_tests_with_edgex:
-        runs-on: ubuntu-latest
+  fvt_tests_with_edgex:
+    runs-on: ubuntu-latest
 
-        steps:
-        - uses: actions/setup-go@v1
-          with:
-            go-version: '1.14'
-        - uses: actions/setup-java@v1
-          with:
-            java-version: '8' # The JDK version to make available on the path.
-            java-package: jdk # (jre, jdk, or jdk+fx) - defaults to jdk
-            architecture: x64 # (x64 or x86) - defaults to x64
-        - name: install jmeter
-          timeout-minutes: 10
-          env:
-              JMETER_VERSION: 5.3
-          run: |
-            wget --no-check-certificate -O /tmp/apache-jmeter.tgz https://downloads.apache.org//jmeter/binaries/apache-jmeter-$JMETER_VERSION.tgz
-            cd /tmp && tar -xvf apache-jmeter.tgz
-            echo "jmeter.save.saveservice.output_format=xml" >> /tmp/apache-jmeter-$JMETER_VERSION/user.properties
-            echo "jmeter.save.saveservice.response_data.on_error=true" >> /tmp/apache-jmeter-$JMETER_VERSION/user.properties
-            wget -O /tmp/apache-jmeter-$JMETER_VERSION/lib/ext/mqtt-xmeter-1.13-jar-with-dependencies.jar https://github.com/emqx/mqtt-jmeter/raw/master/Download/v1.13.0/mqtt-xmeter-1.13-jar-with-dependencies.jar
-            ln -s /tmp/apache-jmeter-$JMETER_VERSION /opt/jmeter
-        - name: install emqx
-          env:
-            EMQX_VERSION: v4.0.2
-          run: |
-            wget -O emqx.deb https://www.emqx.io/downloads/broker/v4.0.2/emqx-ubuntu18.04-${EMQX_VERSION}_amd64.deb
-            sudo dpkg -i emqx.deb
-        - uses: actions/checkout@v2
-        - name: build kuiper
-          run: |
-            sudo apt update && sudo apt install pkg-config libczmq-dev -y
-            make build_with_edgex
-            go build -trimpath -modfile extensions.mod --buildmode=plugin -o plugins/sources/Zmq.so extensions/sources/zmq/zmq.go
-            go build -trimpath -modfile extensions.mod --buildmode=plugin -o plugins/functions/Image.so extensions/functions/image/*.go
-        - name: run edgex && emqx && kuiper
-          run: |
-            sudo ./test/setup_env.sh
-            ln -s _build/kuiper-$(git describe --tags --always)-$(uname -s | tr "[A-Z]" "[a-z]")-amd64/log kuiper_logs
-        - name: run fvt tests
-          timeout-minutes: 8
-          run: ./test/run_jmeter.sh with_edgex=true
-        - uses: actions/upload-artifact@v1
-          if: always()
-          with:
-            name: kuiper_logs_with_edgex
-            path: ./kuiper_logs
-        - uses: actions/upload-artifact@v1
-          if: always()
-          with:
-            name: jmeter_logs_with_edgex
-            path: ./jmeter_logs
-        - name: check logs
-          run: |
-            sudo apt update && sudo apt install -y libxml2-utils
-            cd jmeter_logs
-            if [ ! -z "$(cat *.jtl| grep '<failure>' | awk -F '>' '{print $2}' | awk -F '<' '{print $1}' | grep true)" ] ||
-               [ "$(xmllint --format --xpath '/testResults/sample/@rc' $(ls *.jtl) | sed -r 's/ /\n/g;' | sort -u | grep -E 'rc=\"[45][0-9][0-9]\"|rc=\"\"')" != "" ]; then
-                echo -e "---------------------------------------------\n"
-                echo "FVT tests error"
-                exit 1
-            fi
+    steps:
+    - uses: actions/setup-go@v1
+      with:
+        go-version: '1.14'
+    - uses: actions/setup-java@v1
+      with:
+        java-version: '8' # The JDK version to make available on the path.
+        java-package: jdk # (jre, jdk, or jdk+fx) - defaults to jdk
+        architecture: x64 # (x64 or x86) - defaults to x64
+    - name: install jmeter
+      timeout-minutes: 10
+      env:
+          JMETER_VERSION: 5.3
+      run: |
+        wget --no-check-certificate -O /tmp/apache-jmeter.tgz https://downloads.apache.org//jmeter/binaries/apache-jmeter-$JMETER_VERSION.tgz
+        cd /tmp && tar -xvf apache-jmeter.tgz
+        echo "jmeter.save.saveservice.output_format=xml" >> /tmp/apache-jmeter-$JMETER_VERSION/user.properties
+        echo "jmeter.save.saveservice.response_data.on_error=true" >> /tmp/apache-jmeter-$JMETER_VERSION/user.properties
+        wget -O /tmp/apache-jmeter-$JMETER_VERSION/lib/ext/mqtt-xmeter-1.13-jar-with-dependencies.jar https://github.com/emqx/mqtt-jmeter/raw/master/Download/v1.13.0/mqtt-xmeter-1.13-jar-with-dependencies.jar
+        ln -s /tmp/apache-jmeter-$JMETER_VERSION /opt/jmeter
+    - name: install emqx
+      env:
+        EMQX_VERSION: v4.0.2
+      run: |
+        wget -O emqx.deb https://www.emqx.io/downloads/broker/v4.0.2/emqx-ubuntu18.04-${EMQX_VERSION}_amd64.deb
+        sudo dpkg -i emqx.deb
+    - uses: actions/checkout@v2
+    - name: build kuiper
+      run: |
+        sudo apt update && sudo apt install pkg-config libczmq-dev -y
+        make build_with_edgex
+        go build -trimpath -modfile extensions.mod --buildmode=plugin -o plugins/sources/Zmq.so extensions/sources/zmq/zmq.go
+        go build -trimpath -modfile extensions.mod --buildmode=plugin -o plugins/functions/Image.so extensions/functions/image/*.go
+    - name: run edgex && emqx && kuiper
+      run: |
+        sudo ./test/setup_env.sh
+        ln -s _build/kuiper-$(git describe --tags --always)-$(uname -s | tr "[A-Z]" "[a-z]")-amd64/log kuiper_logs
+    - name: run fvt tests
+      timeout-minutes: 8
+      run: ./test/run_jmeter.sh with_edgex=true
+    - uses: actions/upload-artifact@v1
+      if: always()
+      with:
+        name: kuiper_logs_with_edgex
+        path: ./kuiper_logs
+    - uses: actions/upload-artifact@v1
+      if: always()
+      with:
+        name: jmeter_logs_with_edgex
+        path: ./jmeter_logs
+    - name: check logs
+      run: |
+        sudo apt update && sudo apt install -y libxml2-utils
+        cd jmeter_logs
+        if [ ! -z "$(cat *.jtl| grep '<failure>' | awk -F '>' '{print $2}' | awk -F '<' '{print $1}' | grep true)" ] ||
+           [ "$(xmllint --format --xpath '/testResults/sample/@rc' $(ls *.jtl) | sed -r 's/ /\n/g;' | sort -u | grep -E 'rc=\"[45][0-9][0-9]\"|rc=\"\"')" != "" ]; then
+            echo -e "---------------------------------------------\n"
+            echo "FVT tests error"
+            exit 1
+        fi
 
-    fvt_tests_for_container_in_helm:
-      runs-on: ubuntu-latest
+  fvt_tests_for_container_in_helm:
+    runs-on: ubuntu-latest
 
-      steps:
-      - uses: actions/checkout@v2
-      - uses: actions/setup-java@v1
-        with:
-          java-version: '8' # The JDK version to make available on the path.
-          java-package: jdk # (jre, jdk, or jdk+fx) - defaults to jdk
-          architecture: x64 # (x64 or x86) - defaults to x64
-      - name: install jmeter
-        timeout-minutes: 10
-        env:
-            JMETER_VERSION: 5.3
-        run: |
-          wget --no-check-certificate -O /tmp/apache-jmeter.tgz https://downloads.apache.org//jmeter/binaries/apache-jmeter-$JMETER_VERSION.tgz
-          cd /tmp && tar -xvf apache-jmeter.tgz
-          echo "jmeter.save.saveservice.output_format=xml" >> /tmp/apache-jmeter-$JMETER_VERSION/user.properties
-          echo "jmeter.save.saveservice.response_data.on_error=true" >> /tmp/apache-jmeter-$JMETER_VERSION/user.properties
-          wget -O /tmp/apache-jmeter-$JMETER_VERSION/lib/ext/mqtt-xmeter-1.13-jar-with-dependencies.jar https://github.com/emqx/mqtt-jmeter/raw/master/Download/v1.13.0/mqtt-xmeter-1.13-jar-with-dependencies.jar
-          ln -s /tmp/apache-jmeter-$JMETER_VERSION /opt/jmeter
-      - name: setup jmeter
-        timeout-minutes: 10
-        run: |
-          wget -O "/opt/jmeter/lib/json-lib-2.4-jdk15.jar" https://repo1.maven.org/maven2/net/sf/json-lib/json-lib/2.4/json-lib-2.4-jdk15.jar
-          wget -O "/opt/jmeter/lib/commons-beanutils-1.8.0.jar" https://repo1.maven.org/maven2/commons-beanutils/commons-beanutils/1.8.0/commons-beanutils-1.8.0.jar
-          wget -O "/opt/jmeter/lib/commons-collections-3.2.1.jar" https://repo1.maven.org/maven2/commons-collections/commons-collections/3.2.1/commons-collections-3.2.1.jar
-          wget -O "/opt/jmeter/lib/commons-lang-2.5.jar" https://repo1.maven.org/maven2/commons-lang/commons-lang/2.5/commons-lang-2.5.jar
-          wget -O "/opt/jmeter/lib/commons-logging-1.1.1.jar" https://repo1.maven.org/maven2/commons-logging/commons-logging/1.1.1/commons-logging-1.1.1.jar
-          wget -O "/opt/jmeter/lib/ezmorph-1.0.6.jar" https://repo1.maven.org/maven2/net/sf/ezmorph/ezmorph/1.0.6/ezmorph-1.0.6.jar
-      - name: install docker
-        run: |
-          sudo apt-get remove docker docker-engine docker.io containerd runc
-          sudo apt-get update
-          sudo apt-get install apt-transport-https ca-certificates curl gnupg-agent software-properties-common
-          curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
-          sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
-          sudo apt-get update
-          sudo apt-get install docker-ce docker-ce-cli containerd.io
-      - name: install k3s
-        env:
-          KUBECONFIG: "/etc/rancher/k3s/k3s.yaml"
-        run: |
-          sudo sh -c "echo \"127.0.0.1 $(hostname)\" >> /etc/hosts"
-          curl -sfL https://get.k3s.io | sh -
-          sudo chmod 644 /etc/rancher/k3s/k3s.yaml
-          kubectl cluster-info
-      - name: install helm
-        run: |
-          curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3
-          sudo chmod 700 get_helm.sh
-          sudo ./get_helm.sh
-          helm version
-      - name: build kuiper for docker
-        run: sudo docker build --no-cache -t lfedge/ekuiper:$(git describe --tags --alway)-alpine -f deploy/docker/Dockerfile-alpine .
-      - name: run emqx on chart
-        env:
-          KUBECONFIG: "/etc/rancher/k3s/k3s.yaml"
-        timeout-minutes: 5
-        run: |
-          helm repo add emqx https://repos.emqx.io/charts
-          helm repo update
-          helm install emqx --set replicaCount=1 emqx/emqx
-          while [ "$(kubectl get StatefulSet -l app.kubernetes.io/name=emqx -o jsonpath='{.items[0].status.replicas}')" \
-            != "$(kubectl get StatefulSet -l app.kubernetes.io/name=emqx -o jsonpath='{.items[0].status.readyReplicas}')" ]; do
-            echo "waiting emqx started"
-            sleep 10
-          done
-      - name: run kuiper for chart
-        env:
-          KUBECONFIG: "/etc/rancher/k3s/k3s.yaml"
-        timeout-minutes: 5
-        run: |
-          version=$(git describe --tags --always)
-          emqx_address=$(kubectl get svc --namespace default emqx -o jsonpath="{.spec.clusterIP}")
-          
-          sudo docker save lfedge/ekuiper:$version-alpine -o kuier.tar.gz
-          sudo k3s ctr image import kuier.tar.gz
+    steps:
+    - uses: actions/checkout@v2
+    - uses: actions/setup-java@v1
+      with:
+        java-version: '8' # The JDK version to make available on the path.
+        java-package: jdk # (jre, jdk, or jdk+fx) - defaults to jdk
+        architecture: x64 # (x64 or x86) - defaults to x64
+    - name: install jmeter
+      timeout-minutes: 10
+      env:
+          JMETER_VERSION: 5.3
+      run: |
+        wget --no-check-certificate -O /tmp/apache-jmeter.tgz https://downloads.apache.org//jmeter/binaries/apache-jmeter-$JMETER_VERSION.tgz
+        cd /tmp && tar -xvf apache-jmeter.tgz
+        echo "jmeter.save.saveservice.output_format=xml" >> /tmp/apache-jmeter-$JMETER_VERSION/user.properties
+        echo "jmeter.save.saveservice.response_data.on_error=true" >> /tmp/apache-jmeter-$JMETER_VERSION/user.properties
+        wget -O /tmp/apache-jmeter-$JMETER_VERSION/lib/ext/mqtt-xmeter-1.13-jar-with-dependencies.jar https://github.com/emqx/mqtt-jmeter/raw/master/Download/v1.13.0/mqtt-xmeter-1.13-jar-with-dependencies.jar
+        ln -s /tmp/apache-jmeter-$JMETER_VERSION /opt/jmeter
+    - name: setup jmeter
+      timeout-minutes: 10
+      run: |
+        wget -O "/opt/jmeter/lib/json-lib-2.4-jdk15.jar" https://repo1.maven.org/maven2/net/sf/json-lib/json-lib/2.4/json-lib-2.4-jdk15.jar
+        wget -O "/opt/jmeter/lib/commons-beanutils-1.8.0.jar" https://repo1.maven.org/maven2/commons-beanutils/commons-beanutils/1.8.0/commons-beanutils-1.8.0.jar
+        wget -O "/opt/jmeter/lib/commons-collections-3.2.1.jar" https://repo1.maven.org/maven2/commons-collections/commons-collections/3.2.1/commons-collections-3.2.1.jar
+        wget -O "/opt/jmeter/lib/commons-lang-2.5.jar" https://repo1.maven.org/maven2/commons-lang/commons-lang/2.5/commons-lang-2.5.jar
+        wget -O "/opt/jmeter/lib/commons-logging-1.1.1.jar" https://repo1.maven.org/maven2/commons-logging/commons-logging/1.1.1/commons-logging-1.1.1.jar
+        wget -O "/opt/jmeter/lib/ezmorph-1.0.6.jar" https://repo1.maven.org/maven2/net/sf/ezmorph/ezmorph/1.0.6/ezmorph-1.0.6.jar
+    - name: install docker
+      run: |
+        sudo apt-get remove docker docker-engine docker.io containerd runc
+        sudo apt-get update
+        sudo apt-get install apt-transport-https ca-certificates curl gnupg-agent software-properties-common
+        curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
+        sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
+        sudo apt-get update
+        sudo apt-get install docker-ce docker-ce-cli containerd.io
+    - name: install k3s
+      env:
+        KUBECONFIG: "/etc/rancher/k3s/k3s.yaml"
+      run: |
+        sudo sh -c "echo \"127.0.0.1 $(hostname)\" >> /etc/hosts"
+        curl -sfL https://get.k3s.io | sh -
+        sudo chmod 644 /etc/rancher/k3s/k3s.yaml
+        kubectl cluster-info
+    - name: install helm
+      run: |
+        curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3
+        sudo chmod 700 get_helm.sh
+        sudo ./get_helm.sh
+        helm version
+    - name: build kuiper for docker
+      run: sudo docker build --no-cache -t lfedge/ekuiper:$(git describe --tags --alway)-alpine -f deploy/docker/Dockerfile-alpine .
+    - name: run emqx on chart
+      env:
+        KUBECONFIG: "/etc/rancher/k3s/k3s.yaml"
+      timeout-minutes: 5
+      run: |
+        helm repo add emqx https://repos.emqx.io/charts
+        helm repo update
+        helm install emqx --set replicaCount=1 emqx/emqx
+        while [ "$(kubectl get StatefulSet -l app.kubernetes.io/name=emqx -o jsonpath='{.items[0].status.replicas}')" \
+          != "$(kubectl get StatefulSet -l app.kubernetes.io/name=emqx -o jsonpath='{.items[0].status.readyReplicas}')" ]; do
+          echo "waiting emqx started"
+          sleep 10
+        done
+    - name: run kuiper for chart
+      env:
+        KUBECONFIG: "/etc/rancher/k3s/k3s.yaml"
+      timeout-minutes: 5
+      run: |
+        version=$(git describe --tags --always)
+        emqx_address=$(kubectl get svc --namespace default emqx -o jsonpath="{.spec.clusterIP}")
+        
+        sudo docker save lfedge/ekuiper:$version-alpine -o kuier.tar.gz
+        sudo k3s ctr image import kuier.tar.gz
 
-          sed -i -r "s/^appVersion: .*$/appVersion: \"${version}\"/g" deploy/chart/kuiper/Chart.yaml
-          sed -i -r 's/  pullPolicy: .*$/  pullPolicy: Never/g' deploy/chart/kuiper/values.yaml
-          sed -i -r "s/      servers: \[.*\]$/      servers: \[tcp:\/\/${emqx_address}:1883\]/g" deploy/chart/kuiper/values.yaml
-          
-          helm install kuiper deploy/chart/kuiper --debug --dry-run
-          helm install kuiper deploy/chart/kuiper
-          while [ "$(kubectl get StatefulSet -l app.kubernetes.io/name=kuiper -o jsonpath='{.items[0].status.replicas}')" \
-            != "$(kubectl get StatefulSet -l app.kubernetes.io/name=kuiper -o jsonpath='{.items[0].status.readyReplicas}')" ]; do
-            echo "=============================="
-            kubectl describe pods kuiper-0
-            echo "=============================="
-            kubectl get pods
-            echo "=============================="
-            echo "waiting kuiper started"
-            sleep 10
-          done
-          kuiper_address=$(kubectl get svc --namespace default kuiper -o jsonpath="{.spec.clusterIP}")
-          if [ $(curl -w %{http_code} -fsSL -o /dev/null $kuiper_address:9081) != 200 ];then
-            kubectl logs kuiper-0
-            exit 1;
-          fi
-      - name: check kuiper
-        env:
-          KUBECONFIG: "/etc/rancher/k3s/k3s.yaml"
-        timeout-minutes: 5
-        run: |
-          emqx_address=$(kubectl get svc --namespace default emqx -o jsonpath="{.spec.clusterIP}")
-          kuiper_address=$(kubectl get svc --namespace default kuiper -o jsonpath="{.spec.clusterIP}")
-          /opt/jmeter/bin/jmeter.sh -Jjmeter.save.saveservice.output_format=xml -n -t test/select_aggr_rule.jmx -Dsrv=${kuiper_address} -Dmqtt_srv=${emqx_address} -l jmeter_logs/select_aggr_rule.jtl -j jmeter_logs/select_aggr_rule.log
-          mkdir -p kuiper_logs
-          kubectl exec kuiper-0 -- cat /kuiper/log/stream.log > kuiper_logs/stream.log
-      - uses: actions/upload-artifact@v1
-        if: always()
-        with:
-          name: kuiper_logs_with_helm
-          path: ./kuiper_logs
-      - uses: actions/upload-artifact@v1
-        if: always()
-        with:
-          name: jmeter_logs_with_helm
-          path: ./jmeter_logs
-      - name: check logs
-        run: |
-          sudo apt update && sudo apt install -y libxml2-utils
-          cd jmeter_logs
-          if [ ! -z "$(cat *.jtl| grep '<failure>' | awk -F '>' '{print $2}' | awk -F '<' '{print $1}' | grep true)" ] ||
-             [ "$(xmllint --format --xpath '/testResults/sample/@rc' $(ls *.jtl) | sed -r 's/ /\n/g;' | sort -u | grep -E 'rc=\"[45][0-9][0-9]\"|rc=\"\"')" != "" ]; then
-              echo -e "---------------------------------------------\n"
-              echo "FVT tests error"
-              exit 1
-          fi
+        sed -i -r "s/^appVersion: .*$/appVersion: \"${version}\"/g" deploy/chart/kuiper/Chart.yaml
+        sed -i -r 's/  pullPolicy: .*$/  pullPolicy: Never/g' deploy/chart/kuiper/values.yaml
+        sed -i -r "s/      servers: \[.*\]$/      servers: \[tcp:\/\/${emqx_address}:1883\]/g" deploy/chart/kuiper/values.yaml
+        
+        helm install kuiper deploy/chart/kuiper --debug --dry-run
+        helm install kuiper deploy/chart/kuiper
+        while [ "$(kubectl get StatefulSet -l app.kubernetes.io/name=kuiper -o jsonpath='{.items[0].status.replicas}')" \
+          != "$(kubectl get StatefulSet -l app.kubernetes.io/name=kuiper -o jsonpath='{.items[0].status.readyReplicas}')" ]; do
+          echo "=============================="
+          kubectl describe pods kuiper-0
+          echo "=============================="
+          kubectl get pods
+          echo "=============================="
+          echo "waiting kuiper started"
+          sleep 10
+        done
+        kuiper_address=$(kubectl get svc --namespace default kuiper -o jsonpath="{.spec.clusterIP}")
+        if [ $(curl -w %{http_code} -fsSL -o /dev/null $kuiper_address:9081) != 200 ];then
+          kubectl logs kuiper-0
+          exit 1;
+        fi
+    - name: check kuiper
+      env:
+        KUBECONFIG: "/etc/rancher/k3s/k3s.yaml"
+      timeout-minutes: 5
+      run: |
+        emqx_address=$(kubectl get svc --namespace default emqx -o jsonpath="{.spec.clusterIP}")
+        kuiper_address=$(kubectl get svc --namespace default kuiper -o jsonpath="{.spec.clusterIP}")
+        /opt/jmeter/bin/jmeter.sh -Jjmeter.save.saveservice.output_format=xml -n -t test/select_aggr_rule.jmx -Dsrv=${kuiper_address} -Dmqtt_srv=${emqx_address} -l jmeter_logs/select_aggr_rule.jtl -j jmeter_logs/select_aggr_rule.log
+        mkdir -p kuiper_logs
+        kubectl exec kuiper-0 -- cat /kuiper/log/stream.log > kuiper_logs/stream.log
+    - uses: actions/upload-artifact@v1
+      if: always()
+      with:
+        name: kuiper_logs_with_helm
+        path: ./kuiper_logs
+    - uses: actions/upload-artifact@v1
+      if: always()
+      with:
+        name: jmeter_logs_with_helm
+        path: ./jmeter_logs
+    - name: check logs
+      run: |
+        sudo apt update && sudo apt install -y libxml2-utils
+        cd jmeter_logs
+        if [ ! -z "$(cat *.jtl| grep '<failure>' | awk -F '>' '{print $2}' | awk -F '<' '{print $1}' | grep true)" ] ||
+           [ "$(xmllint --format --xpath '/testResults/sample/@rc' $(ls *.jtl) | sed -r 's/ /\n/g;' | sort -u | grep -E 'rc=\"[45][0-9][0-9]\"|rc=\"\"')" != "" ]; then
+            echo -e "---------------------------------------------\n"
+            echo "FVT tests error"
+            exit 1
+        fi

+ 45 - 45
.github/workflows/run_test_case.yaml

@@ -14,49 +14,49 @@ on:
       - published
 
 jobs:
-    run_test_case:
-        runs-on: ubuntu-latest
+  run_test_case:
+    runs-on: ubuntu-latest
 
-        steps:
-        - uses: actions/checkout@v2
-        - uses: actions/setup-go@v2
-          with:
-            go-version: '1.15.1'
-        - uses: actions/setup-python@v2
-          with:
-            python-version: '3.x'
-            architecture: 'x64'
-        - run: pip3 install pynng
-        - name: run code static check
-          run : |
-            if [ ! -z "$(gofmt -l .)" ];then
-              echo "code static check error"
-              gofmt -l .
-              exit 1
-            fi
-        - name: install lib
-          run: sudo apt-get update && sudo apt-get install libzmq3-dev -y
-        - name: run test case
-          run: |
-            set -e -u -x
-            mkdir -p data
-            mkdir -p log
-            sed -i -r "s/debug: .*/debug: true/1" etc/kuiper.yaml
-            go build -modfile extensions.mod --buildmode=plugin -o plugins/sources/Random@v2.0.0.so extensions/sources/random/random.go
-            go build -modfile extensions.mod --buildmode=plugin -o plugins/sinks/File@v1.0.0.so extensions/sinks/file/file.go
-            go build -modfile extensions.mod --buildmode=plugin -o plugins/functions/Echo.so extensions/functions/echo/echo.go
-            go build -modfile extensions.mod --buildmode=plugin -o plugins/functions/CountPlusOne@v1.0.0.so extensions/functions/countPlusOne/countPlusOne.go
-            go build -modfile extensions.mod --buildmode=plugin -o plugins/functions/AccumulateWordCount@v1.0.0.so extensions/functions/accumulateWordCount/accumulateWordCount.go
-            mkdir -p plugins/portable/mirror
-            cd sdk/go/example/mirror
-            go build -o ../../../../plugins/portable/mirror/mirror .
-            cp mirror.json ../../../../plugins/portable/mirror
-            cd ../../../../
-            cp -r sdk/python/example/pysam plugins/portable/pysam
-            cp -r sdk/python/ekuiper plugins/portable/pysam/
-            go test --tags="edgex test" ./...
-        - uses: actions/upload-artifact@v1
-          if: failure()
-          with:
-            name: stream.log
-            path: log/stream.log
+    steps:
+    - uses: actions/checkout@v2
+    - uses: actions/setup-go@v2
+      with:
+        go-version: '1.15.1'
+    - uses: actions/setup-python@v2
+      with:
+        python-version: '3.x'
+        architecture: 'x64'
+    - run: pip3 install pynng
+    - name: run code static check
+      run : |
+        if [ ! -z "$(gofmt -l .)" ];then
+          echo "code static check error"
+          gofmt -l .
+          exit 1
+        fi
+    - name: install lib
+      run: sudo apt-get update && sudo apt-get install libzmq3-dev -y
+    - name: run test case
+      run: |
+        set -e -u -x
+        mkdir -p data
+        mkdir -p log
+        sed -i -r "s/debug: .*/debug: true/1" etc/kuiper.yaml
+        go build -modfile extensions.mod --buildmode=plugin -o plugins/sources/Random@v2.0.0.so extensions/sources/random/random.go
+        go build -modfile extensions.mod --buildmode=plugin -o plugins/sinks/File@v1.0.0.so extensions/sinks/file/file.go
+        go build -modfile extensions.mod --buildmode=plugin -o plugins/functions/Echo.so extensions/functions/echo/echo.go
+        go build -modfile extensions.mod --buildmode=plugin -o plugins/functions/CountPlusOne@v1.0.0.so extensions/functions/countPlusOne/countPlusOne.go
+        go build -modfile extensions.mod --buildmode=plugin -o plugins/functions/AccumulateWordCount@v1.0.0.so extensions/functions/accumulateWordCount/accumulateWordCount.go
+        mkdir -p plugins/portable/mirror
+        cd sdk/go/example/mirror
+        go build -o ../../../../plugins/portable/mirror/mirror .
+        cp mirror.json ../../../../plugins/portable/mirror
+        cd ../../../../
+        cp -r sdk/python/example/pysam plugins/portable/pysam
+        cp -r sdk/python/ekuiper plugins/portable/pysam/
+        go test --tags="edgex test" ./...
+    - uses: actions/upload-artifact@v1
+      if: failure()
+      with:
+        name: stream.log
+        path: log/stream.log

+ 27 - 4
.github/workflows/upload_sdk.yaml

@@ -20,7 +20,6 @@ jobs:
           architecture: 'x64'
       - run: python3 -m pip install --user --upgrade setuptools wheel twine
       - name: Upload test pypi
-        if: github.event_name != 'release'
         env:
           TWINE_USERNAME: ${{ secrets.TEST_PYPI_USERNAME }}
           TWINE_PASSWORD: ${{ secrets.TEST_PYPI_PASSWORD }}
@@ -31,14 +30,38 @@ jobs:
           sed -i -r "s|([ \t]*version=).*|\1'$test_version',|1" setup.py
           python3 setup.py sdist bdist_wheel
           python3 -m twine upload --skip-existing --repository-url https://test.pypi.org/legacy/ dist/*
-          python3 -m pip install --index-url https://test.pypi.org/simple/ --no-deps ekuiper=="${version}.post${GITHUB_RUN_ID}"
+          git checkout -- setup.py
+      - name: Install test pypi
+        working-directory: "sdk/python"
+        timeout-minutes: 1
+        run: |
+          version=$(grep -E ".+version.+" setup.py | sed -r 's [ \t]*version=(.*), \1 g' | sed $'s/\'//g')
+          while ! python3 -m pip install --index-url https://test.pypi.org/simple/ --no-deps ekuiper=="${version}.post${GITHUB_RUN_ID}" > /dev/null 2>&1; do
+            echo "================================================================="
+            echo "Awaiting pypi updates"
+            echo "================================================================="
+            sleep 1
+          done
+          python3 -m pip uninstall -y ekuiper
       - name: Upload test pypi
-        if: github.event_name == 'release'
+        if: github.event_name == 'release' && !github.event.release.prerelease
         env:
           TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
           TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
         working-directory: "sdk/python"
         run: |
+          sed -i -r "s|([ \t]*version=).*|\1'${GITHUB_REF#refs/tags/}',|1" setup.py
           python3 setup.py sdist bdist_wheel
           python3 -m twine upload --skip-existing dist/*
-          python3 -m pip install --no-deps ekuiper
+      - name: Install pypi
+        if: github.event_name == 'release' && !github.event.release.prerelease
+        working-directory: "sdk/python"
+        timeout-minutes: 5
+        run: |
+          while ! python3 -m pip install --no-deps ekuiper > /dev/null 2>&1; do
+            echo "================================================================="
+            echo "Awaiting pypi updates"
+            echo "================================================================="
+            sleep 1
+          done
+          python3 -m pip uninstall -y ekuiper

+ 0 - 20
Makefile

@@ -75,26 +75,6 @@ docker:
 	docker buildx build --no-cache --platform=linux/amd64 -t $(TARGET):$(VERSION)-slim -f deploy/docker/Dockerfile-slim . --load
 	docker buildx build --no-cache --platform=linux/amd64 -t $(TARGET):$(VERSION)-alpine -f deploy/docker/Dockerfile-alpine . --load
 
-.PHONY:cross_docker
-cross_docker: cross_prepare
-	docker buildx build --no-cache \
-	--platform=linux/amd64,linux/arm64,linux/arm/v7,linux/386 \
-	-t $(TARGET):$(VERSION) \
-	-f deploy/docker/Dockerfile . \
-	--push
-
-	docker buildx build --no-cache \
-	--platform=linux/amd64,linux/arm64,linux/arm/v7,linux/386 \
-	-t $(TARGET):$(VERSION)-slim \
-	-f deploy/docker/Dockerfile-slim . \
-	--push
-
-	docker buildx build --no-cache \
-	--platform=linux/amd64,linux/arm64,linux/arm/v7,linux/386 \
-	-t $(TARGET):$(VERSION)-alpine \
-	-f deploy/docker/Dockerfile-alpine . \
-	--push
-
 PLUGINS := sinks/file \
 	sinks/influx \
 	sinks/zmq \