-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest-webhook.sh
More file actions
executable file
·59 lines (49 loc) · 1.56 KB
/
test-webhook.sh
File metadata and controls
executable file
·59 lines (49 loc) · 1.56 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#!/bin/bash
# Test script for DeployDeck webhook endpoints
# Usage: ./test-webhook.sh [base_url] [secret]
BASE_URL="${1:-http://localhost:9000}"
SECRET="${2:-test-secret-123}"
echo "Testing DeployDeck at: $BASE_URL"
echo "Using secret: $SECRET"
echo ""
# Test health endpoint
echo "=== Testing Health Endpoint ==="
curl -s "$BASE_URL/api/health" | jq .
echo ""
# Test deploy endpoint (simple secret)
echo "=== Testing Deploy Endpoint (Simple Secret) ==="
curl -X POST "$BASE_URL/api/deploy/myapp" \
-H "X-DeployDeck-Secret: $SECRET" \
-H "Content-Type: application/json" \
-d '{"image": "ghcr.io/user/myapp:latest"}' \
-s | jq .
echo ""
# Test deploy endpoint with HMAC
echo "=== Testing Deploy Endpoint (HMAC Signature) ==="
BODY='{"image": "ghcr.io/user/myapp:v1.0.0"}'
SIGNATURE=$(echo -n "$BODY" | openssl dgst -sha256 -hmac "$SECRET" | awk '{print $2}')
curl -X POST "$BASE_URL/api/deploy/myapp" \
-H "X-DeployDeck-Secret: sha256=$SIGNATURE" \
-H "Content-Type: application/json" \
-d "$BODY" \
-s | jq .
echo ""
# Test list deployments
echo "=== Testing List Deployments ==="
curl -s "$BASE_URL/api/deployments" | jq .
echo ""
# Test invalid service
echo "=== Testing Invalid Service ==="
curl -X POST "$BASE_URL/api/deploy/nonexistent" \
-H "X-DeployDeck-Secret: $SECRET" \
-H "Content-Type: application/json" \
-s | jq .
echo ""
# Test invalid auth
echo "=== Testing Invalid Auth ==="
curl -X POST "$BASE_URL/api/deploy/myapp" \
-H "X-DeployDeck-Secret: wrong-secret" \
-H "Content-Type: application/json" \
-s | jq .
echo ""
echo "All tests completed!"