Q: A developer pushed directly to the `main` branch and broke production. How do you prevent this?
Branch protection rules (GitHub/GitLab):
#CI/CD #GitOps & Deployment Strategies #L2 #DevOps #Automation #Pipelines
🎙️ Candidate Opening & Architectural Context
""During a high-stakes release, we hit a similar deployment challenge and resolved it with automated safeguards. When addressing this question, I walk the interviewer through our production incident runbook: isolating the blast radius, checking diagnostic logs and metrics, and applying a safe fix.""
Advertisement
🛠️ Production Runbook & Step-by-Step Resolution
1️⃣
Initial Diagnostics & Root Cause Analysis
Branch protection rules (GitHub/GitLab):
- Require pull requests — no direct pushes to main. All changes must go through a PR.
- Require approvals — at least 1 (or 2) reviewers must approve before merge.
- Require status checks — CI must pass before merge is allowed.
2️⃣
Remediation & Permanent Safeguards
Even for small teams: enforce PRs. It takes 10 minutes to set up branch protection and can prevent hours of incident recovery.
- Require linear history — no merge commits allowed, must rebase. Keeps history clean.
- Restrict who can push — only CI service accounts can push to protected branches.
💡 The Senior SRE Gold Nugget (Key Architectural Takeaway)
"Pro-Tip: Require pull requests — no direct pushes to main. All changes must go through a PR.."
⚡ 60-Second Elevator Pitch Talking Points
- Require pull requests — no direct pushes to main. All changes must go through a PR.
- Require approvals — at least 1 (or 2) reviewers must approve before merge.
- Require status checks — CI must pass before merge is allowed.
Advertisement