Skip to content

avoid policy dependency from builder loading - #3998

Open
crazy-max wants to merge 1 commit into
docker:masterfrom
crazy-max:split-builder-policy-verifier
Open

avoid policy dependency from builder loading#3998
crazy-max wants to merge 1 commit into
docker:masterfrom
crazy-max:split-builder-policy-verifier

Conversation

@crazy-max

Copy link
Copy Markdown
Member

This change stops builder.LoadNodes from constructing the default policy verifier itself, so consumers of the builder package no longer pull in the policy package and its OPA dependency graph.

The builder package now accepts an optional image verifier through WithImageVerifier, and command paths that may boot or use builder images pass the default policy verifier explicitly. The default verifier construction stays in the policy package.

The default policy is runtime opt-in, but the previous unconditional import made downstream users vendor OPA and the signature verification stack even when they did not use policy support. This keeps the buildx CLI behavior while restoring a lighter dependency boundary for builder and driver consumers.

Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
Comment thread driver/image_test.go
called := false

pinned, applied, err := VerifyImageRef(context.Background(), nopSubLogger{}, "moby/buildkit@"+dgst.String(), nil, nil, func(_ context.Context, _ string, _ *ocispecs.Platform, _ policy.SourceMetadataResolver) (digest.Digest, error) {
pinned, applied, err := VerifyImageRef(context.Background(), nopSubLogger{}, "moby/buildkit@"+dgst.String(), nil, nil, func(_ context.Context, _ string, _ *ocispecs.Platform, _ *sourcemeta.Resolver) (digest.Digest, error) {

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.

If we're breaking the api / signature, perhaps as a follow-up also look if we need all these arguments to be positional arguments or if it could be an option-struct or variadic functional args.

@thaJeztah thaJeztah 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.

LGTM

worth checking if this requires changes in compose, or if it doesn't use this code.

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.

2 participants