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 test
Explanation

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.
OpenIn sheetyamlsame section
GitHub reusable workflow
Call a shared workflow from another repository or workflow file.
OpenIn sheetyamlsame section
GitLab cache vs artifacts
Use cache for dependencies and artifacts for outputs.
OpenIn sheetyaml1 tag match
Cache npm dependencies in GitHub Actions
Reuse package manager downloads between runs.
Upload build artifacts
Publish files from one job for later download or deploy.