Commit Graph

6028 Commits

Author SHA1 Message Date
Nick Adcock ff51b0d77d harden config.Path() to disallow directory traversal
Signed-off-by: Nick Adcock <nick.adcock@docker.com>
2019-03-07 14:40:53 +00:00
Vincent Demeester 39c327ab93
Merge pull request #1717 from ry4nz/export-config
Export cli/command/config
2019-03-07 08:04:33 +01:00
Ryan Zhang f60369dfe6 Export cli/command/config
Signed-off-by: Ryan Zhang <ryan.zhang@docker.com>
2019-03-05 14:26:42 -08:00
Sebastiaan van Stijn 79e1cabf17
Merge pull request #1680 from cquon/plugin_error_handling
Fix issue where plugin command error exit code is printed out
2019-03-05 09:22:47 +01:00
Vincent Demeester 8f68971ede
Merge pull request #1701 from ijc/plugin-build-fixes
Fix cli-plugins build.
2019-03-05 09:10:08 +01:00
Sebastiaan van Stijn d4877fb225
Fix test for Go 1.12.x
After switching to Go 1.12, the format-string causes an error;

```
=== Errors
cli/config/config_test.go:154:3: Fatalf format %q has arg config of wrong type *github.com/docker/cli/cli/config/configfile.ConfigFile
cli/config/config_test.go:217:3: Fatalf format %q has arg config of wrong type *github.com/docker/cli/cli/config/configfile.ConfigFile
cli/config/config_test.go:253:3: Fatalf format %q has arg config of wrong type *github.com/docker/cli/cli/config/configfile.ConfigFile
cli/config/config_test.go:288:3: Fatalf format %q has arg config of wrong type *github.com/docker/cli/cli/config/configfile.ConfigFile
cli/config/config_test.go:435:3: Fatalf format %q has arg config of wrong type *github.com/docker/cli/cli/config/configfile.ConfigFile
cli/config/config_test.go:448:3: Fatalf format %q has arg config of wrong type *github.com/docker/cli/cli/config/configfile.ConfigFile

DONE 1115 tests, 2 skipped, 6 errors in 215.984s
make: *** [Makefile:22: test-coverage] Error 2
Exited with code 2
```

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-03-04 20:19:14 +01:00
Sebastiaan van Stijn 6c4fbb7738
Fix: plugin-tests discarding current environment
By default, exec uses the environment of the current process, however,
if `exec.Env` is not `nil`, the environment is discarded:

e73f489494/src/os/exec/exec.go (L57-L60)

> If Env is nil, the new process uses the current process's environment.

When adding a new environment variable, prepend the current environment,
to make sure it is not discarded.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-03-04 20:18:24 +01:00
Ian Campbell c41c23813c Disable `docker system dial-stdio` on Windows
The `conn` here is `*winio.win32MessageBytePipe` which does not have a
`CloseRead` method (it does have `CloseWrite`) resulting in:

    docker@WIN-NUC0 C:\Users\docker>.\docker-windows-amd64.exe system dial-stdio
    the raw stream connection does not implement halfCloser

Also disable the path which uses this for cli-plugins on Windows.

