feat(cmd): Add '--follow' flag for start/restart#328
Draft
craciunoiuc wants to merge 1 commit into
Draft
Conversation
There was a problem hiding this comment.
Pull request overview
Adds --follow support to instance start and restart flows so users can stream instance logs immediately after lifecycle operations.
Changes:
- Adds
Followflags and examples forinstance startandinstance restart. - Streams logs after successful start/restart operations.
- Adds timeout support to golden-test command execution and coverage for start/restart follow flows.
Reviewed changes
Copilot reviewed 4 out of 6 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
internal/cmd/instances.go |
Adds follow flags and invokes log streaming after start/restart. |
cmd/unikraft/testdata/TestGolden/instances/help |
Updates CLI help golden output for new flags/examples. |
cmd/unikraft/main_test.go |
Adds per-command timeout handling in golden tests. |
cmd/unikraft/instances_test.go |
Adds integration-style golden tests for start/restart follow behavior. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
bc67b4b to
73bfafa
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 4 out of 6 changed files in this pull request and generated 2 comments.
Comments suppressed due to low confidence (2)
internal/cmd/instances.go:1467
- Using
tail=0when following after restart replays the instance's full previous log history before the new boot logs. This meansrestart --followcan show stale logs from before the restart and may dump a large backlog instead of following only the restarted instance's output.
return streamInstanceLogs(ctx, stdio, started, 0, true)
cmd/unikraft/instances_test.go:227
- This test records live restart logs into the golden output. The amount and content of data collected before the 5-second timeout depends on platform/image timing and can change between runs, making the golden file nondeterministic; the test should avoid snapshotting the raw followed log stream or normalize it more aggressively.
{
args: []string{
unikraftCmd, "instance", "restart",
"--follow",
"test-$UNIQ_INST",
},
timeout: 5 * time.Second,
},
ab5c60e to
b140223
Compare
craciunoiuc
commented
May 18, 2026
b140223 to
78f52bf
Compare
This allows for following logs on re/starting instances. This is not implemented for creation with autostart. Following logs prints everything from when the instance stopped. Signed-off-by: Cezar Craciunoiu <cezar@unikraft.io>
78f52bf to
712009f
Compare
Member
Author
|
As good as it can get |
jedevc
reviewed
May 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I wanted to do this for instance create --set autostart=true also, but I was unsure about that (was a bit controversial in a way), and it was also messing up the creation code, so I took it out.
For the tests I added a timeout field so we can force-quit out of following logs after some time.
Depends on: unikraft-cloud/go-sdk#187
Closes: TOOL-680