test: "attach" and "buildx dial-stdio" cmds for testing

Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
This commit is contained in:
CrazyMax 2024-02-21 14:05:29 +01:00
Родитель be388bff2a
Коммит 4ecc2f24df
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: ADE44D8C9D44FBE4
13 изменённых файлов: 255 добавлений и 17 удалений

Просмотреть файл

@ -41,7 +41,7 @@ func TestGenManTree(t *testing.T) {
require.NoError(t, copyFile(path.Join("fixtures", "buildx_stop.pre.md"), path.Join(tmpdir, "buildx_stop.md")))
c, err := New(Options{
Root: buildxCmd,
Root: dockerCmd,
SourceDir: tmpdir,
Plugin: true,
ManHeader: &doc.GenManHeader{
@ -52,7 +52,7 @@ func TestGenManTree(t *testing.T) {
},
})
require.NoError(t, err)
require.NoError(t, c.GenManTree(buildxCmd))
require.NoError(t, c.GenManTree(dockerCmd))
seen := make(map[string]struct{})
remanpage := regexp.MustCompile(`\.\d+$`)

Просмотреть файл

@ -33,12 +33,12 @@ func TestGenMarkdownTree(t *testing.T) {
require.NoError(t, copyFile(path.Join("fixtures", "buildx_stop.pre.md"), path.Join(tmpdir, "buildx_stop.md")))
c, err := New(Options{
Root: buildxCmd,
Root: dockerCmd,
SourceDir: tmpdir,
Plugin: true,
})
require.NoError(t, err)
require.NoError(t, c.GenMarkdownTree(buildxCmd))
require.NoError(t, c.GenMarkdownTree(dockerCmd))
seen := make(map[string]struct{})

Просмотреть файл

@ -32,11 +32,13 @@ import (
)
var (
dockerCmd *cobra.Command
buildxCmd *cobra.Command
buildxBuildCmd *cobra.Command
buildxInstallCmd *cobra.Command
buildxStopCmd *cobra.Command
dockerCmd *cobra.Command
attachCmd *cobra.Command
buildxCmd *cobra.Command
buildxBuildCmd *cobra.Command
buildxDialStdioCmd *cobra.Command
buildxInstallCmd *cobra.Command
buildxStopCmd *cobra.Command
)
//nolint:errcheck
@ -51,6 +53,22 @@ func setup() {
Version: "20.10.8",
DisableFlagsInUseLine: true,
}
attachCmd = &cobra.Command{
Use: "attach [OPTIONS] CONTAINER",
Short: "Attach local standard input, output, and error streams to a running container",
Annotations: map[string]string{
"aliases": "docker container attach, docker attach",
},
Run: func(cmd *cobra.Command, args []string) {},
}
attachFlags := attachCmd.Flags()
attachFlags.Bool("no-stdin", false, "Do not attach STDIN")
attachFlags.Bool("sig-proxy", true, "Proxy all received signals to the process")
attachFlags.String("detach-keys", "", "Override the key sequence for detaching a container")
dockerCmd.AddCommand(attachCmd)
buildxCmd = &cobra.Command{
Use: "buildx",
Short: "Docker Buildx",
@ -68,6 +86,12 @@ func setup() {
"aliases": "docker image build, docker buildx build, docker buildx b, docker build",
},
}
buildxDialStdioCmd = &cobra.Command{
Use: "dial-stdio",
Short: "Proxy current stdio streams to builder instance",
Args: cobra.NoArgs,
Run: func(cmd *cobra.Command, args []string) {},
}
buildxInstallCmd = &cobra.Command{
Use: "install",
Short: "Install buildx as a 'docker builder' alias",
@ -187,7 +211,13 @@ format: "default|<id>[=<socket>|<key>[,<key>]]"`)
buildxBuildFlags.BoolVar(&ignoreBool, "force-rm", false, "Always remove intermediate containers")
buildxBuildFlags.MarkHidden("force-rm")
buildxDialStdioFlags := buildxDialStdioCmd.Flags()
buildxDialStdioFlags.String("platform", os.Getenv("DOCKER_DEFAULT_PLATFORM"), "Target platform: this is used for node selection")
buildxDialStdioFlags.String("progress", "quiet", "Set type of progress output (auto, plain, tty).")
buildxCmd.AddCommand(buildxBuildCmd)
buildxCmd.AddCommand(buildxDialStdioCmd)
buildxCmd.AddCommand(buildxInstallCmd)
buildxCmd.AddCommand(buildxStopCmd)
dockerCmd.AddCommand(buildxCmd)
@ -205,7 +235,7 @@ func TestGenAllTree(t *testing.T) {
require.NoError(t, copyFile(path.Join("fixtures", "buildx_stop.pre.md"), path.Join(tmpdir, "buildx_stop.md")))
c, err := New(Options{
Root: buildxCmd,
Root: dockerCmd,
SourceDir: tmpdir,
Plugin: true,
ManHeader: &doc.GenManHeader{

Просмотреть файл

@ -31,12 +31,12 @@ func TestGenYamlTree(t *testing.T) {
tmpdir := t.TempDir()
c, err := New(Options{
Root: buildxCmd,
Root: dockerCmd,
SourceDir: tmpdir,
Plugin: true,
})
require.NoError(t, err)
require.NoError(t, c.GenYamlTree(buildxCmd))
require.NoError(t, c.GenYamlTree(dockerCmd))
seen := make(map[string]struct{})

20
fixtures/attach.md Normal file
Просмотреть файл

@ -0,0 +1,20 @@
# docker attach
<!---MARKER_GEN_START-->
Attach local standard input, output, and error streams to a running container
### Aliases
`docker container attach`, `docker attach`
### Options
| Name | Type | Default | Description |
|:----------------|:---------|:--------|:----------------------------------------------------|
| `--detach-keys` | `string` | | Override the key sequence for detaching a container |
| `--no-stdin` | `bool` | | Do not attach STDIN |
| `--sig-proxy` | `bool` | `true` | Proxy all received signals to the process |
<!---MARKER_GEN_END-->

Просмотреть файл

@ -5,10 +5,11 @@ Extended build capabilities with BuildKit
### Subcommands
| Name | Description |
|:---------------------------|:----------------------|
| [`build`](buildx_build.md) | Start a build |
| [`stop`](buildx_stop.md) | Stop builder instance |
| Name | Description |
|:-------------------------------------|:------------------------------------------------|
| [`build`](buildx_build.md) | Start a build |
| [`dial-stdio`](buildx_dial-stdio.md) | Proxy current stdio streams to builder instance |
| [`stop`](buildx_stop.md) | Stop builder instance |
### Options

Просмотреть файл

@ -0,0 +1,16 @@
# docker buildx dial-stdio
<!---MARKER_GEN_START-->
Proxy current stdio streams to builder instance
### Options
| Name | Type | Default | Description |
|:-------------|:---------|:--------|:-------------------------------------------------|
| `--builder` | `string` | | Override the configured builder instance |
| `--platform` | `string` | | Target platform: this is used for node selection |
| `--progress` | `string` | `quiet` | Set type of progress output (auto, plain, tty). |
<!---MARKER_GEN_END-->

39
fixtures/docker-attach.1 Normal file
Просмотреть файл

@ -0,0 +1,39 @@
.nh
.TH "DOCKER" "1" "Jan 2020" "Docker Community" "Docker User Manuals"
.SH NAME
.PP
docker-attach - Attach local standard input, output, and error streams to a running container
.SH SYNOPSIS
.PP
\fBdocker attach [OPTIONS] CONTAINER\fP
.SH DESCRIPTION
.PP
Attach local standard input, output, and error streams to a running container
.SH OPTIONS
.PP
\fB--detach-keys\fP=""
Override the key sequence for detaching a container
.PP
\fB-h\fP, \fB--help\fP[=false]
help for attach
.PP
\fB--no-stdin\fP[=false]
Do not attach STDIN
.PP
\fB--sig-proxy\fP[=true]
Proxy all received signals to the process
.SH SEE ALSO
.PP
\fBdocker(1)\fP

Просмотреть файл

@ -0,0 +1,41 @@
.nh
.TH "DOCKER" "1" "Jan 2020" "Docker Community" "Docker User Manuals"
.SH NAME
.PP
docker-buildx-dial-stdio - Proxy current stdio streams to builder instance
.SH SYNOPSIS
.PP
\fBdocker buildx dial-stdio\fP
.SH DESCRIPTION
.PP
Proxy current stdio streams to builder instance
.SH OPTIONS
.PP
\fB-h\fP, \fB--help\fP[=false]
help for dial-stdio
.PP
\fB--platform\fP=""
Target platform: this is used for node selection
.PP
\fB--progress\fP="quiet"
Set type of progress output (auto, plain, tty).
.SH OPTIONS INHERITED FROM PARENT COMMANDS
.PP
\fB--builder\fP=""
Override the configured builder instance
.SH SEE ALSO
.PP
\fBdocker-buildx(1)\fP

Просмотреть файл

@ -28,4 +28,4 @@ Extended build capabilities with BuildKit
.SH SEE ALSO
.PP
\fBdocker(1)\fP, \fBdocker-buildx-build(1)\fP, \fBdocker-buildx-stop(1)\fP
\fBdocker(1)\fP, \fBdocker-buildx-build(1)\fP, \fBdocker-buildx-dial-stdio(1)\fP, \fBdocker-buildx-stop(1)\fP

Просмотреть файл

@ -0,0 +1,46 @@
command: docker attach
aliases: docker container attach, docker attach
short: |
Attach local standard input, output, and error streams to a running container
long: |
Attach local standard input, output, and error streams to a running container
usage: docker attach [OPTIONS] CONTAINER
pname: docker
plink: docker.yaml
options:
- option: detach-keys
value_type: string
description: Override the key sequence for detaching a container
deprecated: false
hidden: false
experimental: false
experimentalcli: false
kubernetes: false
swarm: false
- option: no-stdin
value_type: bool
default_value: "false"
description: Do not attach STDIN
deprecated: false
hidden: false
experimental: false
experimentalcli: false
kubernetes: false
swarm: false
- option: sig-proxy
value_type: bool
default_value: "true"
description: Proxy all received signals to the process
deprecated: false
hidden: false
experimental: false
experimentalcli: false
kubernetes: false
swarm: false
deprecated: false
hidden: false
experimental: false
experimentalcli: false
kubernetes: false
swarm: false

Просмотреть файл

@ -5,9 +5,11 @@ pname: docker
plink: docker.yaml
cname:
- docker buildx build
- docker buildx dial-stdio
- docker buildx stop
clink:
- docker_buildx_build.yaml
- docker_buildx_dial-stdio.yaml
- docker_buildx_stop.yaml
options:
- option: builder

Просмотреть файл

@ -0,0 +1,43 @@
command: docker buildx dial-stdio
short: Proxy current stdio streams to builder instance
long: Proxy current stdio streams to builder instance
usage: docker buildx dial-stdio
pname: docker buildx
plink: docker_buildx.yaml
options:
- option: platform
value_type: string
description: 'Target platform: this is used for node selection'
deprecated: false
hidden: false
experimental: false
experimentalcli: false
kubernetes: false
swarm: false
- option: progress
value_type: string
default_value: quiet
description: Set type of progress output (auto, plain, tty).
deprecated: false
hidden: false
experimental: false
experimentalcli: false
kubernetes: false
swarm: false
inherited_options:
- option: builder
value_type: string
description: Override the configured builder instance
deprecated: false
hidden: false
experimental: false
experimentalcli: false
kubernetes: false
swarm: false
deprecated: false
hidden: false
experimental: false
experimentalcli: false
kubernetes: false
swarm: false