-
Notifications
You must be signed in to change notification settings - Fork 506
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
Refactor build/controller API to use single client.Build
call
#1750
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 <me@jedevc.com>
Signed-off-by: Justin Chadwell <me@jedevc.com>
Signed-off-by: Justin Chadwell <me@jedevc.com>
Signed-off-by: Justin Chadwell <me@jedevc.com>
client.Build
call
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
@@ -131,7 +40,39 @@ type ResultContext struct { | |||
cleanupsMu sync.Mutex | |||
} | |||
|
|||
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:
Build
andBuildWithResultHandler
together. They both return partially evaluated results inResultContext
. These results must beWait
ed to get the actual build response.client.Build
call. We only need one gateway session.--print
builds to work over the controller interface.--print
and--metadata-file
logic to happen on the client side.debug-shell
andon-error
#1640 (comment)client.Build
session. 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).Build
only performs the parts of the build relevant to actually evaluating the result, to perform the export,Finalize
must be called with the targeted build ref.Build
call, which would then leave us unable to invoke in the future using that Build.