-
Notifications
You must be signed in to change notification settings - Fork 545
history: make sure build record is finalized before exporting #3152
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
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.
As discussed offline:
- Finalize should only happen if
Trace==nil
- For export, we can leave some opt-in mechanism to force finalize, so we don't need a sleep to wait for the client traces to finish up if the user can already confirm it.
01e93be
to
7d47527
Compare
7d47527
to
0d9dac8
Compare
23cd56d
to
b8b6ac6
Compare
for _, node := range nodes { | ||
node := node | ||
eg.Go(func() error { | ||
if node.Driver == nil { | ||
return nil | ||
} | ||
c, err := node.Driver.Client(ctx) | ||
if err != nil { | ||
return err | ||
} | ||
_, err = c.ControlClient().UpdateBuildHistory(ctx, &controlapi.UpdateBuildHistoryRequest{ | ||
Ref: ref, | ||
Finalize: true, | ||
}) | ||
return err | ||
}) | ||
} |
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.
@tonistiigi For multi-node case I think this is safe even if the ref doesn't exist on unrelated node: https://github.com/moby/buildkit/blob/b46daef219fd318bd0f9c8f630472af771b2bb4a/solver/llbsolver/history.go#L676-L686
commands/history/export.go
Outdated
} | ||
} | ||
} | ||
recs, err = queryRecords(ctx, ref, nodes, &queryOptions{ |
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.
only do this if some records were finalized
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.
🙈
### <a name="finalize"></a> Ensure build records are finalized before exporting (--finalize) | ||
|
||
Clients can report their own traces concurrently and not all traces may be | ||
finalized when a build is completed. Use the `--finalize` flag to ensure all |
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.
"not all traces may be
saved yet by the time of the export"
b8b6ac6
to
bc30077
Compare
Signed-off-by: CrazyMax <[email protected]>
Signed-off-by: CrazyMax <[email protected]>
bc30077
to
68ce10c
Compare
fixes #3149