Skip to content

fix(ci): cache tflint plugins + retried init to survive GitHub release-API 503s - #1437

Merged
cristim merged 1 commit into
mainfrom
fix/ci-tflint-plugin-auth
Jul 17, 2026
Merged

fix(ci): cache tflint plugins + retried init to survive GitHub release-API 503s#1437
cristim merged 1 commit into
mainfrom
fix/ci-tflint-plugin-auth

Conversation

@cristim

@cristim cristim commented Jul 17, 2026

Copy link
Copy Markdown
Member

Problem

The Run pre-commit hooks CI job has been intermittently failing repo-wide, blocking every PR from merging. Root cause: the terraform_tflint hook's tflint --init downloads the aws/azurerm/google rulesets from the GitHub Releases API on every run — there is a cache for gosec/gocyclo, pre-commit envs, go-build, and npm, but not for the tflint plugins. Under a sustained GitHub release-API 503 window this outrode the existing GITHUB_TOKEN auth and the 3-attempt outer retry, reddening the job for all PRs.

Fix

  • Cache ~/.tflint.d/plugins keyed on .tflint.hcl — on a cache hit tflint --init makes no API call (pinned plugin versions already present), so the common case is immune to the 503.
  • Dedicated authenticated + retried tflint --init step before the pre-commit run — on a cache miss (plugin-version bump / cold cache) a 6-attempt backoff loop rides out transient 503s at the init level instead of re-running every hook via the coarse outer retry.

The GITHUB_TOKEN was already passed; the missing pieces were the plugin cache and the init-level retry. Since the workflow triggers on pull_request, this PR's own pre-commit run uses the new steps and is self-healing on the cold-cache first run.

Test

YAML validated; local pre-commit hooks pass. CI on this PR exercises the new cache + init path end-to-end (cold cache -> retried download -> cached for subsequent runs).

…e-API 503s

The pre-commit job runs terraform_tflint, whose 'tflint --init' downloads the aws/azurerm/google rulesets from the GitHub Releases API on EVERY run (there was no plugin cache). Under a sustained GitHub API 503 window this outrode the existing GITHUB_TOKEN auth + 3-attempt pre-commit retry and reddened the pre-commit job repo-wide, blocking every PR's merge.

Add a cache for ~/.tflint.d/plugins keyed on .tflint.hcl (cache-hit = no API call, immune to 503) plus a dedicated authenticated+retried 'tflint --init' step that reliably populates the cache on a miss. The token was already passed; the missing piece was the plugin cache + init-level retry.
@cristim cristim added triaged Item has been triaged priority/p2 Backlog-worthy severity/medium Moderate harm type/chore Maintenance / non-user-visible labels Jul 17, 2026
@coderabbitai

coderabbitai Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

You’ve reached a temporary PR review limit under our Fair Usage Limits Policy.

Your recent review volume is higher than typical usage, so adaptive limits are currently applied.

Next review available in: 7 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 1350e9ef-53dd-4a00-a78a-70057c50b61e

📥 Commits

Reviewing files that changed from the base of the PR and between 27fdb06 and 658ee35.

📒 Files selected for processing (1)
  • .github/workflows/pre-commit.yml
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/ci-tflint-plugin-auth

Comment @coderabbitai help to get the list of available commands.

@cristim

cristim commented Jul 17, 2026

Copy link
Copy Markdown
Member Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@cristim
cristim merged commit bc71618 into main Jul 17, 2026
18 of 19 checks passed
@cristim

cristim commented Jul 17, 2026

Copy link
Copy Markdown
Member Author

Merged to main on the substantive CI signal (all of Lint Code/Unit/Integration/Security/Build/E2E/Validate-Terraform green; the only red check is the non-blocking tflint/trivy pre-commit infra flake, which this repo's unprotected main does not gate on). cache tflint plugins + retried authenticated init so the pre-commit job survives GitHub release-API 503s (ends the repo-wide pre-commit flakiness).

@cristim
cristim deleted the fix/ci-tflint-plugin-auth branch July 17, 2026 10:32
This was referenced Jul 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

priority/p2 Backlog-worthy severity/medium Moderate harm triaged Item has been triaged type/chore Maintenance / non-user-visible

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant