Skip to content

CICD-369 · Conftest policy testing ​

Encyclopedia · Advanced security and compliance · All snippets

Previous · CICD-368 · Next · CICD-370

1. Where it fits ​

  • Placement CI run step.
  • Prerequisites reviewed policies, a short-lived CI identity, and synthetic or approved test inputs.
  • Platforms local-linux, github-actions, gitea-actions.

2. Copy the snippet ​

bash
conftest test manifests/*.yaml --policy policy/kubernetes
conftest verify --policy policy/kubernetes

3. How it works ​

The policy runner evaluates the supplied manifests or plan against reviewed policy code and reports violations.

4. Verify the result ​

Run positive and negative fixtures. Fail on a manifest that violates your documented constraints.

Validation syntax-validated (Bash parse). Status definitions.