Skip to content

Commit 27af7d6

Browse files
authored
Add retry to C++ packaging step. (#1527)
* 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.
1 parent 1f2089b commit 27af7d6

File tree

2 files changed

+46
-2
lines changed

2 files changed

+46
-2
lines changed

.github/workflows/cpp-packaging.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -893,3 +893,34 @@ jobs:
893893
-s 10 \
894894
-A ${verbose_flag}
895895
fi
896+
897+
898+
attempt_retry:
899+
name: "attempt-retry"
900+
needs: [trigger_integration_tests]
901+
runs-on: ubuntu-20.04
902+
if: ${{ failure() && !cancelled() && github.event_name == 'schedule' }}
903+
steps:
904+
- name: Checkout repo
905+
uses: actions/checkout@v3
906+
- name: Setup python
907+
uses: actions/setup-python@v4
908+
with:
909+
python-version: 3.8
910+
- name: Install python deps
911+
run: pip install -r scripts/gha/python_requirements.txt
912+
# The default token can't run workflows, so get an alternate token.
913+
- name: Generate token for GitHub API
914+
uses: tibdex/github-app-token@v1
915+
id: generate-token
916+
with:
917+
app_id: ${{ secrets.WORKFLOW_TRIGGER_APP_ID }}
918+
private_key: ${{ secrets.WORKFLOW_TRIGGER_APP_PRIVATE_KEY }}
919+
- name: Retry failed tests
920+
run: |
921+
echo "::warning ::Attempting to retry failed jobs"
922+
python scripts/gha/trigger_workflow.py -t ${{ steps.generate-token.outputs.token }} \
923+
-w retry-test-failures.yml \
924+
-p run_id ${{ github.run_id }} \
925+
-s 10 \
926+
-A

scripts/gha/retry_test_failures.py

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,13 +107,26 @@ def main(argv):
107107
# Retry all build failures that don't match a compiler error.
108108
if not re.search(r'.*/.*:[0-9]+:[0-9]+: error:', job_logs):
109109
should_rerun_jobs = True
110+
# Also retry build jobs that timed out
111+
if re.search(r'timed? ?out|network error|maximum execution time',
112+
job_logs, re.IGNORECASE):
113+
should_rerun_jobs = True
114+
elif job['name'].startswith('download-'):
115+
# If a download step failed, automatically retry.
116+
should_rerun_jobs = True
117+
elif job['name'].startswith('package-'):
118+
# Retry packaging jobs that timed out
119+
if re.search(r'timed? ?out|network error|maximum execution time',
120+
job_logs, re.IGNORECASE):
121+
should_rerun_jobs = True
110122
elif job['name'].startswith('test-'):
111123
if '-android' in job['name'] or '-ios' in job['name']:
112124
# Mobile tests should always be retried.
113125
should_rerun_jobs = True
114126
else:
115-
# Desktop tests should only retry on a network error.
116-
if re.search(r'timed out|network error', job_logs, re.IGNORECASE):
127+
# Desktop tests should only retry on a network error or timeout.
128+
if re.search(r'timed? ?out|network error|maximum execution time',
129+
job_logs, re.IGNORECASE):
117130
should_rerun_jobs = True
118131

119132
if should_rerun_jobs:

0 commit comments

Comments
 (0)