Skip to content

Commit d516fa9

Browse files
Expose additional Overmind CLI options (#15)
* Added more args to the plugin * Normalise case
1 parent bf184ce commit d516fa9

2 files changed

Lines changed: 108 additions & 2 deletions

File tree

README.md

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,12 @@ The Overmind plugin installs the Overmind CLI (and GitHub CLI) and executes one
2222
| `comment_provider` | Where `wait-for-simulation` should post comments when `post_comment=true`. Must be one of: `github`, `gitlab`. | No |
2323
| `on_failure` | Behavior when the plugin step errors. `fail` (default) fails the step and blocks the deployment; `pass` allows the deployment to continue even if this step errors. Must be one of: `fail`, `pass`. | No |
2424
| `skip_after_approval` | When `true` (default), `submit-plan` exits early once a deployment has been approved (`ENV0_REVIEWER_NAME` is set), avoiding duplicate analysis from the post-approval re-plan. Set to `false` to submit on every plan. | No |
25+
| `timeout` | Wall-clock time limit for the entire Overmind CLI invocation after login, including any polling for analysis or snapshot completion (e.g. `45m`). Accepts any Go duration string. Defaults to the CLI default of `31m`. Must be longer than the expected analysis time; the 30-minute service hard cap on analysis is separate from this value. Applies to all actions. | No |
26+
| `change_analysis_target_duration` | Soft server-side target duration for change analysis planning used with `submit-plan` (e.g. `5m`, `20m`). The blast-radius phase uses 67% of this value; the remaining 33% covers hypothesis formation. Valid range: `1m``30m`. Defaults to account-level settings. | No |
27+
| `blast_radius_link_depth` | How many relationship levels deep to traverse when calculating the blast radius (used with `submit-plan`). Larger values give a more complete picture but take longer. Defaults to account-level settings. | No |
28+
| `blast_radius_max_items` | Maximum number of resources to include in the blast radius calculation (used with `submit-plan`). Larger values give a more complete picture but take longer. Defaults to account-level settings. | No |
29+
| `risk_levels` | Comma-separated list of risk severities to include in the `wait-for-simulation` output (e.g. `high,medium`). Allowed values: `high`, `medium`, `low`. Defaults to all three. | No |
30+
| `wait_for_snapshot` | When `true`, `start-change` blocks until the pre-change snapshot is fully captured before returning. Defaults to `false` (snapshot runs in background). | No |
2531

2632
## Usage
2733

@@ -192,6 +198,53 @@ By default, if the plugin step fails (e.g. Overmind API error, missing env var,
192198

193199
Use `on_failure: pass` when the Overmind integration is optional and you do not want plugin failures to block deployments.
194200

201+
### Tuning Analysis
202+
203+
For large or complex infrastructure, you can tune how deep and how long the blast-radius analysis runs using three optional `submit-plan` inputs. These map directly to the corresponding Overmind CLI flags; see the [Overmind CLI configuration docs](https://docs.overmind.tech/cli/configuration) for full details.
204+
205+
```yaml
206+
version: 2
207+
deploy:
208+
steps:
209+
terraformPlan:
210+
after:
211+
- name: Submit Plan to Overmind
212+
use: https://github.com/overmindtech/env0-plugin
213+
inputs:
214+
action: submit-plan
215+
api_key: ${OVERMIND_API_KEY}
216+
timeout: 45m # wall-clock limit for the CLI invocation
217+
change_analysis_target_duration: 15m # server-side analysis budget (1m–30m)
218+
blast_radius_link_depth: 4 # relationship levels to traverse
219+
blast_radius_max_items: 500 # max resources in blast radius
220+
```
221+
222+
To limit which risk severities appear in the PR/MR comment, use `risk_levels` on `wait-for-simulation`:
223+
224+
```yaml
225+
- name: Post Overmind Simulation
226+
use: https://github.com/overmindtech/env0-plugin
227+
inputs:
228+
action: wait-for-simulation
229+
api_key: ${OVERMIND_API_KEY}
230+
post_comment: true
231+
comment_provider: github
232+
risk_levels: high,medium # omit low-severity risks from the comment
233+
```
234+
235+
To block `start-change` until the pre-change snapshot is fully captured before the apply proceeds:
236+
237+
```yaml
238+
terraformApply:
239+
before:
240+
- name: Mark Change Started
241+
use: https://github.com/overmindtech/env0-plugin
242+
inputs:
243+
action: start-change
244+
api_key: ${OVERMIND_API_KEY}
245+
wait_for_snapshot: true
246+
```
247+
195248
### Complete Example
196249

197250
Here's a complete example that uses the plan/change lifecycle actions:

env0.plugin.yaml

Lines changed: 55 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,24 @@ inputs:
2525
skip_after_approval:
2626
description: "When true (default), submit-plan exits early once a deployment has been approved (ENV0_REVIEWER_NAME is set), avoiding wasted resubmission of the post-approval re-plan. Set to false to submit on every plan, including the apply pipeline's re-plan."
2727
required: false
28+
timeout:
29+
description: "Wall-clock time limit for the entire Overmind CLI invocation after login, including any polling for analysis or snapshot completion (e.g. '45m'). Accepts any Go duration string. Defaults to the CLI default of 31m. Must be longer than the expected analysis time; the 30-minute service hard cap on analysis is separate from this value."
30+
required: false
31+
change_analysis_target_duration:
32+
description: "Soft server-side target duration for change analysis planning used with submit-plan (e.g. '5m', '20m'). The blast-radius phase uses 67% of this value; the remaining 33% covers hypothesis formation. Valid range: 1m–30m. Defaults to account-level settings."
33+
required: false
34+
blast_radius_link_depth:
35+
description: "How many relationship levels deep to traverse when calculating the blast radius (used with submit-plan). Larger values give a more complete picture but take longer. Defaults to account-level settings."
36+
required: false
37+
blast_radius_max_items:
38+
description: "Maximum number of resources to include in the blast radius calculation (used with submit-plan). Larger values give a more complete picture but take longer. Defaults to account-level settings."
39+
required: false
40+
risk_levels:
41+
description: "Comma-separated list of risk severities to include in the wait-for-simulation output (e.g. 'high,medium'). Allowed values: high, medium, low. Defaults to all three."
42+
required: false
43+
wait_for_snapshot:
44+
description: "When true, start-change blocks until the pre-change snapshot is fully captured before returning. Defaults to false (snapshot runs in background)."
45+
required: false
2846
run:
2947
exec: |
3048
#!/bin/sh
@@ -530,6 +548,18 @@ run:
530548
if [ -n "${DIFF_FILE}" ]; then
531549
set -- "$@" --code-changes-diff "${DIFF_FILE}"
532550
fi
551+
if [ -n "${inputs.change_analysis_target_duration}" ]; then
552+
set -- "$@" --change-analysis-target-duration "${inputs.change_analysis_target_duration}"
553+
fi
554+
if [ -n "${inputs.blast_radius_link_depth}" ]; then
555+
set -- "$@" --blast-radius-link-depth "${inputs.blast_radius_link_depth}"
556+
fi
557+
if [ -n "${inputs.blast_radius_max_items}" ]; then
558+
set -- "$@" --blast-radius-max-items "${inputs.blast_radius_max_items}"
559+
fi
560+
if [ -n "${inputs.timeout}" ]; then
561+
set -- "$@" --timeout "${inputs.timeout}"
562+
fi
533563
"$@"
534564
535565
# Clean up diff file if created
@@ -539,13 +569,30 @@ run:
539569
;;
540570
start-change)
541571
echo "Starting change in Overmind..."
542-
"${INSTALL_DIR}/overmind" changes start-change \
572+
set -- "${INSTALL_DIR}/overmind" changes start-change \
543573
--ticket-link "${ticket_link}"
574+
if [ -n "${inputs.app}" ]; then
575+
set -- "$@" --app "${inputs.app}"
576+
fi
577+
if [ "$(echo "${inputs.wait_for_snapshot}" | tr '[:upper:]' '[:lower:]')" = "true" ]; then
578+
set -- "$@" --wait-for-snapshot
579+
fi
580+
if [ -n "${inputs.timeout}" ]; then
581+
set -- "$@" --timeout "${inputs.timeout}"
582+
fi
583+
"$@"
544584
;;
545585
end-change)
546586
echo "Ending change in Overmind..."
547-
"${INSTALL_DIR}/overmind" changes end-change \
587+
set -- "${INSTALL_DIR}/overmind" changes end-change \
548588
--ticket-link "${ticket_link}"
589+
if [ -n "${inputs.app}" ]; then
590+
set -- "$@" --app "${inputs.app}"
591+
fi
592+
if [ -n "${inputs.timeout}" ]; then
593+
set -- "$@" --timeout "${inputs.timeout}"
594+
fi
595+
"$@"
549596
;;
550597
wait-for-simulation)
551598
echo "Waiting for Overmind simulation and commenting on PR/MR..."
@@ -574,6 +621,12 @@ run:
574621
if [ -n "${inputs.app}" ]; then
575622
set -- "$@" --app "${inputs.app}"
576623
fi
624+
if [ -n "${inputs.risk_levels}" ]; then
625+
set -- "$@" --risk-levels "${inputs.risk_levels}"
626+
fi
627+
if [ -n "${inputs.timeout}" ]; then
628+
set -- "$@" --timeout "${inputs.timeout}"
629+
fi
577630
if ! "$@" > "${MARKDOWN_FILE}"; then
578631
echo "Error: Failed to retrieve change markdown from Overmind"
579632
exit 1

0 commit comments

Comments
 (0)