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

dinglei pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/rocketmq.git


The following commit(s) were added to refs/heads/develop by this push:
     new b512ba1a28 [ISSUE #8544] Add a retry mechanism to the unit test 
pipeline (#8545)
b512ba1a28 is described below

commit b512ba1a28a2f406ea2354fbfa7deedcc05d9ac0
Author: 小陈 <[email protected]>
AuthorDate: Fri Aug 16 15:30:20 2024 +0800

    [ISSUE #8544] Add a retry mechanism to the unit test pipeline (#8545)
    
    * Add a retry mechanism to the unit test pipeline
    * Remove the permissions field
---
 .github/workflows/bazel.yml          | 12 +++++++++++-
 .github/workflows/maven.yaml         | 11 ++++++++++-
 .github/workflows/rerun-workflow.yml | 18 ++++++++++++++++++
 3 files changed, 39 insertions(+), 2 deletions(-)

diff --git a/.github/workflows/bazel.yml b/.github/workflows/bazel.yml
index af674592bb..73a49aa6a6 100644
--- a/.github/workflows/bazel.yml
+++ b/.github/workflows/bazel.yml
@@ -7,6 +7,7 @@ on:
       - master
       - develop
       - bazel
+
 jobs:
   build:
     name: "bazel-compile (${{ matrix.os }})"
@@ -19,4 +20,13 @@ jobs:
       - name: Build
         run: bazel build --config=remote //...
       - name: Run Tests
-        run: bazel test --config=remote //...
\ No newline at end of file
+        run: bazel test --config=remote //...
+      - name: Retry if failed
+        # if it failed , retry 2 times at most
+        if: failure() && fromJSON(github.run_attempt) < 3
+        env:
+          GH_REPO: ${{ github.repository }}
+          GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+        run: |
+          echo "Attempting to retry workflow..."
+          gh workflow run rerun-workflow.yml -F run_id=${{ github.run_id }}
\ No newline at end of file
diff --git a/.github/workflows/maven.yaml b/.github/workflows/maven.yaml
index 06db86e015..3291d993ea 100644
--- a/.github/workflows/maven.yaml
+++ b/.github/workflows/maven.yaml
@@ -31,4 +31,13 @@ jobs:
         with:
           name: jvm-crash-logs
           path: /Users/runner/work/rocketmq/rocketmq/auth/hs_err_pid*.log
-          retention-days: 1
\ No newline at end of file
+          retention-days: 1
+      - name: Retry if failed
+        # if it failed , retry 2 times at most
+        if: failure() && fromJSON(github.run_attempt) < 3
+        env:
+          GH_REPO: ${{ github.repository }}
+          GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+        run: |
+          echo "Attempting to retry workflow..."
+          gh workflow run rerun-workflow.yml -F run_id=${{ github.run_id }}
\ No newline at end of file
diff --git a/.github/workflows/rerun-workflow.yml 
b/.github/workflows/rerun-workflow.yml
new file mode 100644
index 0000000000..2f3258c1f6
--- /dev/null
+++ b/.github/workflows/rerun-workflow.yml
@@ -0,0 +1,18 @@
+name: Rerun workflow
+on:
+  workflow_dispatch:
+    inputs:
+      run_id:
+        required: true
+
+jobs:
+  rerun:
+    runs-on: ubuntu-latest
+    steps:
+      - name: rerun ${{ inputs.run_id }}
+        env:
+          GH_REPO: ${{ github.repository }}
+          GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+        run: |
+          gh run watch ${{ inputs.run_id }} > /dev/null 2>&1
+          gh run rerun ${{ inputs.run_id }} --failed
\ No newline at end of file

Reply via email to