diff --git a/.github/workflows/integrate-cluster-cmd.yaml b/.github/workflows/integrate-cluster-cmd.yaml index dfad1ab3f2..b9f7ca5b9f 100644 --- a/.github/workflows/integrate-cluster-cmd.yaml +++ b/.github/workflows/integrate-cluster-cmd.yaml @@ -64,16 +64,16 @@ jobs: - name: Collect component log working-directory: ${{ env.working-directory }} - # if: steps.test.outputs.exit_code != 0 - if: always() + if: steps.test.outputs.exit_code != 0 + # 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: Upload component log - # if: steps.test.outputs.exit_code != 0 - if: always() + if: steps.test.outputs.exit_code != 0 + # if: always() uses: actions/upload-artifact@v1 with: name: component_logs @@ -87,7 +87,7 @@ jobs: docker ps df -h free -h - "cat ./tests/*.log" || true + cat /tiup-cluster/logs/*.log || true - name: Upload coverage to Codecov working-directory: ${{ env.working-directory }} diff --git a/.github/workflows/integrate-cluster-scale.yaml b/.github/workflows/integrate-cluster-scale.yaml index c4fa90b725..29c0d60196 100644 --- a/.github/workflows/integrate-cluster-scale.yaml +++ b/.github/workflows/integrate-cluster-scale.yaml @@ -64,30 +64,31 @@ jobs: - name: Collect component log working-directory: ${{ env.working-directory }} - # if: steps.test.outputs.exit_code != 0 - if: always() + if: steps.test.outputs.exit_code != 0 + # 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: Upload component log - # if: steps.test.outputs.exit_code != 0 - if: always() + if: steps.test.outputs.exit_code != 0 + # if: always() uses: actions/upload-artifact@v1 with: - name: component_logs + name: cluster_logs path: ${{ env.working-directory }}/logs.tar.gz - name: Output cluster debug log working-directory: ${{ env.working-directory }} - if: always() + if: steps.test.outputs.exit_code != 0 + # if: always() run: | pwd docker ps df -h free -h - "cat ./tests/*.log" || true + cat /tiup-cluster/logs/*.log || true - name: Upload coverage to Codecov working-directory: ${{ env.working-directory }} diff --git a/.github/workflows/integrate-dm.yaml b/.github/workflows/integrate-dm.yaml index dd78c14056..68292a1c47 100644 --- a/.github/workflows/integrate-dm.yaml +++ b/.github/workflows/integrate-dm.yaml @@ -66,6 +66,34 @@ jobs: # ref: https://stackoverflow.com/questions/43099116/error-the-input-device-is-not-a-tty docker exec tiup-cluster-control bash /tiup-cluster/tests/tiup-dm/run.sh ${{matrix.cases}} + - name: Collect component log + working-directory: ${{ env.working-directory }} + # if: steps.test.outputs.exit_code != 0 + if: always() + run: | + docker exec tiup-cluster-control bash -c 'mkdir -p /tiup-cluster/logs; [[ -d ~/.tiup/logs ]] && find ~/.tiup/logs -type f -name "*.log" -exec cp {} /tiup-cluster/logs \; || true' + ls ${{ env.working-directory }} + tar czvf ${{ env.working-directory }}/dm.logs.tar.gz ${{ env.working-directory }}/logs/ + + - name: Upload component log + if: steps.test.outputs.exit_code != 0 + # if: always() + uses: actions/upload-artifact@v1 + with: + name: dm_logs + path: ${{ env.working-directory }}/dm.logs.tar.gz + + - name: Output cluster debug log + working-directory: ${{ env.working-directory }} + if: steps.test.outputs.exit_code != 0 + # if: always() + run: | + pwd + docker ps + df -h + free -h + cat /tiup-cluster/logs/*.log || true + - name: Upload coverage to Codecov working-directory: ${{ env.working-directory }} run: | diff --git a/.github/workflows/integrate-playground.yaml b/.github/workflows/integrate-playground.yaml index 093dcbe144..32f907d8f3 100644 --- a/.github/workflows/integrate-playground.yaml +++ b/.github/workflows/integrate-playground.yaml @@ -50,14 +50,14 @@ jobs: - name: Collect component log working-directory: ${{ env.working-directory }} - # if: steps.test.outputs.exit_code != 0 - if: always() + if: steps.test.outputs.exit_code != 0 + # if: always() run: | find ${{ env.working-directory }}/tests/tiup-playground/_tmp/home/data -type f | grep -E '*/ti.*/ti.*.log$' | xargs tar czvf ${{ env.working-directory }}/playground.logs.tar.gz - name: Upload component log - # if: steps.test.outputs.exit_code != 0 - if: always() + if: steps.test.outputs.exit_code != 0 + # if: always() uses: actions/upload-artifact@v1 with: name: playground_logs diff --git a/tests/tiup-cluster/script/pull_log.sh b/tests/tiup-cluster/script/pull_log.sh index 1025b7ff51..c8744df590 100755 --- a/tests/tiup-cluster/script/pull_log.sh +++ b/tests/tiup-cluster/script/pull_log.sh @@ -1,8 +1,6 @@ #!/bin/bash - out_dir=$1 - ipprefix=${TIUP_TEST_IP_PREFIX:-"172.19.0"} mkdir -p $out_dir @@ -13,15 +11,13 @@ do echo $h mkdir -p $out_dir/$h - if [ "$h" == "${ipprefix}.100" ] - then - logs=$(ssh -o "StrictHostKeyChecking no" root@$h "find /tiup-cluster/logs | grep '.*log/.*\.log'") + if [ "$i" == "100" ]; then + find ~/.tiup/logs -type f -name "*.log" -exec cp "{}" $out_dir/$h \; else logs=$(ssh -o "StrictHostKeyChecking no" root@$h "find /home/tidb | grep '.*log/.*\.log'") + for log in $logs + do + scp -o "StrictHostKeyChecking no" -r root@$h:$log "$out_dir/$h/" + done fi - - for log in $logs - do - scp -o "StrictHostKeyChecking no" -r root@$h:$log "$out_dir/$h/" - done done