caib: improve build flow#111
Conversation
Signed-off-by: Benny Zlotnik <bzlotnik@redhat.com>
📝 WalkthroughWalkthroughAdded a CLI Changes
Sequence Diagram(s)sequenceDiagram
participant CLI as CLI (caib)
participant API as Build API Server
participant Controller as ImageBuild Controller
participant K8s as Kubernetes (pods)
CLI->>API: Request build status & start log follow (caib logs)
API->>Controller: Query build status / operator config
Controller-->>API: Current build state & config (including TargetDefaults)
API->>K8s: Open/stream pod/container logs (sinceTime)
K8s-->>API: Stream log lines / EOF / errors
API-->>CLI: Relay log lines (streaming)
Note right of API: on reconnect, advance startTime\nand only fetch new logs
CLI->>API: Poll/wait until build finished
API->>Controller: Finalize status request
Controller-->>API: Final build result (success/failure + lease id)
API-->>CLI: Final result, hints (e.g., lease info)
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 2❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
No actionable comments were generated in the recent review. 🎉 🧹 Recent nitpick comments
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Signed-off-by: Benny Zlotnik <bzlotnik@redhat.com>
Signed-off-by: Benny Zlotnik <bzlotnik@redhat.com>
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@cmd/caib/main.go`:
- Around line 2170-2194: The runLogs handler currently returns immediately if
st.Phase == phaseCompleted || st.Phase == phaseFailed which prevents emitting
any logs for finished builds; modify runLogs to fetch and print the latest logs
once before returning by invoking the existing log-streaming/log-fetching API
(e.g., call api.StreamBuildLogs(ctx, name) or api.GetBuildLogs(ctx, name) —
whichever exists in the client) after printing the build status, waiting for
that call to finish, then return; keep the early-return behavior only after the
one-time log fetch/print so active builds still stream as before.
Signed-off-by: Benny Zlotnik <bzlotnik@redhat.com>
configurable Signed-off-by: Benny Zlotnik <bzlotnik@redhat.com>
Summary by CodeRabbit
New Features
Improvements
Tests