From e59e7544cf59c8f739ff138bb5bd094679f7a616 Mon Sep 17 00:00:00 2001 From: Ryan Hall Date: Thu, 14 May 2026 20:28:24 +1200 Subject: [PATCH 1/2] Add example usage for SkippedSteps and Packages array in policy schema documentation --- .../docs/platform-hub/policies/schema.md | 55 +++++++++++++------ 1 file changed, 39 insertions(+), 16 deletions(-) diff --git a/src/pages/docs/platform-hub/policies/schema.md b/src/pages/docs/platform-hub/policies/schema.md index f060d037c5..726848a80c 100644 --- a/src/pages/docs/platform-hub/policies/schema.md +++ b/src/pages/docs/platform-hub/policies/schema.md @@ -148,6 +148,24 @@ These two fields work together. A step that's skipped still appears in `Steps`, | SlugOrId | string | Yes | The slug or ID of the step or process template | | Version | string | No | The pinned version, if one is set | +**Example usage:** + +```ruby +# Check that no steps are skipped +result := {"allowed": true} if { + count(input.SkippedSteps) == 0 +} + +# Check a specific step template is present and not skipped +result := {"allowed": true} if { + some step in input.Steps + step.Source.Type == "Step Template" + step.Source.SlugOrId == "" + not step.Id in input.SkippedSteps + step.Enabled == true +} +``` + #### Packages array | Property | Type | Always Present | Description | @@ -158,6 +176,27 @@ These two fields work together. A step that's skipped still appears in `Steps`, | GitRef | string | No | The Git reference for the package. Sourced from linked Build Information | | [Feed](#feed-object) | object | No | Details of the feed the package is sourced from | +**Example usage:** + +```ruby +package packages_from_main_branch + +default result := {"allowed": false, "action": "warn"} + +all_packages := [pkg | some step in input.Steps; some pkg in step.Packages] + +result := {"allowed": true} if { + count(all_packages) == 0 +} + +result := {"allowed": true} if { + count(all_packages) > 0 + every pkg in all_packages { + pkg.GitRef == "refs/heads/main" + } +} +``` + #### Feed object | Property | Type | Always Present | Description | @@ -168,23 +207,7 @@ These two fields work together. A step that's skipped still appears in `Steps`, | Type | string | Yes | The feed type (e.g. `BuiltIn`, `Docker`) | | Uri | string | No | The configured endpoint for the feed | -**Example usage:** - -```ruby -# Check that no steps are skipped -result := {"allowed": true} if { - count(input.SkippedSteps) == 0 -} -# Check a specific step template is present and not skipped -result := {"allowed": true} if { - some step in input.Steps - step.Source.Type == "Step Template" - step.Source.SlugOrId == "" - not step.Id in input.SkippedSteps - step.Enabled == true -} -``` :::div{.hint} From 166698d04a3d5d8b001be424fe9baeb768d08388 Mon Sep 17 00:00:00 2001 From: Corey Underdown Date: Fri, 15 May 2026 09:05:59 +1000 Subject: [PATCH 2/2] Fix linting error --- src/pages/docs/platform-hub/policies/schema.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/pages/docs/platform-hub/policies/schema.md b/src/pages/docs/platform-hub/policies/schema.md index 726848a80c..b22ce825cc 100644 --- a/src/pages/docs/platform-hub/policies/schema.md +++ b/src/pages/docs/platform-hub/policies/schema.md @@ -207,8 +207,6 @@ result := {"allowed": true} if { | Type | string | Yes | The feed type (e.g. `BuiltIn`, `Docker`) | | Uri | string | No | The configured endpoint for the feed | - - :::div{.hint} See the [steps and skipping examples](/docs/platform-hub/policies/examples#check-that-a-step-isnt-skipped-in-a-deployment) for more patterns.