Skip to content

build: resolve target links for call methods - #3992

Open
okhowang wants to merge 1 commit into
docker:masterfrom
okhowang:fix-bake-check-linked-targets
Open

build: resolve target links for call methods#3992
okhowang wants to merge 1 commit into
docker:masterfrom
okhowang:fix-bake-check-linked-targets

Conversation

@okhowang

@okhowang okhowang commented Aug 4, 2026

Copy link
Copy Markdown

Targets referencing each other through a "target:" named context are resolved on the client: the linked target is solved first and its result is then rewritten into an "input:" context by waitContextDeps.

A call method such as check or outline replies with the metadata of the subrequest and does not return a build result, so nothing can be linked into the targets depending on it. The "target:" context is then left untouched and reaches the frontend, which rejects it:

$ docker buildx bake -f providers.hcl -f build.hcl app --check
app
error: unsupported context source target for base
base
error: unsupported context source target for builder

Solve the build request separately when a target using a call method is linked to by another one, and register that result for them. It is never evaluated, so the definition is only resolved and nothing is built. Checks are skipped for that request as they are already reported by the call method, otherwise a Dockerfile asking for check violations to be errors would fail it before the report is produced.

Fixes #3343

Targets referencing each other through a "target:" named context are
resolved on the client: the linked target is solved first and its result
is then rewritten into an "input:" context by waitContextDeps.

A call method such as check or outline replies with the metadata of the
subrequest and does not return a build result, so nothing can be linked
into the targets depending on it. The "target:" context is then left
untouched and reaches the frontend, which rejects it:

  $ docker buildx bake -f providers.hcl -f build.hcl app --check
  app
  error: unsupported context source target for base
  base
  error: unsupported context source target for builder

Solve the build request separately when a target using a call method is
linked to by another one, and register that result for them. It is never
evaluated, so the definition is only resolved and nothing is built.
Checks are skipped for that request as they are already reported by the
call method, otherwise a Dockerfile asking for check violations to be
errors would fail it before the report is produced.

Fixes docker#3343

Signed-off-by: okhowang(王沛文) <okhowang@tencent.com>
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.

bake --check fails to resolve inter-target dependencies when definitions are split across files

1 participant