21 lines
700 B
Bash
21 lines
700 B
Bash
#!/usr/bin/env bash
|
|
# Simulate a failed deploy by sending a payload that references a missing compose path
|
|
set -euo pipefail
|
|
|
|
WEBHOOK_URL=${WEBHOOK_URL:-"https://system.cloudarix.de/api/deploy/compose/JXSdfeHdc6wBKUEiJrX_9"}
|
|
REPO=${REPO:-"org/repo"}
|
|
COMMIT=${COMMIT:-"bad-commit-sha"}
|
|
|
|
payload=$(cat <<JSON
|
|
{
|
|
"ref": "refs/heads/main",
|
|
"commits": [ { "id": "${COMMIT}", "message": "simulate failed deploy" } ],
|
|
"repository": { "full_name": "${REPO}", "clone_url": "git@gitea.example.com:${REPO}.git" },
|
|
"compose_path": "nonexistent-compose.yml"
|
|
}
|
|
JSON
|
|
)
|
|
|
|
echo "Posting simulated failing webhook to $WEBHOOK_URL"
|
|
curl -v -X POST "$WEBHOOK_URL" -H "Content-Type: application/json" -d "$payload"
|