Microsoft Certified: DevOps Engineer ExpertDesign and implement source controlEasy
A software development team is using Azure DevOps for their source control. They have a large monorepo containing several independent microservices. Each microservice has its own build pipeline. The team wants to optimize their CI/CD process so that a build pipeline for a specific microservice is only triggered when changes are pushed to files within that microservice's directory. Which feature should they configure in their build pipelines?
- APath filters
- BPipeline resource triggers
- CBranch policies
- DScheduled triggers
Show answer & explanationAnswer & explanation
Correct answer: A. Path filters
Path filters allow you to specify which file paths within the repository should trigger a pipeline. By configuring path filters for each microservice's directory, pipelines will only run when relevant changes occur, optimizing build times and resource usage.
Why the other options are wrong
- B. Pipeline resource triggers are used to trigger a pipeline when another pipeline completes, not based on file changes within a repository.
- C. Branch policies enforce requirements for branches but do not control which specific file changes trigger a build.
- D. Scheduled triggers run pipelines at specific times, not based on code changes.
Azure DevOps Path Filters
A feature in Azure DevOps pipelines that restricts CI triggers to only run when changes are committed to specified file paths or directories.
- Used to optimize CI/CD in monorepos.
- Prevents unnecessary pipeline runs.
- Configured within the 'triggers' section of a YAML pipeline.
Memory trick: Only build the branches that *changed* in the tree.