Skip to content

Update policies documentation for clarity and accuracy#3093

Draft
octo-ryanhall wants to merge 6 commits intomainfrom
policies-documentation-uplift
Draft

Update policies documentation for clarity and accuracy#3093
octo-ryanhall wants to merge 6 commits intomainfrom
policies-documentation-uplift

Conversation

@octo-ryanhall
Copy link
Copy Markdown
Contributor

  • Revised the overview of policies to emphasize automatic enforcement of deployment standards.
  • Clarified the input schema for policies, detailing available fields and their usage.
  • Enhanced troubleshooting section to provide clearer guidance on diagnosing common policy evaluation issues.
  • Updated examples and best practices for writing effective Rego conditions in policies.
  • Adjusted publication and activation instructions for policies to ensure proper usage.

- Revised the overview of policies to emphasize automatic enforcement of deployment standards.
- Clarified the input schema for policies, detailing available fields and their usage.
- Enhanced troubleshooting section to provide clearer guidance on diagnosing common policy evaluation issues.
- Updated examples and best practices for writing effective Rego conditions in policies.
- Adjusted publication and activation instructions for policies to ensure proper usage.
@CLAassistant
Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

Copy link
Copy Markdown
Contributor

@shaun-od shaun-od left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok looks good, I have not called out all the changes needed for certain suggestions like the code language or adding/changing the name of the Required Column in the example tables.

Once you've confirmed the policy is working as expected, switch to `"action": "block"`.

Consider a policy that will block the execution of deployments and runbook runs. By default, that policy applies to all deployments and runbook runs.
```rego
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we use ruby as the language from memory as we don't have sytanx highlighting for rego


## Guard against conditional fields

Three input fields are not always present in the input object: `Tenant`, `Release`, and `Runbook`. Referencing them without checking for their existence first will cause a policy evaluation error.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should add a link to the schema here so we don't have to keep updating this with optional properties.

Something like changing the below might be better.

Not all input fields are always present. For example, in the input object: `Tenant`, `Release`, and `Runbook` are optional and only provided when they are available. Referencing them without checking for their existence first will cause a policy evaluation error.


See [Schema for policies](its url) for the full list of available fields.

### Scope policy to a space or many spaces
**Scope** (apply to the environments where manual intervention is required):

```ruby
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok this should be ruby again so we can get some syntax highlighting


```json
input.Environment.Name = "Development"
```rego
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

change language to ruby


1. **Check the scope Rego.** The scope determines which executions the policy evaluates. Open the policy editor and review your scope Rego. Use the verbose task log on a deployment you expect to be in scope to see what input fields were passed, and check whether your scope conditions would match.

1. **Check the package name.** The package name in your scope and conditions Rego must exactly match your policy's slug. A mismatch will prevent the policy from evaluating. The slug is shown on the edit policy page.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you don't have the package name correct then linting will fail so this line is not really valid, so I think we can remove it.


#### Steps

| Property | Type | Required | Description |
Copy link
Copy Markdown
Contributor

@shaun-od shaun-od May 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should Required column be Always present

| Id | string | Yes | The unique identifier for the package reference |
| Name | string | Yes | The name of the package |
| Version | string | No | The resolved package version |
| GitRef | string | No | The Git reference the package was built from |
Copy link
Copy Markdown
Contributor

@shaun-od shaun-od May 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should make a note that the GitRef comes from any linked Build Information

| Enabled | boolean | Yes | Whether the step is enabled in the process |
| IsRequired | boolean | Yes | Whether the step has been marked as required |
| Source | object | Yes | Where the step comes from. See the Source object below |
| Packages | array | No | Packages referenced by this step |
Copy link
Copy Markdown
Contributor

@shaun-od shaun-od May 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should be notes Packages are not available for runbook runs

| Id | string | Yes | The unique identifier for the runbook |
| Name | string | Yes | The display name of the runbook |
| Snapshot | string | Yes | The snapshot name used for this run |
| GitRef | string | No | The Git reference the runbook was published from |
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should note that GitRef is only available for VCS controlled runbooks

| Id | string | Yes | The unique identifier for the release |
| Name | string | Yes | The release name |
| Version | string | Yes | The release version string |
| GitRef | string | No | The Git reference the release was created from |
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should note that GitRef is only available for VCS projects

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants