Skip to content

fix: clone exports before modifying for save #357

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

Merged
merged 1 commit into from
May 29, 2025
Merged

Conversation

ischolten
Copy link
Contributor

While running the build or bake command, if image outputs and tags were specified and it needed to both save and load the build / target, an error from either the "fast load" or load from registry would result in a retry which would unexpectedly try to push to the specified tags even if push was not specified for those outputs.

The underlying issue was that load fallback options created from fallbackOpts = maps.Clone(buildOpts) is a shallow copy of buildOpts. So later when WithDepotSave modified the exports to have the attr "push" as "true" so that the images would be pushed to the depot registry, the fallbackOpts.Exports were also affected. During this retry the buildOptTags were still the original ones specified by the user which meant we ended up in a case where during retry, the fallback opts for the output image would have push set to true erroneously and the tag set to possibly another registry resulting in this unexpected push.

@ischolten ischolten force-pushed the fix/unexpected-push branch from 04263eb to 32ee63f Compare May 29, 2025 20:39
@ischolten ischolten merged commit 06e4011 into main May 29, 2025
6 checks passed
@ischolten ischolten deleted the fix/unexpected-push branch May 29, 2025 20:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants