How do you cache dependencies vs pass artifacts between jobs in GitLab CI?
⚡
Quick Answer
cache speeds up repeat runs by reusing directories keyed on a lockfile; artifacts hand files from one job to later stages.
Detailed Answer
cache is for reusable, non-essential data (package caches) keyed by e.g. the lockfile hash. artifacts are outputs (build results, reports) that downstream jobs depend on and that appear in the UI. Use dependencies:/needs: to control which artifacts a job pulls.
💡
Interview Tip
cache = optimization, artifacts = required outputs.
gitlab-cicacheartifacts