Skip to content

feat: add edit subcommand#205

Open
ImranullahKhann wants to merge 2 commits intocheckpoint-restore:mainfrom
ImranullahKhann:main
Open

feat: add edit subcommand#205
ImranullahKhann wants to merge 2 commits intocheckpoint-restore:mainfrom
ImranullahKhann:main

Conversation

@ImranullahKhann
Copy link
Copy Markdown
Contributor

@ImranullahKhann ImranullahKhann commented Mar 1, 2026

Currently only supports tcp listen port remapping. Made the following changes:

  • Added the edit command in cmd/.
  • Added edit_archive.go in internals/ for the main edit logic.
  • Added archive_modifiers.go inside internals/. It contains the modifier logic for any entry that would need changes in the archive.
  • Added unit and integration tests for verifying the functionality.

Kept extensibility in mind, for any additional edit logic in the future, we can reuse the same function tarStreamRewrite (in edit_archive.go) and write additional modifier functions in archive_modifiers.go.

Closes #169

@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 1, 2026

Binary Size Check Failed

The binary size increase exceeds the allowed threshold.

Size Check Output

Changes from d956de3cd8b2f43c671801ba53563af332983285 to d956de3cd8b2f43c671801ba53563af332983285:
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 (3fc6820): 9727704
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 (0f46401): 10509672
FAIL: size difference of 781968 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
Copy Markdown

github-actions bot commented Mar 1, 2026

Test Results

94 tests  +8   94 ✅ +8   4s ⏱️ -1s
 1 suites ±0    0 💤 ±0 
 1 files   ±0    0 ❌ ±0 

Results for commit 796785e. ± Comparison against base commit 34f655f.

♻️ This comment has been updated with latest results.

@ImranullahKhann
Copy link
Copy Markdown
Contributor Author

I have tested the functionality on Podman and CRI-O checkpoints. I will start working on writing the tests and would appreciate any feedback and guidance.

@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Mar 1, 2026

Codecov Report

❌ Patch coverage is 64.41281% with 100 lines in your changes missing coverage. Please review.
✅ Project coverage is 77.84%. Comparing base (34f655f) to head (796785e).

Files with missing lines Patch % Lines
internal/edit_archive.go 50.00% 49 Missing and 19 partials ⚠️
internal/archive_modifiers.go 73.77% 16 Missing and 16 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #205      +/-   ##
==========================================
- Coverage   79.98%   77.84%   -2.15%     
==========================================
  Files          16       19       +3     
  Lines        1759     2040     +281     
==========================================
+ Hits         1407     1588     +181     
- Misses        263      328      +65     
- Partials       89      124      +35     

☔ 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.

@ImranullahKhann
Copy link
Copy Markdown
Contributor Author

@rst0git, please take a look

@adrianreber
Copy link
Copy Markdown
Member

Please take a look at providing unit tests and end to end tests.

@ImranullahKhann ImranullahKhann force-pushed the main branch 2 times, most recently from e536151 to 1c8ceeb Compare March 19, 2026 11:34
@ImranullahKhann
Copy link
Copy Markdown
Contributor Author

@adrianreber, please have a look

@adrianreber
Copy link
Copy Markdown
Member

Try to add more unit tests. Especially the error branches are not covered well.

Currently only supports tcp listen port remapping. Made the following changes:
- Added the edit command in cmd/.
- Added edit_archive.go in internals/ for the main edit logic.
- Added archive_modifiers.go inside internals/. It contains the modifier
logic for any entry that would need changes in the archive.
Kept extensibility in mind, for any additional change logic in the future,
we can reuse the same function tarStreamRewrite (in edit_archive.go) and
write additional modifier functions in archive_modifiers.go.

Assisted-by: Github Copilot
Signed-off-by: Imranullah Khan <imranullahkhann2004@gmail.com>
Signed-off-by: Imranullah Khan <imranullahkhann2004@gmail.com>
@ImranullahKhann
Copy link
Copy Markdown
Contributor Author

Please have a look

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.

Remapping of TCP listen ports

3 participants