Repository navigation
Commit 03494c0
authored
* ci(pre-commit): auth tflint via GITHUB_TOKEN + retry transient flakes (closes #564)
The `Run pre-commit` step in `.github/workflows/pre-commit.yml`
intermittently fails because `terraform_tflint`'s `tflint --init`
downloads ruleset plugins from the GitHub Releases API anonymously,
hitting the 60-requests-per-hour per-IP limit that the runner shares
with every other workflow running on the same NAT egress. Most
recently observed on PR #696
(https://github.com/LeanerCloud/CUDly/actions/runs/26411029351).
Two-part fix:
1. Expose secrets.GITHUB_TOKEN to the step. tflint reads GITHUB_TOKEN
natively; with it set the limit jumps to 5000/hr per-token, which
matters because the token is unique per workflow run, not per IP.
This alone fixes the rate-limit class.
2. Wrap the step with nick-fields/retry@v3.0.2 (SHA-pinned per
project policy) at 3 attempts with a 90s wait. The token fix
eliminates the AWS-plugin rate-limit case; the retry handles the
residual flakes (GitHub Releases availability blips, plugin
download timeouts, etc.) so a transient failure no longer requires
a manual rerun.
Acceptance criteria from #564:
- GITHUB_TOKEN exposed to the `Run pre-commit` step
- Three consecutive `pre-commit` runs in the same hour all complete
without a tflint rate-limit failure (the retry-wrapper also catches
the residual flakes the token cannot)
* ci(pre-commit): bump job timeout to accommodate retry budget (CR #697)
CR pointed out the retry policy was ineffective: `nick-fields/retry`
uses `timeout_minutes` PER ATTEMPT (not total), so with
`max_attempts: 3` and `timeout_minutes: 15` the worst case is
~48 min, but the job-level `timeout-minutes: 15` killed any retry
before attempt 2 could start.
Fix: tune both timeouts so the retry budget fits inside the job
budget with safety margin.
- per-attempt timeout: 15 -> 10 minutes (normal pre-commit runs
take ~3-5 min, 10 is comfortable margin without inflating
hang-detection latency)
- job timeout: 15 -> 35 minutes
worst case = 3 attempts * 10 min + 2 * 90 s retry waits = 33 min,
fits in 35 min with margin
Avoids CR's suggested 50-minute job cap because that would also
delay killswitch on a genuinely hung step. 35 min is the tightest
value that still lets all 3 attempts complete.
1 parent bf46e8e commit 03494c0
1 file changed
Lines changed: 28 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
16 | | - | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
17 | 23 | | |
18 | 24 | | |
19 | 25 | | |
| |||
180 | 186 | | |
181 | 187 | | |
182 | 188 | | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
183 | 204 | | |
184 | 205 | | |
185 | | - | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
0 commit comments