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

Mark experimental flags in --help #2188

Merged
merged 1 commit into from
Jan 18, 2024

Conversation

AkihiroSuda
Copy link
Collaborator

Prior to this commit, experimental flags were not distinguishable from regular flags in --help

$ BUILDX_EXPERIMENTAL=1 docker buildx build --help

Usage:  docker buildx build [OPTIONS] PATH | URL | -

Start a build

Aliases:
  docker buildx build, docker buildx b

Options:
      --add-host strings              Add a custom host-to-IP mapping (format: "host:ip")
      --allow strings                 Allow extra privileged entitlement (e.g., "network.host", "security.insecure")
      --annotation stringArray        Add annotation to the image
      --attest stringArray            Attestation parameters (format: "type=sbom,generator=image")
      --build-arg stringArray         Set build-time variables
      --build-context stringArray     Additional build contexts (e.g., name=path)
      --builder string                Override the configured builder instance
      --cache-from stringArray        External cache sources (e.g., "user/app:cache", "type=local,src=path/to/dir")
      --cache-to stringArray          Cache export destinations (e.g., "user/app:cache", "type=local,dest=path/to/dir")
      --cgroup-parent string          Set the parent cgroup for the "RUN" instructions during build
      --detach                        Detach buildx server (supported only on linux) (EXPERIMENTAL)
  -f, --file string                   Name of the Dockerfile (default: "PATH/Dockerfile")
      --iidfile string                Write the image ID to the file
      --label stringArray             Set metadata for an image
      --load                          Shorthand for "--output=type=docker"
      --metadata-file string          Write build result metadata to the file
      --network string                Set the networking mode for the "RUN" instructions during build (default "default")
      --no-cache                      Do not use cache when building the image
      --no-cache-filter stringArray   Do not cache specified stages
  -o, --output stringArray            Output destination (format: "type=local,dest=path")
      --platform stringArray          Set target platform for build
      --print string                  Print result of information request (e.g., outline, targets) (EXPERIMENTAL)
      --progress string               Set type of progress output ("auto", "plain", "tty"). Use plain to show container output (default "auto")
      --provenance string             Shorthand for "--attest=type=provenance"
      --pull                          Always attempt to pull all referenced images
      --push                          Shorthand for "--output=type=registry"
  -q, --quiet                         Suppress the build output and print image ID on success
      --root string                   Specify root directory of server to connect (EXPERIMENTAL)
      --sbom string                   Shorthand for "--attest=type=sbom"
      --secret stringArray            Secret to expose to the build (format: "id=mysecret[,src=/local/secret]")
      --server-config string          Specify buildx server config file (used only when launching new server) (EXPERIMENTAL)
      --shm-size bytes                Size of "/dev/shm"
      --ssh stringArray               SSH agent socket or keys to expose to the build (format: "default|<id>[=<socket>|<key>[,<key>]]")
  -t, --tag stringArray               Name and optionally a tag (format: "name:tag")
      --target string                 Set the target build stage to build
      --ulimit ulimit                 Ulimit options (default [])

@AkihiroSuda AkihiroSuda force-pushed the mark-experimental-flags branch from 108be63 to 348b61e Compare January 12, 2024 08:36
Copy link
Member

@crazy-max crazy-max left a comment

Choose a reason for hiding this comment

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

LGTM thanks! PTAL @thaJeztah

@crazy-max crazy-max requested a review from thaJeztah January 12, 2024 09:27
@thaJeztah
Copy link
Member

Wondering; are we also annotating these when rendering the docs at docs.docker.com (mostly curious if this would now show "experimental" twice).

@crazy-max
Copy link
Member

crazy-max commented Jan 12, 2024

Wondering; are we also annotating these when rendering the docs at docs.docker.com (mostly curious if this would now show "experimental" twice).

Hum good point, we already carry the "experimentaCLI" annotation in the yaml definition. We might just want to display "(EXPERIMENTAL)" in the cli then. @dvdksn I think in the docs website we display a blockquote for experimental commands already right?

@dvdksn
Copy link
Contributor

dvdksn commented Jan 12, 2024

yes we have a callout at the top of the page https://docs.docker.com/engine/reference/commandline/buildx_debug_build/

f.Annotations = make(map[string][]string)
}
f.Annotations[annotationExperimentalCLI] = nil
f.Usage += " (EXPERIMENTAL)"
Copy link
Contributor

@dvdksn dvdksn Jan 12, 2024

Choose a reason for hiding this comment

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

I wonder if it would be better to handle this with a custom help template or function, rather than augmenting the cmd.Usage / flag.Usage
https://github.com/spf13/cobra/blob/main/site/content/user_guide.md#defining-your-own-help

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Maintenance cost can be higher if we switch away from the default template

Prior to this commit, experimental flags were not distinguishable from
regular flags in `--help`

Signed-off-by: Akihiro Suda <[email protected]>
@AkihiroSuda AkihiroSuda force-pushed the mark-experimental-flags branch from 348b61e to 02c2073 Compare January 13, 2024 10:54
@AkihiroSuda
Copy link
Collaborator Author

Removed " (EXPERIMENTAL)" from yamls

@AkihiroSuda
Copy link
Collaborator Author

Can we merge?

@tonistiigi tonistiigi merged commit 38afdf1 into docker:master Jan 18, 2024
63 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants