Compliance policies for evaluating Jira projects and issues in the Continuous Compliance Framework.
These policies evaluate various aspects of Jira project governance, including:
- Project configuration and leadership
- Change request workflows and approvals
- Development and deployment practices
- SLA compliance
- Audit trail requirements
The policies recognize the following change request types:
Change RequestChangeCRRequest a change
- jira_project_has_lead - Ensures projects have an active project lead
- jira_project_has_issue_types - Validates project has required issue types configured
- jira_issue_has_approval - Requires change requests to have at least one approved approval
- jira_issue_approval_not_self - Prevents self-approval (separation of duties)
- jira_issue_has_changelog - Ensures issues have audit trail entries
- jira_issue_has_required_fields - Validates required fields are populated
- jira_issue_has_linked_pr - Requires change requests to have linked pull requests
- jira_issue_pr_merged_before_done - Ensures PRs are merged before issues are marked done
- jira_issue_deployment_successful - Validates deployments are in successful state
- jira_issue_sla_not_breached - Checks SLA compliance
Policies expect a project-centric data structure:
{
"projects": [
{
"project": {
"id": "123",
"key": "PROJ",
"name": "Project Name",
"lead": {
"accountId": "user-123",
"displayName": "John Doe",
"active": true
}
},
"issues": [
{
"key": "PROJ-123",
"fields": {
"issuetype": {"name": "Change Request"},
"status": {"name": "In Progress"},
"reporter": {"displayName": "Jane Smith"}
},
"approvals": [...],
"dev_info": {...},
"deployments": [...],
"slas": [...],
"changelog": {...}
}
],
"workflows": [...],
"issue_types": [...]
}
]
}Run all tests:
opa test policies/Run tests with verbose output:
opa test policies/ -vRun specific test file:
opa test policies/jira_project_has_lead_test.regoPolicies are built into a bundle for distribution:
make buildThis creates a bundle.tar.gz file containing all policies.
Policies are written in Rego language.
Each policy file should:
- Define
titleanddescriptionfields - Implement a
violationrule that returns violation details - Include helper functions for clarity
- Have a corresponding test file
package compliance_framework.example_policy
import future.keywords.if
title := "Example Policy"
description := "Description of what this policy checks"
violation[{"remarks": remarks}] if {
project := input.projects[_]
issue := project.issues[_]
# Policy logic here
remarks := sprintf("Issue %s violates policy", [issue.key])
}Create a test file with _test.rego suffix:
test_example_violation if {
inp := {"projects": [...]} # Test data
violations := policy.violation with input as inp
count(violations) == 1
}- Empty issues arrays are treated as "no issues to check" (no violations)
- Missing
dev_infoordeploymentsfor change requests triggers violations - Self-approval is flagged when reporter appears in approvers list, regardless of decision
- SLA breaches are detected via
sla.ongoingCycle.breachedfield