OpsTrailsDocs
Console

Deployment Policies

Deployment policies define ongoing rules for how and when deployments should happen. They are part of the operational guardrails system and work alongside change freeze windows.

Configuration

Create deployment policies from the OpsTrails console at Guardrails → Deployment Policies.

FieldTypeRequiredDescription
namestringrequiredA descriptive name for the policy
ruleTypestringrequiredThe type of rule: BLOCKED_DAYS, ALLOWED_HOURS, DAILY_CAP, COOLDOWN, ROLLBACK_RATE, or VELOCITY
configobjectrequiredRule-specific configuration (varies by ruleType — see below)
subjectsstring[]optionalLimit to specific subjects (e.g., "production"). Empty = all subjects.
sourcesstring[]optionalLimit to specific sources. Empty = all sources.
typesstring[]optionalLimit to specific event types. Empty = all matched types.
notificationChannelschannel[]optionalNotification channels to alert on violation. Email is always sent.
enabledbooleanoptionalWhether the policy is active. Defaults to true.

Rule Types

BLOCKED_DAYS

Prevent deployments on specific days of the week. Violations are triggered when an event is recorded on a blocked day.

ALLOWED_HOURS

Restrict deployments to specific hours of the day. Events outside the allowed window trigger a violation.

DAILY_CAP

Limit the number of deployments per day. A violation is triggered when the count exceeds the cap.

COOLDOWN

Enforce a minimum gap between deployments. A violation is triggered when a deployment occurs within the cooldown period of the previous one.

ROLLBACK_RATE

Alert when the ratio of rollbacks to deployments exceeds a threshold within a sliding time window.

VELOCITY

Alert on a burst of deployments within a short time window.

How Violations Work

When an event violates a deployment policy, notifications are sent to all linked channels. Email notifications are subject to a daily limit of one email per UTC day per policy to prevent inbox flooding. Other notification channels (webhooks, PagerDuty, Opsgenie, Google Chat) are not rate-limited.

📝 Note

Deployment policies are advisory — events are always recorded regardless of whether they violate a policy. Guardrails detect and notify, they do not block.

Filters

Use the optional filter fields — subjects, sources, and types — to narrow which events are evaluated against the policy. When a filter is empty, all values match. See Core Concepts for definitions of event fields.