What do pipeline caches do, and how do they differ from artifacts?
IntermediateConceptFundamentals and Pipeline Design
Answer
A cache speeds up later runs by reusing downloaded or computed data (npm modules, Maven ~/.m2, Docker layers). It is best-effort: a miss must never change the outcome, only the speed. Keys are derived from lockfiles, for example hashFiles('**/package-lock.json').
An artifact is a specific output of one run that later jobs (or people) depend on, such as a built binary or a test report. Artifacts are guaranteed to be passed on within the pipeline; caches are not. Never put anything in a cache that the pipeline's correctness depends on.
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