Skip to content

allez teardown

Delete the branch workspaces for this branch, or every orphaned one. Run --orphans after each merge to main.

Hard guard

A workspace is deleted only when its name matches [<repo>]-[<branch-slug>]-[<sub-folder>] for the current repo, and never when the branch is protected by protected-branches in the root allez.yml (main, master and release/* by default).

Usage

allez teardown [OPTIONS] [PATH]

Arguments

Argument Description
PATH Solution root (fabric/) or a single workspace sub-folder. Default: .

Options

Option Description
--branch, -b <str> Tear down the branch workspaces of this branch instead of the current one.
--orphans Tear down every workspace for this repo whose branch is gone from the remote.
--plan List what would be deleted and exit without deleting anything.

--branch and --orphans are two different scopes and cannot be combined.

Examples

allez teardown fabric --plan                    # list what would be deleted
allez teardown fabric                           # the branch workspaces for this branch
allez teardown fabric --branch feature/foo      # a branch that isn't checked out
allez teardown fabric --orphans                 # every workspace whose branch is gone — what the pipeline runs on main

Scopes

Current or named branch derives the conventional name for each sub-folder and deletes exactly those workspaces.

--orphans lists every workspace whose name matches the convention for this repo, leaves alone any whose branch still exists on the remote or is protected, and deletes the rest. A workspace one run misses is deleted by the next. The sweep sees a workspace only when:

  • The branch must be gone from the remote. Merging a PR without delete source branch leaves its branch workspaces alive indefinitely.
  • The identity running the sweep must have a role on the workspace. It sees the workspaces it created; one made by another identity only if it is listed under branch-workspace.roles (roles).

Behaviour

  • --plan still looks. teardown --orphans --plan makes one fab call to list workspaces, so it can name what it would delete.
  • Refuses to guess. If git ls-remote --heads cannot reach the remote, --orphans stops with an error rather than treating every workspace as orphaned.
  • Reports what it skipped. A workspace that matched the convention but was protected, or one that didn't match at all, is named in the output so the decision is visible.