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

Allow to run bake {--list-targets, --list-vars} without having a docker daemon / builder instance available (similar to --print) #2755

Closed
neumantm opened this issue Oct 28, 2024 · 1 comment · Fixed by #2763
Assignees
Labels
kind/enhancement New feature or request
Milestone

Comments

@neumantm
Copy link
Contributor

Description

buildx bake already supports running with --print even if there is no docker daemon / builder instance available.

This exception is handled here:

if url != "" || !in.printOnly {

I think it would be great if the same would apply to --list-targets and --list-vars.

I assume this is easy to add by just changing the above-mentioned condition as I assume the logic for these flags doesn't actually needs a builder and the function returns after processing either of these flags:

buildx/commands/bake.go

Lines 188 to 192 in 2bdf451

if in.listTargets {
return printTargetList(dockerCli.Out(), cfg)
} else if in.listVars {
return printVars(dockerCli.Out(), pm.AllVariables)
}

I would be open to create a PR, if there is no argument against this.

@neumantm neumantm added kind/enhancement New feature or request status/triage labels Oct 28, 2024
@crazy-max
Copy link
Member

Yes sounds good to me, feel free to open a PR, thanks!

@crazy-max crazy-max added this to the v0.18.0 milestone Oct 28, 2024
@thompson-shaun thompson-shaun modified the milestones: v0.18.0, v0.19.0 Oct 28, 2024
neumantm added a commit to neumantm/buildx that referenced this issue Oct 29, 2024
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#2755
Signed-off-by: Tim Neumann <[email protected]>
@crazy-max crazy-max modified the milestones: v0.19.0, v0.18.0 Oct 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants