Skip Builder Init For Bake List Flags

Add the flags --list-targets and --list-variables to the cases
where initializing the builder can be skipped.

This allows the listing of targets and variables
when no builder is available.

Resolves: docker/buildx#2755
Signed-off-by: Tim Neumann <git@neumann-tim.de>
This commit is contained in:
Tim Neumann 2024-10-29 10:34:20 +01:00
parent 2bdf451b68
commit 0fd935b0ca
1 changed files with 1 additions and 1 deletions

View File

@ -116,7 +116,7 @@ func runBake(ctx context.Context, dockerCli command.Cli, targets []string, in ba
// instance only needed for reading remote bake files or building // instance only needed for reading remote bake files or building
var driverType string var driverType string
if url != "" || !in.printOnly { if url != "" || !(in.printOnly || in.listTargets || in.listVars) {
b, err := builder.New(dockerCli, b, err := builder.New(dockerCli,
builder.WithName(in.builder), builder.WithName(in.builder),
builder.WithContextPathHash(contextPathHash), builder.WithContextPathHash(contextPathHash),