Interview › Security & DevSecOps
How do you enforce that pull requests pass the quality gate before merge? [Basic]
Answer
I enforce pull-request quality gates by making the SonarQube quality gate a required status check in the source control system. The pipeline must run analysis for each PR and publish pass/fail status before merge is allowed.
Technical explanation
Branch protection in GitHub, GitLab, Bitbucket, or Azure DevOps should require the gate and prevent admin bypass except through controlled break-glass.
The gate should focus on new-code conditions so teams can adopt it without being blocked by historic debt.
Failures should include actionable links to the SonarQube issue view so developers can fix quickly.
Hands-on example
Example: create a main branch rule requiring 'SonarQube Code Analysis' and 'unit-tests'. In Jenkins, call waitForQualityGate and fail the build on non-OK status. In GitHub, require that status check before the Merge button is enabled.
Check how well your resume matches the role with our free resume checker— match score, ATS check, and the skills you're missing.
More Security & DevSecOps interview questions
- How do you handle false positives in SonarQube? [Basic]
- What is the difference between SonarQube and SonarCloud? [Basic]
- What is a SonarQube hotspot, and how is it different from a vulnerability? [Basic]
- How does SonarQube measure code coverage, and does it run your tests? [Basic]
- What is technical debt in SonarQube, and how is it estimated? [Basic]
- What is the difference between agent-based and agentless cloud security scanning? [Basic]
- What metrics does SonarQube track (coverage, duplication, code smells, bugs, vulnerabilities)? [Basic]
- How does Wiz scan a cloud environment without agents? [Basic]