Skip to content

Commit

Permalink
Add retry to C++ packaging step. (#1527)
Browse files Browse the repository at this point in the history
* Add retry to C++ packaging step.

* Change log message slightly.

* Fix indent.

* Remove bad variable.

* Temporarily attempt retry on non-scheduled, for testing.

* Revert "Temporarily attempt retry on non-scheduled, for testing."

This reverts commit b9cfcf9.
  • Loading branch information
jonsimantov authored Jan 23, 2024
1 parent 1f2089b commit 27af7d6
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 2 deletions.
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

0 comments on commit 27af7d6

Please sign in to comment.