Stages, Jobs, Artifacts & Cache
Understand how GitLab pipelines are organized with stages and jobs, how artifacts move files between jobs, and how cache speeds up repeated work.
GitLab pipelines are easier to understand when you separate three related ideas: stages and jobs define the flow of work, artifacts carry important files from one job to another, and cache speeds up repeated steps such as dependency installation. Together, these features turn a single .gitlab-ci.yml file into a reliable delivery workflow.
A pipeline usually starts with a stage plan such as build, test, and deploy. Inside each stage, you define one or more jobs. Jobs are the actual units of work: run tests, compile code, scan dependencies, or publish a release. Jobs in the same stage can run in parallel, while later stages wait for earlier ones unless you use advanced dependency rules.
Once jobs begin producing output, you need to decide what should be preserved. Artifacts are for files that matter to the pipeline result: compiled apps, coverage reports, JUnit XML files, or deployment bundles. They can be downloaded in the GitLab UI and passed to later jobs.
Cache is different. It is for reusable dependencies and temporary build inputs, such as node_modules, a Python package cache, or Maven dependencies. Cache improves speed across pipeline runs, but artifacts preserve specific outputs for correctness.
Use the sub-pages below to learn each topic in depth.
| Topic | What you will learn | Link |
|---|---|---|
| Stages & Jobs | Define pipeline phases, write jobs, control execution, and run work in parallel. | Open sub-page |
| Artifacts | Save build outputs, pass files between jobs, manage report artifacts, and set expiration. | Open sub-page |
| Cache | Reuse dependencies with smart cache keys, fallback keys, and cache policies. | Open sub-page |