Signed-off-by: Ian Campbell <ijc@docker.com>
2019-03-04 17:36:21 +00:00
Ian Campbell 38480d9a96 Use `$(DOCKER_RUN)` for cli plugins build.
Seems I rebased over b039db985a ("Make it possible to override the volume
mounts and shell for the dev container") at some point and failed to notice
that some of the variable names had changed.

In the meantime the underlying issue was fixed in #1698 but here we switch to
using `$(DOCKER_RUN)`. This means that these rules now use
`$(DOCKER_RUN_NAME_OPTION)` and thus obey the `$(DOCKER_CLI_CONTAINER_NAME)`
variable.

Signed-off-by: Ian Campbell <ijc@docker.com>
2019-03-04 10:17:58 +00:00
Sebastiaan van Stijn 8ddde26af6
Merge pull request #1702 from AkihiroSuda/connhelper-export
connhelper: export functions for other projects
2019-03-03 11:40:10 +01:00
Sebastiaan van Stijn 05fd2a87dc
Update containerd 1.2.4 and dependencies
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-03-02 13:44:57 +01:00
Sebastiaan van Stijn 087a7ee712
bump github.com/gorilla/mux v1.7.0
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-03-02 13:42:07 +01:00
Sebastiaan van Stijn 0fc0015173
bump docker/docker to 8aca18d631f3f72d4c6e3dc01b6e5d468ad941b8
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-03-02 13:41:42 +01:00
Akihiro Suda dbe7afbd04 connhelper: export functions for other projects
Exposed functions are planned to be used by `buildctl`:
https://github.com/moby/buildkit/issues/769

Signed-off-by: Akihiro Suda <suda.akihiro@lab.ntt.co.jp>
2019-03-02 21:11:49 +09:00
Sebastiaan van Stijn ee94f72e2c
Merge pull request #1698 from silvin-lubecki/fix-cross-dev-mounts
Fix unknown $(MOUNTS) variable in makefile plugins target
2019-03-01 18:48:25 +01:00
Silvin Lubecki 2c6b2ccbdd Fix unknown $(MOUNTS) variable in makefile plugins target
Signed-off-by: Silvin Lubecki <silvin.lubecki@docker.com>
2019-02-28 11:56:13 +01:00
Corey Quon d871451049
Fix issue where plugin command error exit code is printed out
Signed-off-by: Corey Quon <corey.quon@docker.com>
2019-02-26 09:39:07 -08:00
Sebastiaan van Stijn 2178fea84d
Merge pull request #1665 from jcrben/patch-1
Note caveat with detaching using key sequence
2019-02-26 16:56:31 +01:00
Sebastiaan van Stijn ff107b313a
Update to shellcheck v0.6.0
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-02-26 15:12:52 +01:00
Sebastiaan van Stijn 388646eab0
Use official shellcheck image
This patch switches the shellcheck image to use the official image
from Docker Hub.

Note that this does not yet update shellcheck to the latest version (v0.5.x);
Shellcheck v0.4.7 added some new checks, which makes CI currently fail, so will
be done in a follow-up PR. Instead, the v0.4.6 version is used in this PR, which
is closest to the same version as was installed in the image before this change;

```
docker run --rm docker-cli-shell-validate shellcheck --version
ShellCheck - shell script analysis tool
version: 0.4.4
license: GNU General Public License, version 3
website: http://www.shellcheck.net
```

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-02-26 15:10:38 +01:00
Sebastiaan van Stijn 69311b5ad9
Merge pull request #1691 from justincormack/nolibtool
Update PKCS11 library
2019-02-26 14:52:52 +01:00
Silvin Lubecki 9b837be8e2
Merge pull request #1689 from ijc/plugins-docker-system-info-format
Reformat the output of CLI plugins in `docker system info`
2019-02-26 14:51:39 +01:00
Silvin Lubecki 3174ca0e69
Merge pull request #1684 from thaJeztah/plugin_subcommand_detection
Show plugins as Management commands
2019-02-26 14:22:18 +01:00
Justin Cormack cb3e55bf58
Update PKCS11 library
The new version no longer links to libltdl which simplifies build
and dependencies.

See https://github.com/theupdateframework/notary/pull/1434

Signed-off-by: Justin Cormack <justin.cormack@docker.com>
2019-02-26 11:45:19 +00:00
Sebastiaan van Stijn f8c5f5d9b8
Show plugins as Management commands
Plugins are expected to be management commands ("docker <object> <verb>").

This patch modified the usage output to shown plugins in the "Management commands"
section.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-02-26 00:28:41 +01:00
Eric Curtin 23670968cc Add exit status to docker exec manpage
There's little way of knowing what each exit status means at present
because it's not documented. I'm assuming they are the same as docker
run.

Signed-off-by: Eric Curtin <ericcurtin17@gmail.com>
2019-02-25 18:59:18 +00:00
Ian Campbell 3c2832637a Reformat the output of CLI plugins in `docker system info`
This matches the `docker --help` output after 92013600f9.

Added a unit test case for unversioned.

Signed-off-by: Ian Campbell <ijc@docker.com>
2019-02-25 13:13:51 +00:00
Silvin Lubecki cdba45bd8b
Merge pull request #1652 from ijc/plugins-config
Add a field to the config file for plugin use.
2019-02-25 12:01:41 +01:00
Silvin Lubecki 11985c6250
Merge pull request #1675 from ulyssessouza/format-plugin-vendor-version-help
Reformat plugin's vendor position and add version on --help
2019-02-25 11:47:09 +01:00
Ian Campbell 90f0742984 Document the plugin field in the config file
Signed-off-by: Ian Campbell <ijc@docker.com>
2019-02-25 10:38:48 +00:00
Ian Campbell 20439aa662 Simplify cli plugin config file entry
Make it a simple `map[string]string` for now.

Added a unit test for it.

Signed-off-by: Ian Campbell <ijc@docker.com>
2019-02-25 10:38:48 +00:00
Ian Campbell 4eb642be46 Add a field to the config file for plugin use.
This is a bit manual (as the unit test attests) so we may find we want to add
some helpers/accessors, but this is enough to let plugins use it and to
preserve the information through round-trips.

Signed-off-by: Ian Campbell <ijc@docker.com>
2019-02-25 10:38:48 +00:00
Tibor Vass 3ddb3133f5
Merge pull request #1686 from thaJeztah/max_replicas_completion
Bash completion: add '--replicas-max-per-node'
2019-02-22 13:00:37 -08:00
Sebastiaan van Stijn cd7d2dfe87
Bash completion: add '--replicas-max-per-node'
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-02-22 11:20:29 +01:00
Sebastiaan van Stijn f1de399a54
Merge pull request #1612 from olljanat/replicas-max-per-node-cli
Add support for maximum replicas per node without stack
2019-02-22 11:17:18 +01:00
Olli Janatuinen f7f4d3bbb8 Add support for maximum replicas per node without stack
Signed-off-by: Olli Janatuinen <olli.janatuinen@gmail.com>
2019-02-22 09:53:21 +02:00
Brian Goff 35c39d3264
Merge pull request #1511 from wk8/wk8/small_makefile_tweaks
Make it possible to override the volume mounts and shell for the dev container
2019-02-21 11:06:10 -08:00
Ulysses Souza 92013600f9 Refactor plugins' vendor location on --help
- The placement of the vendor is now in the end of the line.
- A '*' is now added as suffix of plugins' top level commands.

Signed-off-by: Ulysses Souza <ulysses.souza@docker.com>
2019-02-21 17:54:11 +01:00
Sebastiaan van Stijn 06b837a7d7
Merge pull request #1654 from ijc/plugins-dial-stdio
cli-plugins: use system dial-stdio to contact the engine.
2019-02-21 12:11:24 +01:00
Sebastiaan van Stijn cfe12f4135
Merge pull request #1410 from olljanat/replicas-max-per-node
Add maximum replicas per node support to stack version 3.8
2019-02-20 13:22:18 +01:00
Olli Janatuinen 6347ab315b Add maximum replicas per node support to stack version 3.8
Signed-off-by: Olli Janatuinen <olli.janatuinen@gmail.com>
2019-02-19 11:25:12 +02:00
Ian Campbell 891b3d953e cli-plugins: use `docker system dial-stdio` to call the daemon
This means that plugins can use whatever methods the monolithic CLI supports,
which is good for consistency.

This relies on `os.Args[0]` being something which can be executed again to
reach the same binary, since it is propagated (via an envvar) to the plugin for
this purpose. This essentially requires that the current working directory and
path are not modified by the monolithic CLI before it launches the plugin nor
by the plugin before it initializes the client. This should be the case.

Previously the fake apiclient used by `TestExperimentalCLI` was not being used,
since `cli.Initialize` was unconditionally overwriting it with a real one
(talking to a real daemon during unit testing, it seems). This wasn't expected
nor desirable and no longer happens with the new arrangements, exposing the
fact that no `pingFunc` is provided, leading to a panic. Add a `pingFunc` to
the fake client to avoid this.

Signed-off-by: Ian Campbell <ijc@docker.com>
2019-02-18 11:53:37 +00:00
Sebastiaan van Stijn db166da03a
Merge pull request #1670 from stevejr/correct-dockerd-max-file-opt
Corrected max-file option - was incorrectly spelt as max-files
2019-02-13 14:30:23 +01:00
stevejr 04f88005c9 Corrected max-file option - was incorrectly spelt as max-files
Signed-off-by: Steve Richards <steve.richards@docker.com>
2019-02-13 12:29:34 +00:00
Silvin Lubecki 7f612bfca6
Merge pull request #1529 from lifubang/ttyexecresize
fixes 1492: tty initial size error
2019-02-12 10:31:17 +01:00
Lifubang 3fbffc682b tty initial size error
Signed-off-by: Lifubang <lifubang@acmcoder.com>
Signed-off-by: lifubang <lifubang@acmcoder.com>
2019-02-12 09:14:50 +08:00
Sebastiaan van Stijn 8271c94dfe
Merge pull request #1650 from MatteoOreficeIT/master
prevent bash process substitution error in cygwin
2019-02-11 15:32:56 +01:00
Matteo Orefice 0b49495b1d Prevent bash process substitution error in cygwin
Signed-off-by: Matteo Orefice <matteo.orefice@bites4bits.software>
2019-02-10 14:04:45 +00:00
Sebastiaan van Stijn 8af4e77994
Merge pull request #1588 from mdsouza2/add-quiet-flag-to-docker-pull
Add quiet flag to bash completion for docker pull
2019-02-08 23:18:31 +01:00
Sebastiaan van Stijn 5f2ef6a515
Merge pull request #1646 from ryanwilsonperkin/patch-1
Fix small typo
2019-02-08 23:04:48 +01:00