Refactor build/controller API to use single client.Build call#1750
Closed
jedevc wants to merge 4 commits intodocker:masterfrom
Closed
Refactor build/controller API to use single client.Build call#1750jedevc wants to merge 4 commits intodocker:masterfrom
client.Build call#1750jedevc wants to merge 4 commits intodocker:masterfrom
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
ktock
reviewed
Apr 20, 2023
| if err1 := printer.Wait(); err == nil { | ||
| err = err1 | ||
| res, err := cbuild.RunBuild(ctx, dockerCli, opts, os.Stdin, printer) | ||
| resp, err2 := res.Wait(ctx) |
Collaborator
There was a problem hiding this comment.
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) |
Collaborator
There was a problem hiding this comment.
It looks like called from goroutines so should be protected by lock.
ktock
reviewed
Apr 20, 2023
Comment on lines
-148
to
+144
| 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 |
Collaborator
There was a problem hiding this comment.
It seems that no progress is printed on reload?
Collaborator
Author
|
Closing in preference of #1804. |
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.
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.