Git File Browser

User: usernamegoeshere | Repo: platformhubrepo
← Back
self_support_exists.ocl
name = "Self-Support exists"
description = "Check that a Process Template exists when deploying to production"
violation_action = "warn"
violation_reason = "The Self-Support process template is not being used in this deployment. Please ensure that the Self-Support process template is included and not bypassed."

conditions {
    rego = <<-EOT
            package self_support_exists

            # Default: Deny all deployments
            default result := {"allowed": false}

            # Allow: If a specific Process Template is used and not bypassed
            result := {"allowed": true} if {
            	some step in input.Steps

            	# Ensure the step is derived from a Process Template
            	step.Source.Type == "Process Template"

            	# Target a specific template by its unique slug or ID
            	step.Source.SlugOrId == "self-support"

            	# Verify this specific step hasn't been added to the skipped list
            	not step.Id in input.SkippedSteps

            	# Verify the step is enabled
            	step.Enabled == true
            }
            EOT
}

scope {
    rego = <<-EOT
            package self_support_exists

            default evaluate := true

            # The following are examples of available scoping options:
            evaluate if {
            	# Scope evaluation by Environment name
            	# input.Environment.Name == "<environment-name>"
            	# Scope evaluation to Space Id
            	# input.Space.Id == "Spaces-1"
            	# Scope evaluation to multiple Spaces
                # input.Project.Slug in ["<project-slug>", "<project-slug2>"]
            }
            EOT
}