Skip to content

Commit

Permalink
Add retry to C++ packaging step.
Browse files Browse the repository at this point in the history
  • Loading branch information
jonsimantov committed Jan 23, 2024
1 parent 1f2089b commit ec4f52e
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 2 deletions.
32 changes: 32 additions & 0 deletions .github/workflows/cpp-packaging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -893,3 +893,35 @@ 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:
- uses: actions/checkout@v3
with:
ref: ${{needs.check_and_prepare.outputs.github_ref}}
- name: Setup python
uses: actions/setup-python@v4
with:
python-version: ${{ env.pythonVersion }}
- 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 tests"
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
15 changes: 13 additions & 2 deletions scripts/gha/retry_test_failures.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,13 +107,24 @@ 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 not re.search(r'exceeded the maximum execution time', job_logs):
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 not re.search(r'exceeded the maximum execution time', job_logs):
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

0 comments on commit ec4f52e

Please sign in to comment.