A cloud architect is designing a CI/CD pipeline for a microservices application. Each service is deployed to Cloud Run. They want to use Cloud Build to automate building and deploying services only when changes occur in their respective directories. Which Cloud Build feature should they configure?
Cloud Build triggers support an included files filter, so a trigger fires only when commits touch paths matching the specified glob patterns. This satisfies the stem's requirement to build and deploy each service only when its own directory changes, avoiding unnecessary builds.
Why this answer
Build triggers with an included files filter is correct because Cloud Build triggers support an 'includedFiles' field that uses glob patterns to fire a build only when files in specified paths change. This lets a monorepo deploy each microservice independently — for example, a trigger scoped to 'services/payments/**' runs only when payment-service code is modified. This is the native, supported mechanism for path-based CI/CD in Cloud Build.
Exam trap
The trap is confusing build configuration (what runs) with trigger configuration (when it runs) — candidates pick 'includedFiles in cloudbuild.yaml' because the name sounds right, but the filter belongs on the trigger.
How to eliminate wrong answers
Option A is wrong because build steps in cloudbuild.yaml define what the build does, not when it runs — they cannot by themselves restrict execution to changes in specific directories. Option C is wrong because 'includedFiles' is a property of a build trigger, not a standalone option inside the build configuration file; placing it in cloudbuild.yaml has no effect. Option D is wrong because Artifact Registry triggers do not exist as a Cloud Build trigger type — Artifact Registry stores and scans artifacts, it does not initiate builds based on source changes.