Commit Graph

202 Commits

Author SHA1 Message Date
Vincent Demeester eb4a4fe9b9
Merge pull request #965 from thaJeztah/fix-version-output
Fix docker version output alignment
2018-03-28 09:53:34 +02:00
Sebastiaan van Stijn 48eb7a082d
Fix docker version output alignment
Use tabwriter to print the version output

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2018-03-26 17:59:20 +02:00
Silvin Lubecki 54bb5ffeca Fix Kubernetes duplication in version command when the server already exposes one Kubernetes component
Signed-off-by: Silvin Lubecki <silvin.lubecki@docker.com>
2018-03-23 15:52:25 +01:00
Daniel Nephin 078cbc9c4b Convert assert.Check with
git grep -l -P '^\s+assert\.Check\(t, ' | \
    xargs perl -pi -e 's/^(\s+assert)\.Check(\(t, (?!is).*(\.Execute\(|\.Set\(|\.Write\(|\.Close\(|\.Untar\(|\.WriteFile\(|Validate\().*\)$)/\1.NilError\2/'

Signed-off-by: Daniel Nephin <dnephin@docker.com>
2018-03-06 15:43:53 -05:00
Daniel Nephin 5155cda716 Post migration fixes
Fix tests that failed when using cmp.Compare()
internal/test/testutil/assert
InDelta
Fix DeepEqual with kube metav1.Time
Convert some ErrorContains to assert

Signed-off-by: Daniel Nephin <dnephin@docker.com>
2018-03-05 19:41:17 -05:00
Daniel Nephin 39c2ca57c1 Automated migration
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2018-03-05 19:41:17 -05:00
Daniel Nephin 93615dd967 Update some assertions.
and fix some tests

Signed-off-by: Daniel Nephin <dnephin@docker.com>
2018-03-05 17:15:24 -05:00
Silvin Lubecki 854aad8927 Print Stack API version in version command
* Resolve Stack API using Kubernetes discovering API
* Refactor Kubernetes flags parsing

Signed-off-by: Silvin Lubecki <silvin.lubecki@docker.com>
2018-02-26 01:16:49 +01:00
Silvin Lubecki ad409767bf Activate kubernetes only when experimental cli is enabled
* Refactor tests on version and kubernetes switch
* Fix rebase errors
* Refactor for gocyclo linter

Signed-off-by: Silvin Lubecki <silvin.lubecki@docker.com>
2017-12-28 14:40:10 +01:00
Vincent Demeester 5d375b348a Set a global orchestrator flag
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2017-12-28 14:40:10 +01:00
Silvin Lubecki ba5d0d8ff5 Move e2e test on version command to unit tests
* Refactor a little version command

Signed-off-by: Silvin Lubecki <silvin.lubecki@docker.com>
2017-12-26 11:46:59 +01:00
Vincent Demeester dedd0db51a Refactor stack command
- Define command and subcommands only once
- Use annotations for k8s or swarm specific flags or subcommands

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2017-12-26 11:45:56 +01:00
Vincent Demeester 0508c09494 Move cli/command/orchestrator to cli/command
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2017-12-26 11:25:22 +01:00
Vincent Demeester 8417e49792 Add support for kubernetes in docker cli
- Add support for kubernetes for docker stack command
- Update to go 1.9
- Add kubernetes to vendors
- Print orchestrator in docker version command

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
Signed-off-by: Silvin Lubecki <silvin.lubecki@docker.com>
2017-12-26 11:22:32 +01:00
Vincent Demeester 84fe1a1b5b
Add support for experimental Cli configuration
Allow to mark some commands and flags experimental on cli (i.e. not
depending to the state of the daemon). This will allow more flexibility
on experimentation with the cli.

Marking `docker trust` as cli experimental as it is documented so.

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2017-12-22 14:48:47 +01:00
Brian Goff 7138d6e301 Sort component details in template
Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2017-12-07 02:04:10 +01:00
Tibor Vass 5f4c5f8bb6 Add platform and its components to docker version output
The Server section of version output is now composed of an Engine
component and potentially more, based on what the /version endpoint
returns.

