Skip to content

armgit / kaneo

Public Imported from GitHub
0

⚡ Project management that doesn't become the project. Boards, Gantt charts, and GitHub integration. Self-host it or use Kaneo Cloud.

fix(sentry/alerts): declare cron SLUGS as an array

justina922c91e3e72
diff --git a/scripts/provision-sentry-alerts.sh b/scripts/provision-sentry-alerts.sh
index 62915ae69..e98a7077e 100755
--- a/scripts/provision-sentry-alerts.sh
+++ b/scripts/provision-sentry-alerts.sh
@@ -282,7 +282,9 @@ for i in $(seq 0 $((COUNT - 1))); do
DETECTOR_IDS='[]'
if [ "$HAS_SLUGS" = "true" ]; then
- SLUGS=$(echo "$ALERT" | jq -r '.detector_slugs[]')
+ # Declare as an array so ${#SLUGS[@]} works under `set -u` (accessing
+ # a scalar with array syntax aborts the script with "unbound variable").
+ mapfile -t SLUGS < <(echo "$ALERT" | jq -r '.detector_slugs[]')
RESP=$(list_monitors) || {
err "Monitor lookup failed for '$NAME'"
ERRORS=$((ERRORS + 1))
@@ -290,7 +292,7 @@ for i in $(seq 0 $((COUNT - 1))); do
}
RESOLVED=()
MISSING=()
- for slug in $SLUGS; do
+ for slug in "${SLUGS[@]}"; do
id=$(echo "$RESP" | jq -r --arg slug "$slug" \
'.[] | select(.slug == $slug) | .id' | head -n1)
if [ -z "$id" ] || [ "$id" = "null" ]; then