Merge requests enable collaboration
Pipelines can automatically test merge requests
Commits to a branch with a merge request cause multiple events:
Use rules to decide which jobs to run when
GitLab offers $CI_PIPELINE_SOURCE
with event name
Only run when configured using the rules
keyword
Have access to more pre-defined variables
Do not have access to protected variables
See chapter Merge requests
Pipelines often have many jobs
Rules will be repeated multiple times
Combine rules with templates to prevent repetition
.rule-only-web:
rules:
- if: $CI_PIPELINE_SOURCE == 'web'
job_name:
extends:
- .rule-only-web
#...
Write scan results into merge request
Requires Developer Edition
Wait for quality gates:
sonar-scanner -Dsonar.qualitygate.wait=true
Pipeline is executed from .gitlab-ci.yml
in the branch
Test changes to pipeline in a branch
Only available in Premium subscription