Skip to main content

Enforce build quality gates for prod deployments

🎯 Goal: your CI attaches coverage and vulnerability results to every build, and production deploys check them on their own. A build with at least 80% line coverage and no critical vulnerabilities deploys with nobody involved. One that falls short stops, tells the developer exactly which gate failed, and only goes out if an admin grants a recorded exception.

Introduction​

Quality standards that live in a wiki get applied when someone remembers. Standards that live in CI get applied, but only to the repositories whose pipeline someone kept up to date, and a failed check in CI doesn't stop a deploy that happens later from a different place.

Nullplatform moves the decision to where the risk is: the production deploy. Your CI reports what it measured, and the deploy reads it:

  • Your CI publishes facts, not verdicts. Each build carries its coverage and vulnerability counts as catalog metadata. The pipeline doesn't decide anything, so changing a threshold never means editing every repository
  • A checklist turns those facts into gates. Conditions evaluate the moment the deploy is requested, so the developer sees the result before anyone is asked for anything
  • Exceptions are deliberate. When a hotfix has to ship below the bar, an admin overrides the gate with a written justification. The run records that the deploy went out despite a failed gate, and who decided it

A technology template ties it together: every new application starts from a pipeline that already reports these metrics.

What you'll set up​

  • Two catalog specifications on the build entity: coverage and security
  • A technology template whose CI publishes both to every build
  • A checklist on production deploys with two blocking conditions, one informational condition, and one override
  • Automatic execution for builds that pass every gate

Prerequisites​

  • Checklists enabled in your organization (early release)
  • An environment dimension with a production value
  • Access to your GitHub organization, to create a template repository
  • One of these, depending on how you want to work:

Step 1: Declare what a build reports​

Declaring the metadata first means every build is validated against the same shape, so a typo in one pipeline fails loudly instead of quietly slipping past the gate.

/np-api create two metadata specifications for builds in my account:
"coverage", with lines.percent (number from 0 to 100, required) and an
optional report URL; and "security", with critical and high (non-negative
integers, both required) and an optional report URL.

The name of each specification is the key the build's metadata lives under, which is what the checklist reads later: build.metadata.coverage.lines.percent and build.metadata.security.critical.

βœ… Checkpoint​

Open any build in the nullplatform UI: its catalog lists the coverage and security sections, still empty.

Step 2: Make your CI report them on every build​

The metrics have to come from the pipeline, and the cheapest way to get every team's pipeline to report them is to put it in the template new applications start from.

  1. Create a namespace for your templates, for example Technology Templates, and create an application in it from the standard Any Technology template.

  2. In GitHub, mark the new repository as a template and clone it.

  3. Add two files at the root that stand in for your real scanners' output. In your own pipeline, generate them from your coverage and security tools instead:

    coverage.json

    {
    "coverage": {
    "lines": { "percent": 87 }
    }
    }

    security.json

    {
    "security": { "critical": 0, "high": 2 }
    }
  4. Replace the CI workflow so it publishes both files to the build:

    .github/workflows/ci.yml

    name: ci-nullplatform

    env:
    NULLPLATFORM_API_KEY: ${{ secrets.NULLPLATFORM_API_KEY }}

    on:
    push:
    branches:
    - main

    permissions:
    id-token: write
    contents: read
    packages: read

    jobs:
    build:
    runs-on: ubuntu-latest
    steps:
    - name: Check out code
    uses: actions/checkout@v4

    - name: Install nullplatform CLI
    run: curl https://cli.nullplatform.com/install.sh | sh

    - name: Add CLI to PATH
    run: echo "$HOME/.nullplatform/bin" >> $GITHUB_PATH

    - name: Create build on nullplatform
    run: np build start

    - name: Build Docker image
    run: docker build -t my-app .

    - name: Push Docker image
    run: np asset push --type docker-image --source my-app

    - name: Report coverage
    run: np metadata create --entity build --data "$(jq -c . coverage.json)"

    - name: Report vulnerabilities
    run: np metadata create --entity build --data "$(jq -c . security.json)"

    - name: Set the build as successful
    if: success()
    run: np build update --status successful

    - name: Set the build as failed
    if: failure() || cancelled()
    run: np build update --status failed

    The CLI finds the build from the repository and commit it runs in, so there's no build id to pass around.

  5. Push the changes.

