Skip to content

Comments

Add plugin system for external subcommands#202

Open
adrianreber wants to merge 2 commits intocheckpoint-restore:mainfrom
adrianreber:2026-02-23-plugin
Open

Add plugin system for external subcommands#202
adrianreber wants to merge 2 commits intocheckpoint-restore:mainfrom
adrianreber:2026-02-23-plugin

Conversation

@adrianreber
Copy link
Member

This PR introduces a plugin architecture that allows extending checkpointctl with additional subcommands. Plugins are discovered by scanning PATH for executables named checkpointctl-<name>, where <name> becomes the subcommand. This approach keeps the main binary lightweight by allowing plugins with larger dependencies to be distributed separately, and enables contributors to implement plugins in any programming language.

  • Auto-discovery of plugins in PATH at startup
  • Plugin description support via --plugin-description flag
  • Built-in commands take precedence over plugins
  • First plugin in PATH wins for duplicate names
  • New plugin list subcommand to show available plugins
  • Documentation including man page and README updates

Add support for external plugins that extend checkpointctl with
additional subcommands. Plugins are discovered by scanning PATH for
executables named checkpointctl-<name>, where <name> becomes the
subcommand.

This plugin architecture allows extending checkpointctl functionality
without increasing the binary size of the core tool. Plugins with
larger dependencies can be distributed separately, keeping the main
checkpointctl binary lightweight. Additionally, plugins can be
implemented in any programming language, enabling contributors to
use the tools and libraries best suited for their specific use case.

Features:
- Auto-discovery of plugins in PATH at startup
- Plugin description support via --plugin-description flag
- Built-in commands take precedence over plugins
- First plugin in PATH wins for duplicate names
- New "plugin list" subcommand to show available plugins

Generated with Claude Code (https://claude.ai/code)

Signed-off-by: Adrian Reber <areber@redhat.com>
Add documentation for the new plugin system:
- Add checkpointctl-plugin.adoc man page
- Update checkpointctl.adoc with missing commands (build, list, plugin)
- Add plugin section to README.md with usage examples

Generated with Claude Code (https://claude.ai/code)

Signed-off-by: Adrian Reber <areber@redhat.com>
@codecov-commenter
Copy link

Codecov Report

❌ Patch coverage is 83.00000% with 17 lines in your changes missing coverage. Please review.
✅ Project coverage is 76.51%. Comparing base (d4ddee6) to head (049219a).

Files with missing lines Patch % Lines
cmd/plugin.go 80.89% 10 Missing and 7 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #202      +/-   ##
==========================================
+ Coverage   76.00%   76.51%   +0.50%     
==========================================
  Files          13       14       +1     
  Lines        1288     1388     +100     
==========================================
+ Hits          979     1062      +83     
- Misses        232      242      +10     
- Partials       77       84       +7     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@github-actions
Copy link

Binary Size Check Failed

The binary size increase exceeds the allowed threshold.

Size Check Output

Changes from 06e23e6d1f24ce678daf67cfb85a3a1c2fba252d to 06e23e6d1f24ce678daf67cfb85a3a1c2fba252d:
Rebasing (2/6)
Executing: test/check-size.sh
go build -o checkpointctl -ldflags "-X main.name=checkpointctl -X main.version=1.5.0"
BINARY SIZE (13a7b8e): 9616680
No previous size present, storing current size
Rebasing (3/6)
Rebasing (4/6)
Executing: test/check-size.sh
go build -o checkpointctl -ldflags "-X main.name=checkpointctl -X main.version=1.5.0"
BINARY SIZE (fc59aac): 9672072
FAIL: size difference of 55392 B exceeds limit 51200 B
warning: execution failed: test/check-size.sh
You can fix the problem, and then run

  git rebase --continue

How to resolve

If this size increase is expected and acceptable, a maintainer can add
the bloat-ok label to this PR to bypass the size check.


Binary size check performed by CI

@github-actions
Copy link

Test Results

69 tests  +8   69 ✅ +8   2s ⏱️ ±0s
 1 suites ±0    0 💤 ±0 
 1 files   ±0    0 ❌ ±0 

Results for commit 049219a. ± Comparison against base commit d4ddee6.

@rst0git
Copy link
Member

rst0git commented Feb 23, 2026

@adrianreber If I understand correctly, this is somewhat similar to kubectl's plugin mechanism. Is that correct?

@adrianreber
Copy link
Member Author

@adrianreber If I understand correctly, this is somewhat similar to kubectl's plugin mechanism. Is that correct?

Exactly, that way the size of the binary does not increase automatically.

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.

3 participants