buildx icon indicating copy to clipboard operation
buildx copied to clipboard

bake: do not fail printing definition if instance unavailable

Open crazy-max opened this issue 3 years ago • 2 comments

fixes #1344

Since 0.9 we are checking the context builder endpoint to make sure it's reachable before returning the instance: https://github.com/docker/buildx/pull/1129#issuecomment-1195542481. By doing so we are not soft-failing as before when loading driversForNodeGroup and therefore bake --print now fails if no instance is available.

This PR will not return an error if we are printing local bake files. An instance is still required when building or loading remote bake files.

Signed-off-by: CrazyMax [email protected]

crazy-max avatar Oct 04 '22 10:10 crazy-max

@tonistiigi With this repro https://github.com/docker/buildx/issues/1344#issuecomment-1266628617 I found out that completing the trace span for the bake command on return timed out (10s). Looks to be this defer: https://github.com/docker/buildx/blob/105c214d15802358e2cd02622a20c5803aa1ec5e/commands/bake.go#L35-L37 calling: https://github.com/docker/buildx/blob/105c214d15802358e2cd02622a20c5803aa1ec5e/util/tracing/trace.go#L26

crazy-max avatar Oct 04 '22 10:10 crazy-max

Also would be good to have an integration test for this (setting a "bogus" / unreachable instance, then verify it works)

That's a broader subject but yeah we need integration tests for the cli and mock some components like the docker/cli.

crazy-max avatar Oct 04 '22 11:10 crazy-max