Skip to content

fix(scripts): recognize linuxbrew volumes in the orphaned-volume cleanup sweep - #187

Merged
rfay merged 1 commit into
mainfrom
20260727_cleanup_orphan_volumes
Jul 27, 2026
Merged

fix(scripts): recognize linuxbrew volumes in the orphaned-volume cleanup sweep#187
rfay merged 1 commit into
mainfrom
20260727_cleanup_orphan_volumes

Conversation

@rfay

@rfay rfay commented Jul 27, 2026

Copy link
Copy Markdown
Member

Summary

  • The orphan-volume sweep in cleanup-deleted-workspaces.sh only matched the -dind-cache volume suffix, so an orphaned -linuxbrew volume (from an interrupted destroy, state desync, etc.) would never be flagged for cleanup.
  • Extends the matching regex to ^coder-(.+)-(dind-cache|linuxbrew)$, with an inline comment reminding future maintainers to extend the alternation for any new persistent per-workspace volume type.
  • Tightens a comment in workspace-lifecycle-cleanup.sh: volumes are removed because Terraform destroys them along with the rest of the workspace's resource graph, not by "the destroy provisioner" (a separate, narrower mechanism that only handles the host-bind-mounted /home/coder directory) — and mentions the linuxbrew volume.

Test plan

  • bash -n syntax check on both scripts
  • No Terraform files touched, so no terraform fmt/validate/test needed
  • Live verification against a real orphaned -linuxbrew volume in production (requires a real Coder deployment with an orphaned volume present)

Note: both scripts are installed manually on coder.ddev.com — merging this PR alone doesn't update the live copy; the server-side script needs a manual refresh too.

🤖 Generated with Claude Code

…nup sweep

cleanup-deleted-workspaces.sh's orphan detection only matched
coder-<owner>-<workspace>-dind-cache. An upcoming change persists Homebrew
across workspace restarts via a second per-workspace volume
(coder-<owner>-<workspace>-linuxbrew) -- without this fix, an orphaned one
(from an interrupted destroy, state desync, etc. -- exactly the failure
modes this script is a safety net for) would never be flagged or cleaned up.
Match both known suffixes, and note in-line that any future persistent
per-workspace volume needs to be added here too.

Also tightens a comment in workspace-lifecycle-cleanup.sh that attributed
volume cleanup to "the destroy provisioner" -- the null_resource destroy
provisioner in each template only removes the host-bind-mounted directory;
volumes are removed because Terraform destroys them along with the rest of
the workspace's resource graph, which is a separate mechanism. Updated to
mention the linuxbrew volume too.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Jul 27, 2026

Copy link
Copy Markdown
PR Preview Action v1.8.1
Preview removed because the pull request was closed.
2026-07-27 15:41 UTC

@rfay
rfay merged commit 1401c8e into main Jul 27, 2026
16 checks passed
@rfay
rfay deleted the 20260727_cleanup_orphan_volumes branch July 27, 2026 15:41
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