CICD-368 · OPA policy validation
Encyclopedia · Advanced security and compliance · All snippets
Previous · CICD-367 · Next · CICD-369
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
opa test policy/
opa eval --fail --data policy/ --input tests/input.json 'count(data.release.deny) == 0' >/dev/null3. How it works
The shell predicate makes the expected state explicit and returns a nonzero status when it is not satisfied.
4. Verify the result
Prefer explicit allow assertions in CI. Run unit tests first to distinguish invalid policy from a deny decision.
Validation syntax-validated (Bash parse). Status definitions.