Skip to content

Add cleanup subcommand to remove older tool versions#85

Open
givaldolins wants to merge 5 commits intoopenshift:mainfrom
givaldolins:clean-up
Open

Add cleanup subcommand to remove older tool versions#85
givaldolins wants to merge 5 commits intoopenshift:mainfrom
givaldolins:clean-up

Conversation

@givaldolins
Copy link

Problem
Over time, backplane-tools accumulates multiple versions of each installed tool in ~/.local/bin/backplane/.
Each upgrade creates a new versioned directory while keeping all previous versions, leading to significant disk usage growth. For users who frequently update tools, this can result in hundreds of megabytes or even gigabytes of redundant binaries.

For example, after several updates, a user might have:

~/.local/bin/backplane/oc/
  ├── 4.19.5/
  ├── 4.20.8/
  ├── 4.20.9/
  ├── 4.20.10/
  ├── 4.20.11/
  └── 4.21.0/  (currently linked in latest/)

Only the latest version (4.21.0) is actually used, but all previous versions remain on disk.

Solution
This PR introduces a new cleanup subcommand that removes all older versions of installed tools while preserving only the currently active version (the one symlinked in latest/).

Usage:

# Clean up a specific tool
backplane-tools cleanup oc

# Clean up multiple tools
backplane-tools cleanup oc ocm rosa

# Clean up all installed tools
backplane-tools cleanup all
# or simply
backplane-tools cleanup

Testing
Manual testing confirmed that the cleanup command successfully removes older versions while preserving the active version and its symlink.

$ backplane-tools cleanup
Cleaning up the following tools: 

Removing osdctl
Successfully cleaned up osdctl: removed versions: v0.23.2, v0.23.3, v0.23.4, v0.23.5, v0.24.0

Removing backplane-cli
Successfully cleaned up backplane-cli: removed versions: v0.5.7, v0.5.8, v0.5.9, v0.6.0, v0.6.1

Removing rosa
Successfully cleaned up rosa: removed versions: v1.2.40, v1.2.41, v1.2.42, v1.2.43, v1.2.44

Removing ocm-container
Successfully cleaned up ocm-container: removed versions: v2.0.0, v2.0.1, v2.0.2, v2.0.3, v2.0.4

Removing aws
Successfully cleaned up aws: removed versions: 2.13.0, 2.13.5, 2.14.0, 2.14.5, 2.15.0

Removing ocm
Successfully cleaned up ocm: removed versions: v1.0.6, v1.0.7, v1.0.8, v1.0.9, v1.1.0

Removing ocm-addons
Successfully cleaned up ocm-addons: removed versions: v0.8.2, v0.8.3, v0.8.4, v0.8.5, v0.9.0

Removing yq
Successfully cleaned up yq: removed versions: v4.43.2, v4.43.3, v4.43.4, v4.43.5, v4.44.0

Removing gcloud
Successfully cleaned up gcloud: removed versions: 496.0.0, 497.0.0, 498.0.0, 499.0.0, 500.0.0

Removing backplane-tools
Successfully cleaned up backplane-tools: removed versions: v1.0.0, v1.0.1, v1.0.2, v1.0.3, v1.0.4

Removing oc
Successfully cleaned up oc: no old versions found

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Feb 11, 2026

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: givaldolins
Once this PR has been reviewed and has the lgtm label, please assign t0masd for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

Copy link
Member

@MateSaary MateSaary left a comment

Choose a reason for hiding this comment

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

Came across this one while looking through Operational tooling backlog... LGTM aside from the couple super minor nits, but would need a sign-off from repo owners to merge 🙂

givaldolins and others added 2 commits February 26, 2026 11:52
Co-authored-by: Máté G. Saáry <matesaary@gmail.com>
Co-authored-by: Máté G. Saáry <matesaary@gmail.com>
@givaldolins
Copy link
Author

Thanks @MateSaary , I have committed your suggested changes

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Feb 26, 2026

@givaldolins: all tests passed!

Full PR test history. Your PR dashboard.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

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