Skip to content
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

dockerfile: avoid too eager loading of unreachable named contextes #5688

Merged
merged 1 commit into from
Feb 7, 2025

Conversation

tonistiigi
Copy link
Member

@tonistiigi tonistiigi commented Jan 29, 2025

fixes docker/buildx#2939

Avoids pulling in a named context if the build dependencies are not actually using it. The main case where this issue appears is when image is used as a named context and image config would be resolved. In addition to wasting resources, the image could also be invalid for the current build configuration and cause the build to fail.

Copy link
Member

@cpuguy83 cpuguy83 left a comment

Choose a reason for hiding this comment

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

Assuming tests pass, this LGTM

@@ -9167,6 +9168,49 @@ func testSourcePolicyWithNamedContext(t *testing.T, sb integration.Sandbox) {
require.Equal(t, "foo", string(dt))
}

func testEagerNamedContextLookup(t *testing.T, sb integration.Sandbox) {
Copy link
Member

Choose a reason for hiding this comment

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

Maybe add a comment to explain "eager"

@tonistiigi tonistiigi added this to the v0.20.0 milestone Feb 6, 2025
@tonistiigi tonistiigi force-pushed the dockerfile-eager-ncontext branch from 4190572 to d394e48 Compare February 7, 2025 02:13
@crazy-max crazy-max merged commit cc82be7 into moby:master Feb 7, 2025
97 checks passed
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.

Possibly broken interaction between --platform and --build-context
4 participants