build: fix partial multi-node image pushes - #4058
Open
tomasperezmolina wants to merge 2 commits into
Open
Conversation
Move the existing exporter setup out of the node build loop without changing its behavior. Environment: Datadog workspace Co-Authored-By: OpenAI GPT-5.6 <noreply@openai.com> Signed-off-by: Tomas Perez Molina <tomas.perezmolina@datadoghq.com>
Prepare each node's cloned exporter options so no node publishes the requested tag before all platforms complete. Environment: Datadog workspace Co-Authored-By: OpenAI GPT-5.6 <noreply@openai.com> Signed-off-by: Tomas Perez Molina <tomas.perezmolina@datadoghq.com>
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.
Why
A failed multi-node registry build must not leave the requested tag pointing to a single-platform image. Commit
de05d88f,build: let drivers prepare solve options, correctly gave each node an independent copy of its exporter attributes, exposing code that still depended on those attributes being shared. Only one node was switched to a repository-only digest push; another node could publish the final tag before every platform completed.Reproduction
Assume
reprois a two-node builder where the first node handleslinux/arm64and the second handleslinux/amd64. Start with a tag that does not exist.On an affected version, the tag exists and contains only
linux/amd64, even though the requested multi-platform build failed. Buildx never reaches the final manifest-list assembly because the arm64 solve failed.Fix
Before 0.37, every node shared the same exporter attribute map, so rewriting the first node implicitly rewrote the others. Once those maps were cloned, the target-wide
pushNamesguard caused later nodes to skip the rewrite.BuildWithResultHandlerloops overdps, one entry per node, and callsprepareMultiDriverExportswith that node'sSolveOpton every iteration. Inside the helper,pushPreparedis local and therefore resets for each node, whilepushNamesremains target-wide and captures the final tag only once. Each node's first pushed image exporter is consequently changed to a repository-only digest push. Buildx publishes the requested tag only after every node succeeds and the manifest list is assembled. Additional image exporters keep their existing behavior.Notes
The first commit only extracts the existing exporter preparation. The second commit changes its behavior and adds the regression test.