Step 3: Register the template​

Register the repository as a technology template so developers can pick it when they create an application.

resource "nullplatform_technology_template" "golang" {
name = "Golang 1.17.9"
url = "<github_template_url>"
account = <account_id>

provider_config = {
repository = "technology-templates-golang"
}

components {
type = "language"
id = "google"
version = "1.17"
metadata = jsonencode({
"version": "1.17.9"
})
}

tags = ["golang", "backend"]
metadata = jsonencode({})
rules = jsonencode({})
}

βœ… Checkpoint​

Create an application from the template in another namespace and push a commit. When the build finishes, its catalog shows coverage.lines.percent: 87 and security.critical: 0.

Step 4: Gate production on those numbers​

Now the checklist that reads them on every production deploy:

/np-checklist create a checklist named production-quality-gates:

- A blocking condition "Line coverage at least 80%" on
build.metadata.coverage.lines.percent.
- A blocking condition "No critical vulnerabilities" on
build.metadata.security.critical equal to 0.
- An informational condition "No high vulnerabilities" on
build.metadata.security.high equal to 0, so reviewers see it without it
blocking.
- An override "Quality exception" that requires a comment and can only be
granted by an admin who isn't the requester. Its description should say
it's for urgent fixes that can't wait for the build to meet the bar.

Set execution_trigger: automatic_approval, and connect it to
deployment:create in production across my account.

What each behavior does here:

  • gate items stop the deploy when they fail. These are your non-negotiables.
  • informational reports without ever blocking. High-severity findings show up on every deploy, so reviewers and developers see the trend before you decide to make it a gate.
  • override only comes into play once a gate has failed. Granting it doesn't turn the failed gate green: the run resolves as approve_with_override, so the record keeps both facts, that the build fell short and who let it through anyway.

automatic_approval starts the deploy on its own when only conditions decided the run, which is every build that meets the bar. A deploy that needed an exception waits for the developer to press Start deployment, so the person shipping below the bar chooses the moment.

Already gating this action with a policy?

An approval action runs on a checklist or on policies, never both. If your production deployment:create action already has policies attached, the connection fails with a 409. Reach out to the nullplatform team to move it onto a checklist.

βœ… Checkpoint​

Dry-run it against both sides of the threshold, without producing a single failing build:

dry-run production-quality-gates with coverage at 72% and 0 critical
vulnerabilities, then with coverage at 91%

At 72% the coverage gate fails and the exception is available. At 91% every gate passes and the run approves on its own.

Step 5: Deploy to production​

Create a release from a build of your templated application and deploy it to a production scope. Then lower percent in coverage.json, push, and deploy the new build to see the other side.

1 / 3The build meets the bar

Both gates pass when the deploy is requested, the high-severity count is reported for context, and the deploy starts with nobody involved.

βœ… Checkpoint​

The passing build deployed on its own. The 72% build stopped with the coverage item naming the value it read, and an admin's exception let it through with the run reading approve_with_override.

Make it yours​

  • Raise the bar without touching a pipeline. Thresholds live in the checklist, not in CI. Publish a new version with 85% and every repository is held to it from the next deploy, while past runs keep the version they were judged against.
  • Promote a signal when you're ready. Run a new check as informational for a few weeks, watch how often it would have blocked, then make it a gate.
  • Apply different bars per environment. Connect the same spec to staging with an applies_when on the stricter items, so staging reports what production would enforce.
  • Add the human checks too. The PCI sign-off fits in this same spec, so one production checklist holds both kinds of guardrail.

What's next​