Use it when configuring, checking or troubleshooting Caching in CI/CD.
Caching · CI/CD
CI/CD Caching reuses dependency or intermediate data across jobs/runs to reduce execution time, but cache identity and trust must be separated from release artifacts.
1. Caching speeds up dependency installs/builds.
2. Key on lock file hashes.
3. Don't cache secrets.
4. Cache poisoning risk from untrusted PRs — scope caches.
5. Measure hit rates.
lock hash → cache key → restore/save
Context & applicabilityCommon mistakes · platform/version boundaries
Operational reference
Fast context before you go deeper.
Verification & Troubleshooting
Start with the observed symptom, prove the nearest boundary, and move outward only when the current state is understood.
Use the operational verification above to establish the expected state.
Capture the concrete output, symptom, packet, log or counter before changing anything.
Step 1 Operational evidence path Verify boundary
Healthy evidence: Cache keys include the relevant dependency/platform context, misses remain safe, untrusted writers cannot poison protected consumers and artifacts remain independently identified.
Step 2 Verification path Verify boundary
Record pipeline/run/job, commit SHA, runner, cache/artifact key and deployment target IDs; inspect the runtime/control-plane result; then query build/test artifacts, caches and any deployed application/infrastructure state through an independent read path and compare it with the versioned intent. For CI/CD → Caching, the evidence must connect the control-plane result to build/test artifacts, caches and any deployed application/infrastructure state and explain any gap between desired, controller-reported and consumer-visible state.
Step 3 Failure modes and next checks Narrow the fault
Suspicious evidence: Broad fallback keys restore stale or attacker-controlled dependencies, or a cache is promoted as if it were an immutable release artifact.
Step 4 Where it fails Narrow the fault
Common failure classes include stale/poisoned cache, key collision, runner drift, artifact mix-up, partial matrix failure and green pipeline with bad deployment. Before retrying a mutating operation, read current target state using the stable identity pipeline/run/job, commit SHA, runner, cache/artifact key and deployment target IDs; if state is unknown, stop broad retries.
Evidence · 1 on this Topic
Expected observations and documentation recipes are reference material. Record actual output, device identity, scope and time before claiming a verified result.
- Cache hit ≠ cache correct or trusted; cache keys, restore fallback, platform/architecture and poisoning boundaries can change the effective build inputs.
- Pipeline status is execution evidence, not independent proof of target service health or business outcome.
- The exact revision, evaluated pipeline definition, effective inputs and execution worker are part of the evidence context.
- Preserve artifact identity and target read-back so validation, promotion and runtime acceptance cannot be silently conflated.
- Cache keys based on lock files — correctness
- Cache hit rate — effectiveness
- Cache not used for artefacts/secrets — safety
ReferenceWhat it is1 section · depth on demand
In depth
Caching in CI/CD stores dependencies or build outputs between pipeline runs — pip packages, Ansible collections, Terraform providers, container layers — so jobs do not download or rebuild them every time.
| Good cache key | Why |
|---|---|
Hash of the lock file (requirements.txt, .terraform.lock.hcl) | Invalidates when dependencies change |
| OS and tool version | Avoid incompatible binaries |
Caches speed up pipelines but can hide problems (a missing dependency that is only present in the cache). Rebuild without cache periodically and never cache secrets.
ReferenceWhy it matters1 section · depth on demand
Common mistakes
- Cache keys that never change, serving stale dependencies.
ReferenceImportant terms & boundaries2 sections · depth on demand
What this shows and what it does not
Cache hit ≠ cache correct or trusted; cache keys, restore fallback, platform/architecture and poisoning boundaries can change the effective build inputs.
Mechanics
CI/CD → Caching is owned at runtime by the CI/CD scheduler and runner executing jobs with caches/artifacts and external deployment targets. Its durable intent is versioned pipeline/workflow definition with dependency/cache keys, runner/tool versions and deployment policy; the stable identity contract is pipeline/run/job, commit SHA, runner, cache/artifact key and deployment target IDs. The consumer-visible target is build/test artifacts, caches and any deployed application/infrastructure state. The operating invariants are that source revision is exact, caches are keyed safely, cache hits never replace correctness checks, artifacts are traceable and external deployments are independently verified. Follow the chain of components SCM revision → pipeline scheduler → runner → cache/dependency restore → build/test → artifact/deploy → target read-back and record which layer currently owns truth. The linked authority for bounded mechanics is GitHub Docs — Dependency caching reference; documentation support is separate from observed lab/production Evidence.
Additional reference context Scope · expected state · examples · history · terminology Open only when you need the supporting context
Verification history & basis
When and against what this Topic was checked. Later text edits do not count as a new check.
Authoritative/upstream documentation reviewed for bounded claims in CI/CD > Caching. Documentation verification only; this is not observed lab or production Evidence.
Basis: https://docs.github.com/en/actions/reference/workflows-and-actions/dependency-caching · confidence 94%Terms & aliases
Hover a linked term for a quick definition; click it to open its glossary entry. Aliases are other names that find this Topic in search.
Quick lookup tables
Caching CI/CD proof-boundary map
Fast trigger/execution/artifact/promotion/target-proof boundaries for Caching.
| Boundary | Healthy evidence | Suspicious evidence |
|---|---|---|
| Trigger / evaluation | Exact commit and evaluated pipeline/inputs are known | Wrong ref, inherited rule or hidden variable changes the run |
| Execution / validation | Expected worker, jobs and tests execute with traceable context | Skips, retries, stale cache or worker drift hides the failure |
| Artifact / promotion | Immutable artifact is linked to release, approval and environment | Rebuild/mutable tag breaks provenance or approval scope |
| Target proof | Rollout plus independent readiness/acceptance confirms the intended release | Pipeline/API success is treated as runtime health |
Deep reference
Healthy vs suspicious evidence
Output interpretation
Capture at minimum repo/SHA, run/job, runner, cache key/hit, artifact digest, test result, deployment ID and final service state.