AZ-400 Practice Question: Design and implement build and release pipelines
Your organization uses GitHub Flow for source control with a monorepo containing multiple microservices. Each microservice has its own build and test workflow. You need to design a CI/CD strategy that builds and tests only the services affected by a pull request to reduce build times and resource usage. You also need to ensure that all pull requests to the main branch pass required checks before merging. What should you implement?
Answer choices
Why each option matters
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
Use separate workflows for each microservice with path filters (on: pull_request paths:) so that only workflows with changed files are triggered.
GitHub Actions path filters (on: pull_request paths:) allow you to trigger workflows only when changes occur in specific directories. This ensures that only the microservices affected by a pull request are built and tested, reducing build times and resource usage. Option A is incorrect because building all services on every push is wasteful. Option B is incorrect because manual triggering via webhook comments defeats automation and is not scalable. Option C is incorrect because a matrix strategy, while useful for parallel builds, still triggers on every pull request and would build all services, not just the changed ones.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
Use a single workflow that builds and tests all microservices on every push to any branch.
Why it's wrong here
This approach triggers a full build and test of every microservice on every push to any branch, regardless of which code actually changed. That creates redundant CI runs for unrelated commits and intermediate pushes, wasting runner time and compute resources; it also lacks path filtering to scope work to affected services.
- ✗
Set up a webhook that triggers builds manually per service based on pull request comments.
Why it's wrong here
Relying on a human to type a pull request comment to kick off a webhook-based build is not true automation and does not provide reliable CI signal. GitHub cannot enforce branch protection or required status checks on comment-triggered webhooks, so the pipeline can be skipped entirely and does not gate the PR merge process consistently.
- ✗
Create a single workflow that uses a matrix strategy to build and test each microservice, and run it on every pull request.
Why it's wrong here
A matrix strategy does iterate over each microservice, but it still builds all of them on every pull request because the matrix is static unless you manually add diff-detection logic. Without conditional job execution based on changed paths, it consumes the same resources as a single large pipeline and does not take advantage of GitHub Actions' native path filters.
- ✓
Use separate workflows for each microservice with path filters (on: pull_request paths:) so that only workflows with changed files are triggered.
Why this is correct
Creating separate workflow files per microservice and using `on: pull_request: paths:` means each workflow activates only when a push or PR changes files under its configured path. This scopes builds and tests to the specific services affected by a change, reducing CI runtime and cost while still producing required status checks for the PR.
Go deeper
Related to this question
Learn chapter
Source Control Strategy Design
Key term
Branch
A branch is a pointer to a specific commit in a version control system that allows you to work on features or fixes in isolation from the main codebase.
Key term
GitHub
GitHub is a cloud-based platform for storing, tracking, and collaborating on code using Git version control.
About these practice questions
Courseiva writes every AZ-400 question from scratch — 823 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or dumps. Learn why practice questions differ from exam dumps →
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
This AZ-400 practice question is part of Courseiva's free Microsoft certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the AZ-400 exam.