Skip to content

Commit

Permalink
[ISSUE apache#8544] Add a retry mechanism to the unit test pipeline (a…
Browse files Browse the repository at this point in the history
…pache#8545)

* Add a retry mechanism to the unit test pipeline
* Remove the permissions field
  • Loading branch information
chi3316 authored Aug 16, 2024
1 parent 2f482e2 commit b512ba1
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 2 deletions.
12 changes: 11 additions & 1 deletion .github/workflows/bazel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ on:
- master
- develop
- bazel

jobs:
build:
name: "bazel-compile (${{ matrix.os }})"
Expand All @@ -19,4 +20,13 @@ jobs:
- name: Build
run: bazel build --config=remote //...
- name: Run Tests
run: bazel test --config=remote //...
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 }}
11 changes: 10 additions & 1 deletion .github/workflows/maven.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,13 @@ jobs:
with:
name: jvm-crash-logs
path: /Users/runner/work/rocketmq/rocketmq/auth/hs_err_pid*.log
retention-days: 1
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 }}
18 changes: 18 additions & 0 deletions .github/workflows/rerun-workflow.yml
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit b512ba1

Please sign in to comment.