Skip to main content

Fail CI Builds on a Severity Threshold

Use --fail-on to fail a build when findings reach a chosen severity. Learn how the flag maps to exit codes and how it complements a drift budget.

Vibgrate Docs

Vibgrate Help

This recipe uses --fail-on to fail a build when Vibgrate findings reach a severity you choose, giving you a sharp, finding-level gate. It is for teams that care about specific high-severity drift, not just an overall score.

How the gate works

The --fail-on flag tells the scan to exit non-zero when a finding at or above the given severity is present. CI treats the non-zero exit code as a failed step. The Exit Codes reference documents the exact mapping for scripting.

The command

npx @vibgrate/cli scan --fail-on error

Post-install:

vg scan --fail-on error

This fails the build when an error-severity finding exists and passes otherwise.

Severity gate vs. drift budget

Use --fail-on when a single serious finding should block a merge regardless of the overall score. Use --drift-budget when you care about the aggregate DriftScore. They are complementary, and you can run both:

vg scan --fail-on error --drift-budget 60

The build fails if either condition trips.

Making it block merges

A failing build only blocks a merge when it is a required status check. See Required status checks for drift gates.

Related

  • Gate pull requests on a drift budget for aggregate gating.
  • Exit Codes for scripting build outcomes precisely.

Related Commands