Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

history: make sure build record is finalized before exporting - #3152

#3152
Merged
tonistiigi merged 2 commits into
docker:masterdocker/buildx:masterfrom
crazy-max:history-export-finalizecrazy-max/buildx:history-export-finalizeCopy head branch name to clipboard
May 13, 2025
Merged

history: make sure build record is finalized before exporting#3152
tonistiigi merged 2 commits into
docker:masterdocker/buildx:masterfrom
crazy-max:history-export-finalizecrazy-max/buildx:history-export-finalizeCopy head branch name to clipboard

Conversation

@crazy-max

Copy link
Copy Markdown
Member

fixes #3149

@tonistiigi tonistiigi left a comment

Copy link
Copy Markdown
Member

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.

@crazy-max
crazy-max force-pushed the history-export-finalize branch from 01e93be to 7d47527 Compare May 12, 2025 14:27
@crazy-max
crazy-max requested a review from tonistiigi May 12, 2025 18:41
Comment thread commands/history/export.go
@crazy-max
crazy-max force-pushed the history-export-finalize branch from 7d47527 to 0d9dac8 Compare May 13, 2025 09:32
@crazy-max
crazy-max force-pushed the history-export-finalize branch 6 times, most recently from 23cd56d to b8b6ac6 Compare May 13, 2025 11:18
Comment thread commands/history/utils.go
Comment on lines +253 to +269
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
})
}

Copy link
Copy Markdown
Member Author

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

Comment thread commands/history/export.go Outdated
}
}
}
recs, err = queryRecords(ctx, ref, nodes, &queryOptions{

Copy link
Copy Markdown
Member

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

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🙈

Comment thread docs/reference/buildx_history_export.md Outdated
### <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

Copy link
Copy Markdown
Member

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"

@crazy-max crazy-max added this to the v0.24.0 milestone May 13, 2025
@crazy-max
crazy-max force-pushed the history-export-finalize branch from b8b6ac6 to bc30077 Compare May 13, 2025 15:08
crazy-max added 2 commits May 13, 2025 17:17
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
@crazy-max
crazy-max force-pushed the history-export-finalize branch from bc30077 to 68ce10c Compare May 13, 2025 15:17
@tonistiigi
tonistiigi merged commit 277548e into docker:master May 13, 2025
@crazy-max
crazy-max deleted the history-export-finalize branch May 13, 2025 21:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Finalize records before exporting

2 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.