What are monorepo CI strategies for handling affected changes?
Answer
In a monorepo — where multiple services or packages share one git repository — naively running all pipelines on every commit is wasteful and slow. Affected change detection determines which services were modified by a given commit and only builds/tests/deploys those. Tools: Nx (JavaScript/TypeScript monorepo tool) runs nx affected --target=test to test only packages affected by the change, including their dependents. Turborepo provides similar capabilities with distributed caching. Bazel (Google's build system) uses a fine-grained dependency graph to determine minimal rebuild scope. For Docker-based microservices in a monorepo, the pipeline can check git diff --name-only to identify changed service directories and only build those images. The tradeoff is complexity in setting up the dependency graph accurately — a missed dependency means a service that needed rebuilding was skipped.
Previous
What is environment promotion and how does it work in practice?
Next
What are DORA metrics and why do they matter for CI/CD?
More CI/CD Pipelines Questions
View all →- Intermediate What is blue-green deployment and how does it achieve zero-downtime releases?
- Intermediate What is a canary release and how does it reduce deployment risk?
- Intermediate What is a rolling deployment and how does it compare to blue-green?
- Intermediate What are feature flags and how do they integrate with CI/CD?
- Intermediate What is the testing pyramid in CI/CD and where does each test type run?