intermediate
GitLab CI
Use GitLab pipelines, stages, runners, artifacts, environments, and merge request gates in an integrated DevOps platform.
GitLab CI defines pipelines in `.gitlab-ci.yml` with stages, jobs, runners, artifacts, environments, and merge request rules. It is tightly integrated with GitLab repository, registry, and deployment features.
stages: [test, build, deploy]
test:
stage: test
script:
- npm ci
- npm test
deploy_staging:
stage: deploy
environment: staging
script: ./deploy.sh
only: [main]
Runners may be shared or self-hosted; isolation and secret handling differ. Includes and templates help large YAML stay maintainable.
On interviews: stages versus needs DAG, runner tags, protected variables, review apps, artifact handoff, comparison with GitHub Actions.
Common pitfalls: shared runners without isolation; secrets in unprotected variables; monolithic YAML without includes.
The trade-off is all-in-one DevOps platform versus runner operations and YAML sprawl.
Checklist:
- Use stages and needs intentionally.
- Protect variables and environments.
- Publish artifacts and environments clearly.
- Split YAML with includes when it grows.