Skip to content

Commit 0589bab

Browse files
committed
fix(ci): wait for async snapshot delete to complete before recreate
Deleting a snapshot referenced by active sandboxes is async; the immediate create then hit 'already exists'. Poll until the name frees before creating.
1 parent ed88462 commit 0589bab

1 file changed

Lines changed: 12 additions & 2 deletions

File tree

.github/workflows/build-snapshot.yml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,19 @@ jobs:
3939
daytona login --api-key "$DAYTONA_API_KEY"
4040
- name: Build & publish snapshot
4141
run: |
42-
# Idempotent: drop the previous snapshot of this name (existing sandboxes
43-
# are unaffected — they already hold their own copy) then rebuild.
42+
# Idempotent: drop the previous snapshot of this name (existing sandboxes are
43+
# unaffected — they already hold their own copy) then rebuild. The delete is ASYNC
44+
# when the snapshot is referenced by active sandboxes, so wait for the name to free
45+
# before creating (else create fails with a name conflict). Trailing space in the grep
46+
# matches only the exact name, not e.g. cheatcode-sandbox-viewer-bundle.
4447
daytona snapshot delete cheatcode-sandbox 2>/dev/null || true
48+
for i in $(seq 1 60); do
49+
if ! daytona snapshot list 2>/dev/null | grep -q "cheatcode-sandbox "; then
50+
echo "snapshot name freed after ~$((i*5))s"
51+
break
52+
fi
53+
sleep 5
54+
done
4555
daytona snapshot create cheatcode-sandbox \
4656
-f infra/containers/sandbox/Dockerfile \
4757
-c infra/containers/sandbox \

0 commit comments

Comments
 (0)