diff --git a/.github/workflows/integrate-cluster-cmd.yaml b/.github/workflows/integrate-cluster-cmd.yaml index f9c5839ba2..79b6416885 100644 --- a/.github/workflows/integrate-cluster-cmd.yaml +++ b/.github/workflows/integrate-cluster-cmd.yaml @@ -84,20 +84,24 @@ jobs: - name: Collect component log working-directory: ${{ env.working-directory }} - if: ${{ failure() }} # if: always() run: | docker exec tiup-cluster-control bash /tiup-cluster/tests/tiup-cluster/script/pull_log.sh /tiup-cluster/logs ls ${{ env.working-directory }} - tar czvf ${{ env.working-directory }}/logs.tar.gz ${{ env.working-directory }}/logs/ + + - name: Detect error log + working-directory: ${{ env.working-directory }} + # if: always() + run: | + bash ./tests/tiup-cluster/script/detect_error.sh ./logs/ - name: Upload component log if: ${{ failure() }} # if: always() - uses: actions/upload-artifact@v1 + uses: actions/upload-artifact@v3 with: name: component_logs - path: ${{ env.working-directory }}/logs.tar.gz + path: ${{ env.working-directory }}/logs/ - name: Output cluster debug log working-directory: ${{ env.working-directory }} diff --git a/.github/workflows/integrate-cluster-scale.yaml b/.github/workflows/integrate-cluster-scale.yaml index 3b4c3b89ba..adbdca509a 100644 --- a/.github/workflows/integrate-cluster-scale.yaml +++ b/.github/workflows/integrate-cluster-scale.yaml @@ -84,20 +84,24 @@ jobs: - name: Collect component log working-directory: ${{ env.working-directory }} - if: ${{ failure() }} # if: always() run: | docker exec tiup-cluster-control bash /tiup-cluster/tests/tiup-cluster/script/pull_log.sh /tiup-cluster/logs ls ${{ env.working-directory }} - tar czvf ${{ env.working-directory }}/logs.tar.gz ${{ env.working-directory }}/logs/ + + - name: Detect error log + working-directory: ${{ env.working-directory }} + # if: always() + run: | + bash ./tests/tiup-cluster/script/detect_error.sh ./logs/ - name: Upload component log if: ${{ failure() }} # if: always() - uses: actions/upload-artifact@v1 + uses: actions/upload-artifact@v3 with: name: cluster_logs - path: ${{ env.working-directory }}/logs.tar.gz + path: ${{ env.working-directory }}/logs/ - name: Output cluster debug log working-directory: ${{ env.working-directory }} diff --git a/tests/tiup-cluster/script/detect_error.sh b/tests/tiup-cluster/script/detect_error.sh new file mode 100755 index 0000000000..b22c02397c --- /dev/null +++ b/tests/tiup-cluster/script/detect_error.sh @@ -0,0 +1,16 @@ +#!/bin/bash +set -eu + +err_num=$(find $1 -name "*.log" -exec grep "\[ERROR\]" {} \; | wc -l) +if [ ${err_num} != "0" ]; then + echo "detect ${err_num} [ERROR] log" + exit 1 +fi + +err_num=$(find $1 -name "*stderr.log" -exec cat {} \; | wc -l) +if [ ${err_num} != "0" ]; then + echo "detect ${err_num} stderr log" + exit 1 +fi + +echo "no error log found"