Skip to content

Commit 44baabf

Browse files
committed
Clean up test workers to avoid Cloudflare limit.
1 parent aa296af commit 44baabf

File tree

3 files changed

+183
-0
lines changed

3 files changed

+183
-0
lines changed

.notes/justin/worklogs/2025-09-20-ci-improvements.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,3 +47,25 @@ Created `scripts/retry.sh` with 3 retry attempts and 5-second delays between ret
4747
- **Before**: 4 jobs per workflow (1 OS × 4 package managers)
4848
- **After**: 8 jobs per workflow (2 OS × 4 package managers)
4949
- Total CI jobs increased from 8 to 16 across both workflows
50+
51+
## Worker Cleanup Issue
52+
53+
Hit Cloudflare Workers limit (500 workers max) during CI runs. Error: "You have exceeded the limit of 500 Workers on your account" with test worker name like `test-project-smoke-test-defeated-cat-c6cefbc2`.
54+
55+
Need to clean up test workers with "smoke-test" in their names using Wrangler CLI.
56+
57+
### Cleanup attempts
58+
- Wrangler CLI requires specific worker names for deletion, can't list all workers easily
59+
- API access requires proper authentication tokens not available in local environment
60+
- Created cleanup script that attempts to delete workers with common test patterns
61+
- Test worker names follow pattern like: `test-project-smoke-test-defeated-cat-c6cefbc2`
62+
- Ran cleanup scripts but found no workers matching the attempted patterns
63+
- Workers may have been auto-cleaned, use different patterns, or need manual dashboard cleanup
64+
65+
### Cleanup scripts created
66+
- `scripts/cleanup-test-workers.sh`: Comprehensive cleanup with many pattern variations
67+
- `scripts/quick-cleanup.sh`: Focused cleanup with most likely patterns
68+
69+
### Manual cleanup guidance
70+
Dashboard URL: https://dash.cloudflare.com/1634a8e653b2ce7e0f7a23cca8cbd86a/workers-and-pages
71+
Look for workers containing: smoke-test, e2e-test, test-project, playground, hello-world, minimal, standard

scripts/cleanup-test-workers.sh

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
#!/bin/bash
2+
3+
# Cleanup script for test workers
4+
# This script attempts to delete workers with test-related names
5+
6+
ACCOUNT_ID="1634a8e653b2ce7e0f7a23cca8cbd86a"
7+
DELETED_COUNT=0
8+
FAILED_COUNT=0
9+
10+
echo "🧹 Cleaning up test workers..."
11+
echo "Account ID: $ACCOUNT_ID"
12+
echo ""
13+
14+
# Common test worker name patterns based on the error message
15+
# Example: test-project-smoke-test-defeated-cat-c6cefbc2
16+
test_patterns=(
17+
"test-project-smoke-test-"
18+
"smoke-test-"
19+
"e2e-test-"
20+
"playground-test-"
21+
"hello-world-"
22+
"minimal-"
23+
"standard-"
24+
)
25+
26+
# Common animal names and random suffixes used in test worker names
27+
animals=(
28+
"defeated-cat" "happy-dog" "clever-fox" "swift-bird" "brave-lion" "wise-owl"
29+
"quick-rabbit" "strong-bear" "gentle-deer" "proud-eagle" "calm-turtle"
30+
"bright-fish" "wild-wolf" "kind-sheep" "fast-horse" "small-mouse"
31+
"tall-giraffe" "big-elephant" "cute-panda" "red-fox" "blue-whale"
32+
)
33+
34+
# Common hex suffixes (8 characters)
35+
hex_suffixes=(
36+
"c6cefbc2" "a1b2c3d4" "e5f6g7h8" "i9j0k1l2" "m3n4o5p6" "q7r8s9t0"
37+
"1a2b3c4d" "5e6f7g8h" "9i0j1k2l" "3m4n5o6p" "7q8r9s0t" "1u2v3w4x"
38+
"5y6z7a8b" "9c0d1e2f" "3g4h5i6j" "7k8l9m0n" "1o2p3q4r" "5s6t7u8v"
39+
"9w0x1y2z" "3a4b5c6d" "7e8f9g0h" "1i2j3k4l" "5m6n7o8p" "9q0r1s2t"
40+
)
41+
42+
echo "Attempting to delete workers with test patterns..."
43+
echo "This may take a few minutes..."
44+
echo ""
45+
46+
# Try to delete workers with various patterns and suffixes
47+
for pattern in "${test_patterns[@]}"; do
48+
echo "🔍 Trying pattern: $pattern*"
49+
50+
for animal in "${animals[@]}"; do
51+
for hex in "${hex_suffixes[@]}"; do
52+
worker_name="${pattern}${animal}-${hex}"
53+
54+
# Try to delete the worker
55+
if CLOUDFLARE_ACCOUNT_ID="$ACCOUNT_ID" npx wrangler delete --name "$worker_name" --force >/dev/null 2>&1; then
56+
echo " ✅ Deleted: $worker_name"
57+
DELETED_COUNT=$((DELETED_COUNT + 1))
58+
else
59+
FAILED_COUNT=$((FAILED_COUNT + 1))
60+
fi
61+
62+
# Show progress every 50 attempts
63+
if [ $((($DELETED_COUNT + $FAILED_COUNT) % 50)) -eq 0 ]; then
64+
echo " 📊 Progress: $DELETED_COUNT deleted, $FAILED_COUNT not found"
65+
fi
66+
done
67+
done
68+
done
69+
70+
echo ""
71+
echo "🎯 Cleanup Summary:"
72+
echo " ✅ Workers deleted: $DELETED_COUNT"
73+
echo " ❌ Workers not found: $FAILED_COUNT"
74+
echo ""
75+
76+
if [ $DELETED_COUNT -gt 0 ]; then
77+
echo "✨ Successfully cleaned up $DELETED_COUNT test workers!"
78+
else
79+
echo "ℹ️ No test workers found with the attempted patterns."
80+
echo " You may need to manually delete workers via the Cloudflare dashboard:"
81+
echo " https://dash.cloudflare.com/1634a8e653b2ce7e0f7a23cca8cbd86a/workers-and-pages"
82+
fi

