From d01d394a2b1f34550f5e4aa1ebbce969ea294cd3 Mon Sep 17 00:00:00 2001 From: Justin Chadwell Date: Tue, 16 Aug 2022 11:07:36 +0100 Subject: [PATCH 1/2] build: ensure consistent help messages for experimental cli help Append an [experimental] tag to the end of each experimental command to highlight that these are experimental options. Square brackets are used instead of parentheses as parentheses are already in use to highlight examples and defaults. Signed-off-by: Justin Chadwell --- commands/build.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/commands/build.go b/commands/build.go index 9321c2e2..6145d445 100644 --- a/commands/build.go +++ b/commands/build.go @@ -479,7 +479,7 @@ func buildCmd(dockerCli command.Cli, rootOpts *rootOptions) *cobra.Command { flags.StringArrayVar(&options.platforms, "platform", platformsDefault, "Set target platform for build") if isExperimental() { - flags.StringVar(&options.printFunc, "print", "", "Print result of information request (outline, targets)") + flags.StringVar(&options.printFunc, "print", "", "Print result of information request (e.g., outline, targets) [experimental]") } flags.BoolVar(&options.exportPush, "push", false, `Shorthand for "--output=type=registry"`) @@ -501,7 +501,7 @@ func buildCmd(dockerCli command.Cli, rootOpts *rootOptions) *cobra.Command { flags.Var(options.ulimits, "ulimit", "Ulimit options") if isExperimental() { - flags.StringVar(&options.invoke, "invoke", "", "Invoke a command after the build. BUILDX_EXPERIMENTAL=1 is required.") + flags.StringVar(&options.invoke, "invoke", "", "Invoke a command after the build [experimental]") } // hidden flags From 297526c49d7fef975beab21c443f4d518a2e775c Mon Sep 17 00:00:00 2001 From: Justin Chadwell Date: Tue, 16 Aug 2022 11:19:28 +0100 Subject: [PATCH 2/2] docs: add experimental options to build command reference Signed-off-by: Justin Chadwell --- docker-bake.hcl | 1 + docs/reference/buildx_build.md | 5 +++++ hack/dockerfiles/docs.Dockerfile | 1 + 3 files changed, 7 insertions(+) diff --git a/docker-bake.hcl b/docker-bake.hcl index 11c0ab0a..573133ed 100644 --- a/docker-bake.hcl +++ b/docker-bake.hcl @@ -20,6 +20,7 @@ target "_common" { args = { GO_VERSION = GO_VERSION BUILDKIT_CONTEXT_KEEP_GIT_DIR = 1 + BUILDX_EXPERIMENTAL = 1 } } diff --git a/docs/reference/buildx_build.md b/docs/reference/buildx_build.md index 323c8ed3..b0f6c6ea 100644 --- a/docs/reference/buildx_build.md +++ b/docs/reference/buildx_build.md @@ -25,6 +25,7 @@ Start a build | [`--cgroup-parent`](https://docs.docker.com/engine/reference/commandline/build/#use-a-custom-parent-cgroup---cgroup-parent) | `string` | | Optional parent cgroup for the container | | [`-f`](https://docs.docker.com/engine/reference/commandline/build/#specify-a-dockerfile--f), [`--file`](https://docs.docker.com/engine/reference/commandline/build/#specify-a-dockerfile--f) | `string` | | Name of the Dockerfile (default: `PATH/Dockerfile`) | | `--iidfile` | `string` | | Write the image ID to the file | +| `--invoke` | `string` | | Invoke a command after the build [experimental] | | `--label` | `stringArray` | | Set metadata for an image | | [`--load`](#load) | | | Shorthand for `--output=type=docker` | | [`--metadata-file`](#metadata-file) | `string` | | Write build result metadata to the file | @@ -33,6 +34,7 @@ Start a build | `--no-cache-filter` | `stringArray` | | Do not cache specified stages | | [`-o`](#output), [`--output`](#output) | `stringArray` | | Output destination (format: `type=local,dest=path`) | | [`--platform`](#platform) | `stringArray` | | Set target platform for build | +| `--print` | `string` | | Print result of information request (e.g., outline, targets) [experimental] | | [`--progress`](#progress) | `string` | `auto` | Set type of progress output (`auto`, `plain`, `tty`). Use plain to show container output | | `--pull` | | | Always attempt to pull all referenced images | | [`--push`](#push) | | | Shorthand for `--output=type=registry` | @@ -47,6 +49,9 @@ Start a build +Flags marked with `[experimental]` need to be explicitly enabled by setting the +`BUILDX_EXPERIMENTAL=1` environment variable. + ## Description The `buildx build` command starts a build using BuildKit. This command is similar diff --git a/hack/dockerfiles/docs.Dockerfile b/hack/dockerfiles/docs.Dockerfile index c0dea73a..ac58fa56 100644 --- a/hack/dockerfiles/docs.Dockerfile +++ b/hack/dockerfiles/docs.Dockerfile @@ -14,6 +14,7 @@ RUN apk add --no-cache rsync git WORKDIR /src COPY --from=docsgen /out/docsgen /usr/bin ARG FORMATS +ARG BUILDX_EXPERIMENTAL RUN --mount=target=/context \ --mount=target=.,type=tmpfs <