diff --git a/.github/workflows/deploy-with-docker.yml b/.github/workflows/deploy-with-docker.yml index 5fa7e9d741..02137648be 100644 --- a/.github/workflows/deploy-with-docker.yml +++ b/.github/workflows/deploy-with-docker.yml @@ -4,6 +4,9 @@ on: push: branches: - master + pull_request: + branches: + - master jobs: build: @@ -13,6 +16,7 @@ jobs: - uses: actions/checkout@v2 - uses: Azure/docker-login@v1 + if: ${{ github.event_name == 'push' }} with: login-server: apisixacr.azurecr.cn username: ${{ secrets.REGISTRY_USERNAME }} @@ -38,6 +42,7 @@ jobs: run: api/test/shell/docker_deploy_test.sh - name: Deploy + if: ${{ github.event_name == 'push' }} run: | docker tag dashboard:ci apisixacr.azurecr.cn/dashboard:${{ github.sha }} docker push apisixacr.azurecr.cn/dashboard:${{ github.sha }} diff --git a/api/test/shell/docker_deploy_test.sh b/api/test/shell/docker_deploy_test.sh index 27df656aca..5b0d8463a4 100755 --- a/api/test/shell/docker_deploy_test.sh +++ b/api/test/shell/docker_deploy_test.sh @@ -19,6 +19,13 @@ set -ex +# Version output +verline=$(docker logs docker-deploy_managerapi_1 | grep -E "^Version : [A-Za-z0-9\-\_\.]+") +if [ -z "$verline" ];then + echo "no Version output" + exit 1 +fi + # web page curl http://127.0.0.1:9000 code=$(curl -k -i -m 20 -o /dev/null -s -w %{http_code} http://127.0.0.1:9000) @@ -32,6 +39,7 @@ resp=$(curl http://127.0.0.1:9000/apisix/admin/user/login -X POST -d '{"username token=$(echo "${resp}" | sed 's/{/\n/g' | sed 's/,/\n/g' | grep "token" | sed 's/:/\n/g' | sed '1d' | sed 's/}//g' | sed 's/"//g') if [ -z "${token}" ]; then echo "login failed" + exit 1 fi # plugin orchestration