Skip to content

allow for stale branch cleanup (& dry run)#772

Open
mcncl wants to merge 2 commits intomainfrom
TE-5434/branch_cleanup
Open

allow for stale branch cleanup (& dry run)#772
mcncl wants to merge 2 commits intomainfrom
TE-5434/branch_cleanup

Conversation

@mcncl
Copy link
Copy Markdown
Contributor

@mcncl mcncl commented Apr 9, 2026

Description

Enables the user to run a cleanup subcommand to delete branches which are left stale after a build has run to completion. Allows for --dry-run to be used.

Changes

  • adds a cleanup command which will delete any branches with the pattern bk/preflight/*
    • works via using the [new] build branch resolver to get a list of branches with completed builds
  • minor housekeeping with Kong structs (PreflightCmd -> RunCmd)

Testing

  • Tests have run locally (with go test ./...)
  • Code is formatted (with go fmt ./...)

@mcncl mcncl requested review from a team as code owners April 9, 2026 05:33
)

// CleanupCmd deletes remote bk/preflight/* branches whose builds have completed.
type CleanupCmd struct {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should allow providing a specific preflight UUID to target.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@matthewborden would you want cleanup without args to clean up all branches, then if we supply --preflight-uuidwe only target that one? Or would you want UUID to be accepted as an optional positional arg, or allow the user to set --all?

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.

2 participants