Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 39 additions & 18 deletions src/pages/docs/platform-hub/policies/schema.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 == "<ActionTemplate-ID>"
not step.Id in input.SkippedSteps
step.Enabled == true
}
```

#### Packages array

| Property | Type | Always Present | Description |
Expand All @@ -158,34 +176,37 @@ 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 |

#### Feed object

| Property | Type | Always Present | Description |
| :--- | :--- | :--- | :--- |
| Id | string | Yes | The unique identifier for the feed |
| Name | string | Yes | Display name of the feed |
| Slug | string | Yes | The URL-safe slug for the feed |
| 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
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(input.SkippedSteps) == 0
count(all_packages) == 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 == "<ActionTemplate-ID>"
not step.Id in input.SkippedSteps
step.Enabled == true
count(all_packages) > 0
every pkg in all_packages {
pkg.GitRef == "refs/heads/main"
}
}
```

#### Feed object

| Property | Type | Always Present | Description |
| :--- | :--- | :--- | :--- |
| Id | string | Yes | The unique identifier for the feed |
| Name | string | Yes | Display name of the feed |
| Slug | string | Yes | The URL-safe slug for the feed |
| 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.
Expand Down
Loading