Skip to content

fix(cli): recognize build/bake/builder aliasing before cloud help check - #7351

Merged
thaJeztah merged 1 commit into
docker:masterfrom
nicksieger:docker-cloud-build-help-parsing
Oct 3, 2026
Merged

thaJeztah merged 1 commit into
docker:masterfrom
nicksieger:docker-cloud-build-help-parsing

Conversation

@nicksieger

@nicksieger nicksieger commented Oct 2, 2026 •

Copy link
Copy Markdown
Member

Summary

  • docker --cloud build rejected every BuildKit-only flag (--secret, --ssh, --push, --output, ...) because cloudHelpRequest parsed the remaining args against the legacy build command's flag set before processAliases rewrites build into a buildx invocation
  • Treat build/bake/builder/image build the same as plugin commands in cloudHelpRequest: only recognize --help/-h immediately after the resolved command path instead of validating flags against the legacy flag set
  • Added TestCloudHelpRequest cases covering build --help, BuildKit-only flags on build/image build/builder build, and bake --help

Fixes #7350

@docker-agent docker-agent left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Assessment: 🟢 APPROVE

docker --cloud build rejected every BuildKit-only flag (--secret, --ssh,
--push, --output, ...) because cloudHelpRequest parsed remaining args
against the legacy build command's flag set before processAliases
rewrites build into a buildx invocation. Treat build/bake/builder/image
build the same as plugin commands: only recognize --help/-h immediately
after the resolved command path instead of validating flags.

Fixes docker#7350

Signed-off-by: Nick Sieger <nick@nicksieger.com>
@nicksieger
nicksieger force-pushed the docker-cloud-build-help-parsing branch from 8e6b7f4 to 6cb63ef Compare October 2, 2026 21:53
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

The new helper regresses valid boolean help forms such as build --help=1.

Review effort: Balanced
Findings: 1 Medium severity

Open (1)
What changed in this PR

Updates cloud help detection so builder aliases defer BuildKit flag parsing to buildx.

Changes:

  • Detects forwarded build, bake, builder, and image build commands.
  • Adds coverage for BuildKit-only flags and help requests.
File Description
cmd/​docker/​cloud.go Handles builder aliases like plugin commands.
cmd/​docker/​cloud_test.go Tests aliased commands and BuildKit flags.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread cmd/docker/cloud.go
// isHelpFlag reports whether arg requests help, in any of the forms pflag
// accepts for a boolean flag.
func isHelpFlag(arg string) bool {
return arg == "--help" || arg == "-h" || arg == "--help=true"

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.

We don't need to account for those permutations. Using --help=true on its own is already an obscure case; we only added it because technically it's allowed, but nobody uses it.

@docker-agent docker-agent left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Assessment: 🟢 APPROVE

@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, thx!

@thaJeztah

Copy link
Copy Markdown
Member

The e2e failure is unrelated, but looks like a genuine failure with the v29.9.0-rc.1 daemon; at a quick glance, it's either a race, or a bugfix that caused the output to change (need to check), combined with a test that may be too strict;

=== Failed
=== FAIL: e2e/container TestRunAttachedFromRemoteImageAndRemove (1.33s)
    run_test.go:42: assertion failed: 
        --- expected
        +++ actual
        @@ -1,4 +1,5 @@
         Unable to find image 'registry:5000/alpine:test-run-pulls' locally
         test-run-pulls: Pulling from alpine
        +63b65145d645: Pulling fs layer
         Digest: sha256:e2e16842c9b54d985bf1ef9242a313f36b856181f188de21313820e177002501
         Status: Downloaded newer image for registry:5000/alpine:test-run-pulls
        
        
        You can run 'go test . -update' to automatically update testdata/run-attached-from-remote-and-remove.golden to the new expected value.'

@thaJeztah
thaJeztah merged commit cb192ae into docker:master Oct 3, 2026
115 of 124 checks passed
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.

docker --cloud build rejects BuildKit-only flags (--secret, --ssh, --push, --output, ...) with "unknown flag"

5 participants