GitLab Concepts
GitLab CI/CD runs pipelines from .gitlab-ci.yml files committed to the
repository.
Core Ideas
- Pipelines are composed of stages.
- Stages contain jobs.
- Jobs run on runners.
- Runners can be shared or project-specific.
Typical Pipeline Flow
- Lint code.
- Run tests.
- Build artifacts or container images.
- Deploy to a target environment.
Example
stages:
- test
- deploy
test:
stage: test
script:
- npm ci
- npm test
deploy:
stage: deploy
script:
- ./deploy.sh
only:
- main
Practical Notes
- Keep the pipeline short and visible.
- Use artifacts for build outputs.
- Store secrets in protected CI variables, not in the repo.