Skip to content
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

Add retry to C++ packaging step. #1527

Merged
merged 9 commits into from
Jan 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions .github/workflows/cpp-packaging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -893,3 +893,34 @@ jobs:
-s 10 \
-A ${verbose_flag}
fi


attempt_retry:
name: "attempt-retry"
needs: [trigger_integration_tests]
runs-on: ubuntu-20.04
if: ${{ failure() && !cancelled() && github.event_name == 'schedule' }}
steps:
- name: Checkout repo
uses: actions/checkout@v3
- name: Setup python
uses: actions/setup-python@v4
with:
python-version: 3.8
- name: Install python deps
run: pip install -r scripts/gha/python_requirements.txt
# The default token can't run workflows, so get an alternate token.
- name: Generate token for GitHub API
uses: tibdex/github-app-token@v1
id: generate-token
with:
app_id: ${{ secrets.WORKFLOW_TRIGGER_APP_ID }}
private_key: ${{ secrets.WORKFLOW_TRIGGER_APP_PRIVATE_KEY }}
- name: Retry failed tests
run: |
echo "::warning ::Attempting to retry failed jobs"
python scripts/gha/trigger_workflow.py -t ${{ steps.generate-token.outputs.token }} \
-w retry-test-failures.yml \
-p run_id ${{ github.run_id }} \
-s 10 \
-A
17 changes: 15 additions & 2 deletions scripts/gha/retry_test_failures.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,13 +107,26 @@ def main(argv):
# Retry all build failures that don't match a compiler error.
if not re.search(r'.*/.*:[0-9]+:[0-9]+: error:', job_logs):
should_rerun_jobs = True
# Also retry build jobs that timed out
if re.search(r'timed? ?out|network error|maximum execution time',
job_logs, re.IGNORECASE):
should_rerun_jobs = True
elif job['name'].startswith('download-'):
# If a download step failed, automatically retry.
should_rerun_jobs = True
elif job['name'].startswith('package-'):
# Retry packaging jobs that timed out
if re.search(r'timed? ?out|network error|maximum execution time',
job_logs, re.IGNORECASE):
should_rerun_jobs = True
elif job['name'].startswith('test-'):
if '-android' in job['name'] or '-ios' in job['name']:
# Mobile tests should always be retried.
should_rerun_jobs = True
else:
# Desktop tests should only retry on a network error.
if re.search(r'timed out|network error', job_logs, re.IGNORECASE):
# Desktop tests should only retry on a network error or timeout.
if re.search(r'timed? ?out|network error|maximum execution time',
job_logs, re.IGNORECASE):
should_rerun_jobs = True

if should_rerun_jobs:
Expand Down
Loading