Skip to content

Fix orphaned CI droplets on cancelled runs#28

Merged
benvinegar merged 1 commit into
mainfrom
bentlegen/fix-droplet-cleanup
Feb 17, 2026
Merged

Fix orphaned CI droplets on cancelled runs#28
benvinegar merged 1 commit into
mainfrom
bentlegen/fix-droplet-cleanup

Conversation

@benvinegar
Copy link
Copy Markdown
Member

Problem

CI droplets leak when a GitHub Actions run is cancelled mid-create. The droplet gets created on DigitalOcean but the ID never makes it to GITHUB_OUTPUT, so the cleanup step has nothing to destroy.

Fix

  • Tag all CI droplets with baudbot-ci on creation
  • Pass the deterministic droplet name (ci-{distro}-{run_id}) to the cleanup step as a third arg
  • cmd_destroy falls back to looking up the droplet by name when no ID is available
  • Add droplet.sh list command for debugging orphans

Still needed

The 10 existing orphan droplets need to be manually destroyed. Run:

export DO_API_TOKEN=...
# These predate the baudbot-ci tag, so list all:
curl -s -H "Authorization: Bearer $DO_API_TOKEN" \
  "https://api.digitalocean.com/v2/droplets?per_page=100" \
  | python3 -c "import json,sys; [print(f'{d[\"id\"]}  {d[\"name\"]}') for d in json.load(sys.stdin)['droplets']]"
# Then destroy each:
for id in <ids>; do
  curl -s -X DELETE -H "Authorization: Bearer $DO_API_TOKEN" \
    "https://api.digitalocean.com/v2/droplets/$id"
done

The cleanup step passes the deterministic droplet name as a fallback.
If the droplet ID was never captured (e.g. run cancelled mid-create),
destroy now looks up the droplet by name via the baudbot-ci tag.

Also tags all CI droplets with baudbot-ci and adds a list command
for debugging.
@benvinegar benvinegar merged commit 17390ba into main Feb 17, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant