DevOps / GitLab CI Basics Interview Questions
What are parent-child pipelines in GitLab CI/CD?
Parent-child pipelines (also called dynamic pipelines) allow a job in one pipeline (the parent) to dynamically generate and trigger another pipeline (the child). This enables modular, scalable pipelines for monorepos and complex projects.
# Parent pipeline (.gitlab-ci.yml): stages: - generate - trigger generate-child-config: stage: generate script: - generate-pipeline-config.sh > child-pipeline.yml # dynamic YAML artifacts: paths: - child-pipeline.yml trigger-child: stage: trigger trigger: include: - artifact: child-pipeline.yml job: generate-child-config strategy: depend # wait for child to complete # Or trigger from a static file: trigger-static-child: trigger: include: - local: ci/child-pipeline.yml strategy: depend # Child pipeline (ci/child-pipeline.yml): stages: - build - test build-child: stage: build script: echo "Child pipeline building..."
| Feature | Detail |
|---|---|
| strategy: depend | Parent pipeline status reflects child pipeline result |
| Dynamic config | Child YAML can be generated at runtime by the parent |
| Isolation | Child pipeline has its own stages, jobs, and variables |
| Artifacts | Child can receive artifacts from the parent job that triggered it |
| Depth limit | GitLab limits nesting to a certain depth (check current docs) |
Common monorepo use case: a parent pipeline detects which subdirectories changed, then triggers separate child pipelines for only those services - avoiding running every service's tests on every push.
More Related questions...