scripts/quick-cleanup.sh

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
#!/bin/bash
2+
3+
# Quick cleanup script for test workers
4+
# Focuses on the most likely patterns based on the error message
5+
6+
ACCOUNT_ID="1634a8e653b2ce7e0f7a23cca8cbd86a"
7+
DELETED_COUNT=0
8+
9+
echo "🧹 Quick cleanup of test workers..."
10+
echo ""
11+
12+
# Try the exact worker from the error message first
13+
echo "Trying exact worker from error message..."
14+
if CLOUDFLARE_ACCOUNT_ID="$ACCOUNT_ID" npx wrangler delete --name "test-project-smoke-test-defeated-cat-c6cefbc2" --force >/dev/null 2>&1; then
15+
echo " ✅ Deleted: test-project-smoke-test-defeated-cat-c6cefbc2"
16+
DELETED_COUNT=$((DELETED_COUNT + 1))
17+
else
18+
echo " ❌ Not found: test-project-smoke-test-defeated-cat-c6cefbc2"
19+
fi
20+
21+
# Try some variations of the pattern
22+
patterns=(
23+
"test-project-smoke-test-"
24+
"hello-world-smoke-test-"
25+
"minimal-smoke-test-"
26+
"standard-smoke-test-"
27+
"playground-e2e-test-"
28+
)
29+
30+
# Some realistic animal-hex combinations
31+
realistic_suffixes=(
32+
"defeated-cat-c6cefbc2"
33+
"happy-dog-a1b2c3d4"
34+
"clever-fox-e5f6g7h8"
35+
"swift-bird-i9j0k1l2"
36+
"brave-lion-m3n4o5p6"
37+
)
38+
39+
echo ""
40+
echo "Trying common test worker patterns..."
41+
42+
for pattern in "${patterns[@]}"; do
43+
echo "Pattern: $pattern*"
44+
for suffix in "${realistic_suffixes[@]}"; do
45+
worker_name="${pattern}${suffix}"
46+
if CLOUDFLARE_ACCOUNT_ID="$ACCOUNT_ID" npx wrangler delete --name "$worker_name" --force >/dev/null 2>&1; then
47+
echo " ✅ Deleted: $worker_name"
48+
DELETED_COUNT=$((DELETED_COUNT + 1))
49+
fi
50+
done
51+
done
52+
53+
echo ""
54+
echo "🎯 Quick cleanup completed: $DELETED_COUNT workers deleted"
55+
echo ""
56+
57+
if [ $DELETED_COUNT -eq 0 ]; then
58+
echo "ℹ️ No test workers found with common patterns."
59+
echo ""
60+
echo "📋 Manual cleanup options:"
61+
echo "1. Visit Cloudflare Dashboard:"
62+
echo " https://dash.cloudflare.com/$ACCOUNT_ID/workers-and-pages"
63+
echo ""
64+
echo "2. Look for workers with these patterns in their names:"
65+
echo " - smoke-test"
66+
echo " - e2e-test"
67+
echo " - test-project"
68+
echo " - playground"
69+
echo " - hello-world"
70+
echo " - minimal"
71+
echo " - standard"
72+
echo ""
73+
echo "3. Delete workers that look like temporary test deployments"
74+
echo " (usually have random animal names and hex suffixes)"
75+
else
76+
echo "✨ Cleaned up $DELETED_COUNT test workers!"
77+
echo " If you still hit the 500 worker limit, run this script again"
78+
echo " or manually clean up via the dashboard."
79+
fi

0 commit comments

Comments
 (0)