-
Notifications
You must be signed in to change notification settings - Fork 617
Refactor build/controller API to use single client.Build call
#1750
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Refactor the progress printer creation to the caller-side of the controller api. Then, instead of passing around status channels, we can simply pass around the higher level interface progress.Writer, which allows us to correctly pull warnings out of the remote controller. Signed-off-by: Justin Chadwell <[email protected]>
Signed-off-by: Justin Chadwell <[email protected]>
Signed-off-by: Justin Chadwell <[email protected]>
Signed-off-by: Justin Chadwell <[email protected]>
client.Build call
ktock
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
| if err1 := printer.Wait(); err == nil { | ||
| err = err1 | ||
| res, err := cbuild.RunBuild(ctx, dockerCli, opts, os.Stdin, printer) | ||
| resp, err2 := res.Wait(ctx) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should check res != nil to avoid panic
|
|
||
| func (r *ResultContext) Done() { | ||
| func (r *ResultContext) hook(hook func(ctx context.Context) error) { | ||
| r.hooks = append(r.hooks, hook) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like called from goroutines so should be protected by lock.
| ref, _, err := c.Build(ctx, *bo, nil, stdout, stderr, progressMode) // TODO: support stdin, hold build ref | ||
| ref, err := c.Build(ctx, *bo, nil, progress) // TODO: support stdin, hold build ref |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems that no progress is printed on reload?
|
Closing in preference of #1804. |
Depends on #1737.
This PR performs some refactoring after #1640.
To summarize:
BuildandBuildWithResultHandlertogether. They both return partially evaluated results inResultContext. These results must beWaited to get the actual build response.client.Buildcall. We only need one gateway session.--printbuilds to work over the controller interface.--printand--metadata-filelogic to happen on the client side.debug-shellandon-error#1640 (comment)client.Buildsession. If we compute the result across two gateway sessions, then we either have to ignore the incoming progress and print out only the final progress results, or we have to merge the two progresses together to display in a single terminal (which... doesn't go well, we get a lot of duplicates).Buildonly performs the parts of the build relevant to actually evaluating the result, to perform the export,Finalizemust be called with the targeted build ref.Buildcall, which would then leave us unable to invoke in the future using that Build.