Microsoft Certified: DevOps Engineer ExpertConfigure processes and communicationsHard

A DevOps team is managing a complex application with multiple dependencies and a stringent security policy. They are implementing a branch strategy and need to ensure that the main branch is always stable and production-ready. They want to enforce that all code changes undergo automated testing, static code analysis, and at least two peer reviews before being merged into the main branch. Additionally, they need to prevent direct commits to the main branch. Which combination of branch strategy and pull request policies would be most effective for this scenario?

  1. AGitFlow with Rebase and Merge policies
  2. BFeature Branching with required status checks and minimum reviewers
  3. CForking Workflow with Squashing Merges
  4. DTrunk-Based Development with Fast-Forward Merges
Show answer & explanation

Correct answer: B. Feature Branching with required status checks and minimum reviewers

Feature Branching naturally isolates development, preventing direct commits to `main`. Combining this with pull request policies that enforce 'required status checks' (for automated tests and static analysis) and 'minimum reviewers' (for peer reviews) ensures that all necessary quality gates are met before merging into a stable, production-ready `main` branch.

Why the other options are wrong

  • A. GitFlow is a more complex strategy with multiple long-lived branches, which can be overkill for some teams and doesn't inherently enforce the specific quality gates (automated tests, static analysis, two peer reviews) as directly as specific PR policies with Feature Branching.
  • C. Forking Workflow is primarily for open-source contributions across different repositories and wouldn't be the primary choice for internal team management of a single application's main branch, nor does it inherently enforce specific quality gates without additional policies.
  • D. Trunk-Based Development encourages direct commits to the main branch (or very short-lived branches), which contradicts the requirement to prevent direct commits and enforce extensive reviews before merging.

Branch Policies for Main Branch Stability

Rules applied to a branch (e.g., `main`) to enforce quality gates, such as required reviews, automated checks, and preventing direct commits, ensuring its stability.

  • Prevents direct commits to protected branches.
  • Mandates minimum number of reviewers for PRs.
  • Requires passing automated build/test pipelines.
  • Can enforce static code analysis results.

Memory trick: Features branch, policies protect the main.

More Configure processes and communications questions