Commit Graph
2 Commits
Author SHA1 Message Date
Bobby Ho eb87132790 test: stop Terraform tests from downloading providers that should be cached (#32146)
fix(test): avoid unnecessary Terraform provider downloads in CI

Fix Terraform provider download flakes caused by GitHub 500/504 errors by improving provider cache reuse and CI cache uploads.

- **Fix provider cache misses:** Use a stable providers-only configuration in `TestWorkspaceTemplateParamsChange` instead of a template containing a temporary path.
- **Update CI cache keys:** Include a hash of cache entry names so new providers are cached immediately after a successful `main` run, rather than waiting for the next day.
- **Reduce cache growth:** Avoid approximately 13 MB of redundant cache data per job per day.
- **Preserve existing behavior:** Failed jobs do not save caches, and cache restore and retry behavior remain unchanged.

**Validation:**
- Confirmed repeated test runs reuse cached providers without creating new cache directories.
- Verified Terraform tests pass with network access blocked after the cache is populated.
- Confirmed cache keys remain stable when entries are unchanged and update when entries change.
- All affected tests and `make lint/actions/actionlint` pass.

**Note:** The CI upload action runs only on `main` and requires post-merge verification.

Refs: https://linear.app/codercom/issue/CORE-40/flake-gen-terraform-provider-download-failure-context-deadline
2026-11-13 11:40:07 -07:00
Hugo Dutka b47d54d777 chore: cache terraform providers between CI test runs (#17373)
Addresses https://github.com/coder/internal/issues/322.

This PR starts caching Terraform providers used by `TestProvision` in
`provisioner/terraform/provision_test.go`. The goal is to improve the
reliability of this test by cutting down on the number of network calls
to external services. It leverages GitHub Actions cache, which [on depot
runners is persisted for 14 days by
default](https://depot.dev/docs/github-actions/overview#cache-retention-policy).

Other than the aforementioned `TestProvision`, I couldn't find any other
tests which depend on external terraform providers.
2025-04-28 10:57:24 +02:00