GitLab CI/CD
Pipelines are defined in .gitlab-ci.yml.
Structure
stages: [build, test, deploy]- Declare ordered stages
build-job:- A job name
stage: build- Assign job to a stage
script: - make- Commands to run
image: node:22- Container for the job
Control
rules: - if: $CI_COMMIT_BRANCH == "main"- Run conditionally
only: [tags]- Restrict to tags
needs: [build-job]- DAG dependency
when: manual- Require a click
Artifacts & cache
artifacts: paths: [dist/]- Pass files downstream
cache: paths: [node_modules/]- Cache between runs
$CI_COMMIT_SHA- Predefined variable