Skip to content
Merged
Show file tree
Hide file tree
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
2 changes: 2 additions & 0 deletions acceptance/bundle/deployment/bind/alert/output.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,5 @@ Resources:
my_alert:
Name: test-alert
URL: (not deployed)

>>> [CLI] alerts-v2 trash-alert [ALERT_ID] --purge
8 changes: 8 additions & 0 deletions acceptance/bundle/deployment/bind/alert/script
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@ envsubst < alert.json.tmpl > alert.json

alert_id=$(trace $CLI alerts-v2 create-alert --json @alert.json | jq -r '.id')
add_repl "$alert_id" ALERT_ID

# Unbind leaves the alert in place; purge it so leaked alerts do not exhaust the
# workspace quota for alerts.
cleanup() {
trace $CLI alerts-v2 trash-alert $alert_id --purge
}
trap cleanup EXIT

trace $CLI bundle deployment bind my_alert $alert_id --auto-approve
trace $CLI bundle summary

Expand Down
2 changes: 2 additions & 0 deletions acceptance/bundle/generate/alert/output.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,6 @@ include:
- out/resource/*.yml


>>> [CLI] alerts-v2 trash-alert [ALERT_ID] --purge

>>> [CLI] workspace delete /Workspace/Users/[USERNAME]/test-[UNIQUE_NAME] --recursive
7 changes: 7 additions & 0 deletions acceptance/bundle/generate/alert/script
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,11 @@ alert_id=$($CLI alerts-v2 create-alert --json @alert.json | jq -r '.id')
add_repl "$alert_id" ALERT_ID
rm alert.json

# Purge the alert: deleting its parent dir in script.cleanup only trashes it, and a
# trashed alert is kept until purged. Leaked alerts exhaust the workspace alert quota.
Comment thread
denik marked this conversation as resolved.
Resolved
cleanup_alert() {
trace $CLI alerts-v2 trash-alert $alert_id --purge
}
trap cleanup_alert EXIT

trace $CLI bundle generate alert --existing-id $alert_id --source-dir out/alert --config-dir out/resource
Loading