Skip to content

Commit f0186ad

Browse files
authored
Add migration docs for init/tasks policies (#1041)
* add migration docs for init/tasks policies Signed-off-by: Krzysztof Niepokojczycki <krzysztofn@spacelift.io> * rename image Signed-off-by: Krzysztof Niepokojczycki <krzysztofn@spacelift.io> * chore: remove deadlink Signed-off-by: Krzysztof Niepokojczycki <krzysztofn@spacelift.io> * chore: remove explicit headers Signed-off-by: Krzysztof Niepokojczycki <krzysztofn@spacelift.io> * chore: align self-hosted nav --------- Signed-off-by: Krzysztof Niepokojczycki <krzysztofn@spacelift.io>
1 parent fec8476 commit f0186ad

File tree

11 files changed

+1329
-29
lines changed

11 files changed

+1329
-29
lines changed

docs/assets/screenshots/Initial_commit_·_Stack_managed_by_Spacelift (1).png renamed to docs/assets/screenshots/policy-denied-initialization.png

File renamed without changes.

docs/concepts/policy/README.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@ Spacelift as a development platform is built around this concept and allows defi
1212
- **Login**: [Who gets to log in](login-policy.md) to your Spacelift account and with what level of access.
1313
- **Access**: [Who gets to access individual Stacks](stack-access-policy.md) and with what level of access. Access policies have been replaced by [space access control](../spaces/access-control.md).
1414
- **Approval**: [Who can approve or reject a run](approval-policy.md) and how a run can be approved.
15-
- **Initialization**: [Which runs and tasks can be started](run-initialization-policy.md). Initialization policies have been replaced by [approval policies](./approval-policy.md).
15+
- **Initialization**: [Which runs and tasks can be started](deprecated/run-initialization-policy.md). Initialization policies have been replaced by [approval policies](./approval-policy.md).
1616
- **Notification**: [Routing and filtering notifications](notification-policy.md).
1717
- **Plan**: [Which changes can be applied](terraform-plan-policy.md).
1818
- **Push**: [How Git push events are interpreted](push-policy/README.md).
19-
- **Task**: [Which one-off commands can be executed](task-run-policy.md). Task run policies have been replaced by [approval policies](./approval-policy.md).
19+
- **Task**: [Which one-off commands can be executed](deprecated/task-run-policy.md). Task run policies have been replaced by [approval policies](./approval-policy.md).
2020
- **Trigger**: [What happens when blocking runs terminate](trigger-policy.md). Trigger policies have been mostly replaced by [stack dependencies](../stack/stack-dependencies.md).
2121

2222
Please refer to the following table for information on what each policy types returns, and the rules available within each policy.
@@ -26,11 +26,11 @@ Please refer to the following table for information on what each policy types re
2626
| [Login](login-policy.md) | Allow or deny login, grant admin access | Positive and negative | `boolean` | `allow`, `admin`, `deny`, `deny_admin` |
2727
| [Access](stack-access-policy.md) | Grant or deny appropriate level of stack access | Positive and negative | `boolean` | `read`, `write`, `deny`, `deny_write` |
2828
| [Approval](approval-policy.md) | Who can approve or reject a run and how a run can be approved | Positive and negative | `boolean` | `approve, reject` |
29-
| [Initialization](run-initialization-policy.md) | Blocks suspicious [runs](../run/README.md) before they [start](../run/README.md#initializing) | Negative | `set<string>` | `deny` |
29+
| [Initialization](deprecated/run-initialization-policy.md) | Blocks suspicious [runs](../run/README.md) before they [start](../run/README.md#initializing) | Negative | `set<string>` | `deny` |
3030
| [Notification](notification-policy.md) | Routes and filters notifications | Positive | `map<string, any>` | `inbox`, `slack`, `webhook` |
3131
| [Plan](terraform-plan-policy.md) | Gives feedback on [runs](../run/README.md) after [planning](../run/proposed.md#planning) phase | Negative | `set<string>` | `deny`, `warn` |
3232
| [Push](push-policy/README.md) | Determines how a Git push event is interpreted | Positive and negative | `boolean` | `track`, `propose`, `ignore`, `ignore_track`, `notrigger`, `notify` |
33-
| [Task](task-run-policy.md) | Blocks suspicious [tasks](../run/task.md) from running | Negative | `set<string>` | `deny` |
33+
| [Task](deprecated/task-run-policy.md) | Blocks suspicious [tasks](../run/task.md) from running | Negative | `set<string>` | `deny` |
3434
| [Trigger](trigger-policy.md) | Selects [stacks](../stack/README.md) for which to trigger a [tracked run](../run/tracked.md) | Positive | `set<string>` | `trigger` |
3535

3636
!!! tip
@@ -103,11 +103,11 @@ Please refer to the following table for information on what each policy types re
103103
| [Login](login-policy.md) | Allow or deny login, grant admin access | Positive and negative | `boolean` | `allow`, `admin`, `deny`, `deny_admin`|
104104
| [Access](stack-access-policy.md) | Grant or deny appropriate level of stack access | Positive and negative | `boolean` | `read`, `write`, `deny`, `deny_write` |
105105
| [Approval](approval-policy.md) | Who can approve or reject a run and how a run can be approved | Positive and negative | `boolean` | `approve`, `reject` |
106-
| [Initialization](run-initialization-policy.md) | Blocks suspicious [runs](../run/README.md) before they [start](../run/README.md#initializing) | Negative | `set<string>` | `deny` |
106+
| [Initialization](deprecated/run-initialization-policy.md) | Blocks suspicious [runs](../run/README.md) before they [start](../run/README.md#initializing) | Negative | `set<string>` | `deny` |
107107
| [Notification](notification-policy.md) | Routes and filters notifications | Positive | `map<string, any>` | `inbox`, `slack`, `webhook` |
108108
| [Plan](terraform-plan-policy.md) | Gives feedback on [runs](../run/README.md) after [planning](../run/proposed.md#planning) phase | Negative | `set<string>` | `deny`, `warn` |
109109
| [Push](push-policy/README.md) | Determines how a Git push event is interpreted | Positive and negative | `boolean` | `track`, `propose`, `ignore`, `ignore_track`, `notrigger`, `notify` |
110-
| [Task](task-run-policy.md) | Blocks suspicious [tasks](../run/task.md) from running | Negative | `set<string>` | `deny` |
110+
| [Task](deprecated/task-run-policy.md) | Blocks suspicious [tasks](../run/task.md) from running | Negative | `set<string>` | `deny` |
111111
| [Trigger](trigger-policy.md) | Selects [stacks](../stack/README.md) for which to trigger a [tracked run](../run/tracked.md) | Positive | `set<string>` | `trigger` |
112112

113113
!!! tip
@@ -121,7 +121,7 @@ Please refer to the following table for information on what each policy types re
121121

122122
### Set of strings
123123

124-
The second group of policies ([initialization](run-initialization-policy.md), [plan](terraform-plan-policy.md), and [task](task-run-policy.md)) is expected to generate a [**set of strings**](https://www.openpolicyagent.org/docs/latest/policy-language/#generating-sets){: rel="nofollow"} that serve as _direct feedback_ to the user. Those rules are generally negative in that they **can only block** certain actions. Only their lack counts as an implicit success.
124+
The second group of policies ([initialization](deprecated/run-initialization-policy.md), [plan](terraform-plan-policy.md), and [task](deprecated/task-run-policy.md)) is expected to generate a [**set of strings**](https://www.openpolicyagent.org/docs/latest/policy-language/#generating-sets){: rel="nofollow"} that serve as _direct feedback_ to the user. Those rules are generally negative in that they **can only block** certain actions. Only their lack counts as an implicit success.
125125

126126
Here's a practical difference between the two types:
127127

@@ -410,7 +410,7 @@ Each of Spacelift's policies supports an additional boolean rule called `sample`
410410
sample { true }
411411
```
412412

413-
If that feels a bit simplistic, you can adjust this rule to capture only certain types of inputs. For example, in this case we only want to capture evaluations that returned in an empty list for `deny` reasons (e.g. with a [plan](terraform-plan-policy.md) or [task](task-run-policy.md) policy):
413+
If that feels a bit simplistic, you can adjust this rule to capture only certain types of inputs. For example, in this case we only want to capture evaluations that returned in an empty list for `deny` reasons (e.g. with a [plan](terraform-plan-policy.md) or [task](deprecated/task-run-policy.md) policy):
414414

415415
=== "Rego v1"
416416
```opa
@@ -446,7 +446,7 @@ Capturing all evaluations sounds tempting, but it will also be extremely messy.
446446

447447
### Policy workbench in practice
448448

449-
To show you how to work with the policy workbench, we are going to use a [task policy](task-run-policy.md) that allowlists just two tasks: an innocent `ls`, and tainting a particular resource. It also only samples successful evaluations, where the list of `deny` reasons is empty.
449+
To show you how to work with the policy workbench, we are going to use a [task policy](deprecated/task-run-policy.md) that allowlists just two tasks: an innocent `ls`, and tainting a particular resource. It also only samples successful evaluations, where the list of `deny` reasons is empty.
450450

451451
!!! info
452452
This example comes from our [test Terraform repo](https://github.com/spacelift-io/terraform-starter){: rel="nofollow"}, which gives you hands-on experience with most Spacelift functionalities within 10-15 minutes.
@@ -571,7 +571,7 @@ We can then test it in the console using `opa test` command (note the glob, whic
571571
PASS: 2/2
572572
```
573573

574-
Testing policies that provide feedback to the users is only slightly more complex. Instead of checking for boolean values, you'll be testing for set equality. Let's define a simple [run initialization policy](run-initialization-policy.md) that **denies commits** to a particular branch:
574+
Testing policies that provide feedback to the users is only slightly more complex. Instead of checking for boolean values, you'll be testing for set equality. Let's define a simple [run initialization policy](deprecated/run-initialization-policy.md) that **denies commits** to a particular branch:
575575

576576
=== "Rego v1"
577577
```opa title="deny-sandbox.rego"
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# Deprecated Policies
2+
3+
## Overview
4+
5+
Spacelift has deprecated two policy types in favor of the more powerful and flexible **approval policy**:
6+
7+
- **Initialization Policy** - Previously controlled whether runs could start
8+
- **Task Policy** - Previously controlled which task commands could be executed
9+
10+
Both have been replaced by [approval policies](../approval-policy.md), which provide:
11+
12+
- Unified control for both runs and tasks
13+
- Human review workflows with comments
14+
- Role-based approval requirements
15+
- Richer decision-making context
16+
17+
## Migration Path
18+
19+
All functionality from initialization and task policies can be replicated in approval policies, often with enhanced capabilities.
20+
21+
**[→ View the complete migration guide](./migrate-to-approval-policy.md)** with side-by-side examples and real-world use cases.
22+
23+
## Deprecated Policy Types
24+
25+
| Policy Type | What It Did | Replaced By |
26+
|-------------|-------------|-------------|
27+
| [Initialization](./run-initialization-policy.md) | Blocked runs before they started based on runtime config, branch names, or other pre-execution checks | [Approval Policy](../approval-policy.md) |
28+
| [Task](./task-run-policy.md) | Restricted which commands could be executed as tasks based on user roles or command patterns | [Approval Policy](../approval-policy.md) |
29+
30+
## Timeline
31+
32+
- **Current status**: Deprecated (still functional)
33+
- **Recommended action**: Migrate as soon as possible
34+
- **End of life**: To be announced
35+
36+
## Need Help?
37+
38+
- Review the [migration guide](./migrate-to-approval-policy.md) for detailed examples
39+
- Check our [policy examples library](https://github.com/spacelift-io/spacelift-policies-example-library){: rel="nofollow"}
40+
- Contact [Spacelift support](../../../product/support/README.md#contact-support) for migration assistance

0 commit comments

Comments
 (0)