You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/pages/docs/platform-hub/policies/schema.md
+65-1Lines changed: 65 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -28,7 +28,7 @@ The table below summarizes every top-level field available to your policies.
28
28
|[Steps](#steps)| array | Yes | All steps included in the deployment process |
29
29
|[SkippedSteps](#steps-and-skippedsteps)| array | Yes | IDs of any steps excluded from this deployment |
30
30
|[Execution](#execution)| array | Yes | Execution order and parallelism settings for each step |
31
-
| RequiresApproval | boolean | Yes | Whether the execution requires an [approval](/docs/approvals)|
31
+
|[RequiresApproval](#requiresapproval)| boolean | Yes | Whether the execution requires an [approval](/docs/approvals)|
32
32
|[Tenant](#tenant)| object |**No**| Present only for tenanted deployments |
33
33
|[Release](#release)| object |**No**| Present only for deployments (not runbook runs) |
34
34
|[Runbook](#runbook)| object |**No**| Present only for runbook runs (not deployments) |
@@ -95,6 +95,23 @@ The project group the project belongs to.
95
95
| Name | string | The display name of the project group |
96
96
| Slug | string | The URL-safe slug for the project group |
97
97
98
+
### RequiresApproval
99
+
100
+
Indicates whether an ITSM change approval is required for this deployment. Derived from the change control settings configured on the target project and environment.
101
+
102
+
**Example usage:**
103
+
104
+
```ruby
105
+
package require_change_approvals
106
+
107
+
default result := { "allowed": false }
108
+
109
+
result := {
110
+
"allowed": input.RequiresApproval,
111
+
"reason": "No ITSM change request was found attached to this deployment or runbook run. Attach an approved change request, and try again.",
112
+
}
113
+
```
114
+
98
115
### Tenant
99
116
100
117
The tenant for tenanted deployments. **This field is absent for non-tenanted deployments.** Always guard against its absence before using it.
@@ -163,6 +180,7 @@ result := {"allowed": true} if {
163
180
step.Source.SlugOrId=="<ActionTemplate-ID>"
164
181
not step.Idin input.SkippedSteps
165
182
step.Enabled==true
183
+
step.IsConditional==false
166
184
}
167
185
```
168
186
@@ -207,6 +225,52 @@ result := {"allowed": true} if {
207
225
| Type | string | Yes | The feed type (e.g. `BuiltIn`, `Docker`) |
208
226
| Uri | string | No | The configured endpoint for the feed |
209
227
228
+
**Example usage:**
229
+
230
+
```ruby
231
+
package block_cross_environment_feeds
232
+
233
+
default result := {
234
+
"allowed": true,
235
+
"reason": "All packages use feeds appropriate for the target environment.",
236
+
}
237
+
238
+
# Collect all packages across all steps
239
+
all_packages contains pkg if {
240
+
some step in input.Steps
241
+
some pkg in step.Packages
242
+
}
243
+
244
+
# Violation: dev feed used in production
245
+
violations contains msg if {
246
+
input.Environment.Slug=="prod"
247
+
some pkg in all_packages
248
+
contains(lower(pkg.Feed.Slug), "dev")
249
+
msg :=sprintf(
250
+
"Non-compliant: Step '%s' uses dev feed '%s' but is deploying to Production.",
251
+
[pkg.Id, pkg.Feed.Name],
252
+
)
253
+
}
254
+
255
+
# Violation: prod feed used in dev
256
+
violations contains msg if {
257
+
input.Environment.Slug=="dev"
258
+
some pkg in all_packages
259
+
contains(lower(pkg.Feed.Slug), "prod")
260
+
msg :=sprintf(
261
+
"Step '%s' uses prod feed '%s' but is deploying to Dev.",
262
+
[pkg.Id, pkg.Feed.Name],
263
+
)
264
+
}
265
+
266
+
result := {
267
+
"allowed": false,
268
+
"reason": concat("", violations),
269
+
} if {
270
+
count(violations) >0
271
+
}
272
+
```
273
+
210
274
:::div{.hint}
211
275
212
276
See the [steps and skipping examples](/docs/platform-hub/policies/examples#check-that-a-step-isnt-skipped-in-a-deployment) for more patterns.
0 commit comments