Compare ephemeral and long-lived static build agents.
AdvancedConceptFundamentals and Pipeline Design
Answer
Ephemeral agents (a fresh VM or pod per job) give clean, reproducible environments, no state leakage between jobs, and no leftover credentials. They scale to zero and limit blast radius if a job is compromised. The cost is cold starts and no warm caches, which you solve with remote caches or registry-based layer caches.
Static agents keep warm caches and are fast, but accumulate disk junk, drift in tool versions ("works on agent-3"), and can leak secrets or poisoned caches between builds, which is a real supply-chain risk, especially for self-hosted runners on public repos.
We run ephemeral agents (Jenkins Kubernetes plugin, GitHub ARC, GitLab Kubernetes executor) and use caches deliberately.
More on Fundamentals and Pipeline Design
What is Continuous Integration (CI)?BeginnerWhat is the difference between Continuous Delivery and Continuous Deployment?IntermediateWhat is a CI/CD pipeline and what are its stages?BeginnerWhy should a pipeline "fail fast", and how do you order stages to achieve it?IntermediateWhat makes a build reproducible, and why does it matter?AdvancedHow does your branching strategy affect CI? Compare trunk-based development with GitFlow.Intermediate