Problem Statement
What file defines GitLab CI/CD pipelines?
Explanation
GitLab CI/CD pipelines are defined in .gitlab-ci.yml file stored in repository root. This YAML file contains pipeline configuration including stages, jobs, scripts, and conditions. GitLab automatically detects this file and executes the pipeline on commits, merge requests, or manual triggers. The file is version controlled with code enabling Pipeline as Code approach.
Basic .gitlab-ci.yml structure includes stages (pipeline phases), jobs (tasks within stages), and scripts (commands to execute). Example:
```yaml
stages:
- build
- test
- deploy
build_job:
stage: build
script:
- echo "Building application"
- make build
test_job:
stage: test
script:
- echo "Running tests"
- make test
```
GitLab reads .gitlab-ci.yml on each commit, validates syntax, and creates pipeline if valid. Multiple pipelines can run simultaneously for different branches. Changes to .gitlab-ci.yml immediately affect subsequent pipelines. Understanding .gitlab-ci.yml structure is fundamental to GitLab CI/CD.