Signed-off-by: Tibor Vass <tibor@docker.com>
2017-12-07 02:04:10 +01:00
Daniel Nephin c0d004f7cf Update gometalinter
and enable the new WarnUnmatchedDirective to warn if a nolint is unnecessary.
remove some unnecessary nolint

Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-10-26 12:21:02 -04:00
Daniel Nephin 4205416c9b Update code for upstream cobra
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-10-25 14:49:26 -04:00
Daniel Nephin 32612058cb Use a local constant
This constant is going to be removed from jsonlog package.

Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-09-22 17:59:46 -04:00
Sebastiaan van Stijn 6f1b510843
Refactor/cleanup of docker info
Some mild refactoring of the docker info command;

- Use `fmt.Fprinln()` instead of `fmt.Fprintf()` where possible
- Rename `fprintfIfNotEmpty()` to `fprintlnNonEmpty()`, and removed
  return variables, because they were not used. `fprintlnNonEmpty()`
  now uses fmt.Fprintln()` instead of `fmt.Fprintf()`, because
  formatting was not used.
- Use `fprintlnNonEmpty()` to get rid of some `if` statements
- Extract printing Swarm-related information to a `printSwarmInfo()` function
- Change `Http Proxy` and `Https Proxy` to `HTTP Proxy` / `HTTPS Proxy`

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2017-09-11 15:13:06 +02:00
Ying Li 3428b78e96 Include whether the managers in the swarm are autolocked as part of `docker info`.
Signed-off-by: Ying Li <ying.li@docker.com>
2017-08-25 16:33:46 -07:00
Daniel Nephin b3f843afe2 Move internal/test package out of cli.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-08-22 10:14:25 -04:00
Vincent Demeester a6800f95fa
Import `docker/docker/pkg/templates` to cli
This package will be deprecated/removed from `docker/docker/pkg` and
is mainly used for the cli format options. Let's import it and
maintain here.

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2017-08-08 17:26:24 +02:00
Sebastiaan van Stijn 3c095dc546
Error if "until" filter is combined with "--volumes" on system prune
The "until" filter is supported by all object types, except for
volumes.

Before this patch, the "until" filter would attempted to be used for the volume
prune endpoint, resulting in an error being returned by the daemon, and
further prune endpoints (networks, images) to be skipped.

    $ docker system prune --filter until=24h --filter label=label.foo=bar

    WARNING! This will remove:
            - all stopped containers
            - all volumes not used by at least one container
            - all networks not used by at least one container
            - all dangling images
    Are you sure you want to continue? [y/N] y
    Error response from daemon: Invalid filter 'until'

    Calling POST /v1.30/containers/prune?filters=%7B%22label%22%3A%7B%22label.foo%3D%3Dbar%22%3Atrue%7D%2C%22until%22%3A%7B%2224h%22%3Atrue%7D%7D
    Calling POST /v1.30/volumes/prune?filters=%7B%22label%22%3A%7B%22label.foo%3D%3Dbar%22%3Atrue%7D%2C%22until%22%3A%7B%2224h%22%3Atrue%7D%7D
    Handler for POST /v1.30/volumes/prune returned error: Invalid filter 'until'
    Error response from daemon: Invalid filter 'until'

With this patch, an error is produced instead, preventing "partial" prune.

    $ docker system prune --filter until=24h --filter label=foo==bar --volumes
    ERROR: The "until" filter is not supported with "--volumes"

Note that `docker volume prune` does not have this problem, and produces an
error if the `until` filter is used;

    $ docker volume prune --filter until=24h

    WARNING! This will remove all volumes not used by at least one container.
    Are you sure you want to continue? [y/N] y
    Error response from daemon: Invalid filter 'until'

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2017-07-21 12:11:53 +02:00
Daniel Nephin ff350a04cb Remove unnecessary prune function aliases.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-07-18 12:25:45 -04:00
Vincent Demeester a14762c6d2 Merge pull request #350 from thaJeztah/unexport-commands
Unexport subcommands
2017-07-18 17:17:01 +02:00
Sebastiaan van Stijn 9c7b0d74cd
Unexport subcommands
These commands were only used as subcommands, so did
not have to be exported.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2017-07-18 15:26:45 +02:00
Sebastiaan van Stijn 73163ee78b
Small refactor in system prune
Adapt "image prune" and "build cache prune" to have
the same signature as the other prune commands, so
that they can all be added to the "pruneFuncs" array.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2017-07-18 15:13:11 +02:00
Kenfe-Mickaël Laventure 19efbc85f4 Merge pull request #345 from vdemeester/remove-prune-package
Remove useless prune package 👼
2017-07-18 14:46:53 +02:00
Vincent Demeester 3f4d91508e
Remove useless prune package 👼
The `cli/command/prune` just does some aliasing of `Prune*` methods,
doesn't have any use.

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2017-07-18 09:49:02 +02:00
Sebastiaan van Stijn 6c3a448ecb
Fix: skip build-cache prune on unsupported versions
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2017-07-17 11:55:35 +02:00
Harald Albers 849b0e96a0 system prune: only warn about volumes if --volumes is given
Signed-off-by: Harald Albers <github@albersweb.de>
2017-06-29 15:07:21 +02:00
Tonis Tiigi b95638a5ac Use long running session in builder
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>

Add incremental context send support

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2017-06-26 16:30:01 -07:00
Daniel Nephin 3724fb7f37 Add gosimple lint
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-06-14 16:55:08 -07:00
Daniel Nephin 3bf0317fea Add unconvert linter
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-06-14 16:54:27 -07:00
Yong Tang 657457ee2c Use `scope=swarm` for service related network inspect.
This fix use `scope=swarm` for service related network inspect.
The purpose is that, in case multiple networks with the same
name exist in different scopes, it is still possible to obtain
the network for services.

This fix is related to moby/moby#33630 and docker/cli#167

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2017-06-13 20:26:12 +00:00
Brian Goff 37fd6128dc Don't prune volumes on `docker system prune`
Volumes tend to carry important data and pruning them on `docker system
prune` can easily cause unwanted data loss.

Let's play it safe and not prune volumes on `system prune` by default,
and instead provide an option.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2017-05-30 12:50:30 -04:00
Gaetan de Villele 1cc1f54d90 make system prune “--filter” flag available only for docker 17.04 (api v1.28) and newer
Signed-off-by: Gaetan de Villele <gdevillele@gmail.com>
2017-05-17 12:36:09 -07:00
Ying Li 3fe8321d0c Provide command line tool to view and rotate swarm's currently CA root certificate.
Signed-off-by: Ying Li <ying.li@docker.com>
2017-05-16 14:31:15 -07:00
Vincent Demeester d7f6563efc
Update cli imports to using local package
Also, rename a bunch of variable to not *shadow* the `opts` package
name.

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2017-05-15 14:45:19 +02:00
cyli b75858eb09 Propagate the swarm cluster and node TLS info provided by the REST API
responses to the CLI. In `node ls`, display only whether the nodes' TLS
info matches the cluster's TLS info, or whether the node needs cert rotation.

Signed-off-by: Ying Li <ying.li@docker.com>
2017-05-10 17:49:25 -07:00
Stephen J Day 9a892f1bbc
cli/command/system: remove ioutils dependency
Signed-off-by: Stephen J Day <stephen.day@docker.com>
2017-05-10 13:38:06 -07:00
Kenfe-Mickael Laventure cf51bde7d9 Display proper version information
- The cli version defaults to "unknown-version" unless set via the VERSION env var
- The commit version can be overridden via GITCOMMIT env var
- The build time can be overridden via BUILDTIME env var

Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
2017-05-09 14:22:51 -07:00
Daniel Nephin c31d25653f Add line length linter
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-05-08 15:57:56 -04:00
Daniel Nephin 37ccc00d0e Add interfacer linter
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-05-08 15:57:50 -04:00
Gaetan de Villele 295140edf2 cli: gofmt + goimports
Signed-off-by: Gaetan de Villele <gdevillele@gmail.com>
2017-05-08 10:51:30 -07:00
Tibor Vass 57230a7212 rm client and vendor it instead
Signed-off-by: Tibor Vass <tibor@docker.com>
2017-05-08 10:33:56 -07:00
Brian Goff c44e74e676 Add logdrivers to /info
This is required for swarmkit to be able to filter based on log driver.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2017-05-03 17:46:39 -07:00
Daniel Nephin 08af0f28c5 Add gocycle lint
Whitelist some existing offenders, and use a high limit for now.
This limit should decrese over time.

Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-05-02 17:57:46 -04:00
Daniel Nephin 10641c2aae Update imports.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-04-17 18:07:56 -04:00
Daniel Nephin 1630fc40f8 Import docker/docker/cli
Signed-off-by: Daniel Nephin <dnephin@gmail.com>
2017-04-17 17:40:59 -04:00