Expand one logical job into multiple combinations.
Section: Reuse pipeline logic
GitLab matrix variables
yaml
yaml
test:
stage: test
parallel:
matrix:
- NODE_VERSION: ["18", "20", "22"]
image: node:${NODE_VERSION}
script:
- npm ci
- npm testExplanation
GitLab supports matrix-style expansion for parameterized jobs.
Learn the surrounding workflow
Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.
Related commands
Same sheet · prioritizing Reuse pipeline logic
GitHub Actions test matrix
Run the same job across multiple Node versions.
GitHub reusable workflow
Call a shared workflow from another repository or workflow file.
GitLab cache vs artifacts
Use cache for dependencies and artifacts for outputs.
Cache npm dependencies in GitHub Actions
Reuse package manager downloads between runs.