Repository navigation
ci: auto-rerun nightly CI on failed/flaky jobs #9174
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,58 @@ | ||
| # Copyright (c) Advanced Micro Devices, Inc., or its affiliates. | ||
| # SPDX-License-Identifier: MIT | ||
|
|
||
| # Automatically re-runs the failed jobs of a watched CI run, up to a fixed | ||
| # number of attempts. This mirrors clicking "Re-run failed jobs" in the web UI: | ||
| # `gh run rerun --failed` calls the same rerun-failed-jobs API, so each retry | ||
| # lands on a fresh runner and is recorded as a new attempt on the SAME run | ||
| # (prior attempts stay visible in the run's attempt history). | ||
| # | ||
| # The retry loop is self-capping: `workflow_run` fires whenever an attempt of | ||
| # the watched run completes, so a failed attempt N triggers this workflow with | ||
| # run_attempt == N, which re-runs and produces attempt N+1, and so on until the | ||
| # run_attempt cap below is reached. | ||
| # | ||
| # Motivation: most nightly failures are infrastructure flakes (no GPU assigned, | ||
| # an overloaded/wedged machine, or a network blip during artifact fetch) rather | ||
| # than real test regressions. Those clear on a fresh runner, which a same-runner | ||
| # step retry cannot provide. | ||
| # | ||
| # NOTE: `workflow_run` always uses the copy of this file on the repository's | ||
| # default branch, and only fires for runs there. It has no effect from a PR | ||
| # branch until merged. | ||
|
|
||
| name: Auto-retry failed CI | ||
|
|
||
| on: | ||
| workflow_run: | ||
| workflows: | ||
| - "TheRock CI Nightly" | ||
| types: | ||
| - completed | ||
|
|
||
| permissions: | ||
| # Required to trigger a re-run of the watched workflow run. | ||
| actions: write | ||
| contents: read | ||
|
|
||
| jobs: | ||
| rerun-failed: | ||
| name: Rerun failed jobs | ||
| runs-on: ubuntu-24.04 | ||
| timeout-minutes: 5 | ||
| # Only genuine failures under the attempt cap. run_attempt < 4 allows up to | ||
| # 4 total attempts (the original run plus 3 auto-retries). 'cancelled' | ||
| # (concurrency / superseded runs) and 'startup_failure' are intentionally | ||
| # excluded so we never retry work that was deliberately abandoned. | ||
| if: >- | ||
| github.event.workflow_run.conclusion == 'failure' && | ||
| github.event.workflow_run.run_attempt < 4 | ||
| env: | ||
| GH_TOKEN: ${{ github.token }} | ||
| RUN_ID: ${{ github.event.workflow_run.id }} | ||
| ATTEMPT: ${{ github.event.workflow_run.run_attempt }} | ||
| steps: | ||
| - name: Re-run failed jobs | ||
| run: | | ||
| echo "Run ${RUN_ID} failed on attempt ${ATTEMPT}; re-running failed jobs on fresh runners." | ||
| gh run rerun "${RUN_ID}" --failed --repo "${{ github.repository }}" | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.