Commit Graph

162 Commits

Author SHA1 Message Date
38854e0b6a Remove pkg/testutil/assert in favor of testify
I noticed that we're using a homegrown package for assertions. The
functions are extremely similar to testify, but with enough slight
differences to be confusing (for example, Equal takes its arguments in a
different order). We already vendor testify, and it's used in a few
places by tests.

I also found some problems with pkg/testutil/assert. For example, the
NotNil function seems to be broken. It checks the argument against
"nil", which only works for an interface. If you pass in a nil map or
slice, the equality check will fail.

In the interest of avoiding NIH, I'm proposing replacing
pkg/testutil/assert with testify. The test code looks almost the same,
but we avoid the confusion of having two similar but slightly different
assertion packages, and having to maintain our own package instead of
using a commonly-used one.

In the process, I found a few places where the tests should halt if an
assertion fails, so I've made those cases (that I noticed) use "require"
instead of "assert", and I've vendored the "require" package from
testify alongside the already-present "assert" package.

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
Upstream-commit: 7059a96e2e
Component: cli
2017-04-14 12:03:21 -07:00
c367f0aed1 updates for review comments
- runtimeUrl -> type_url
- runtimes -> runtime

Signed-off-by: Evan Hazlett <ejhazlett@gmail.com>
Upstream-commit: 58e69bfd5a
Component: cli
2017-04-11 14:02:01 -04:00
eac52ae0bb filter services by runtime; default to container
Signed-off-by: Evan Hazlett <ejhazlett@gmail.com>
Upstream-commit: 06a91d315c
Component: cli
2017-04-11 14:02:01 -04:00
e51ef4acbb Merge pull request #32284 from aaronlehmann/fix-service-defaults
Improve default handling for "service create"
Upstream-commit: 35fc4e4ef3
Component: cli
2017-04-11 13:06:53 +02:00
1bd853679b Merge pull request #32462 from dperny/service-logs-general-availability
Remove experimental from service logs
Upstream-commit: 7a0d2dbcc2
Component: cli
2017-04-10 18:30:20 -07:00
90352966e3 Make the CLI show defaults from the swarmkit defaults package
If no fields related to an update config or restart policy are
specified, these structs should not be created as part of the service,
to avoid hardcoding the current defaults.

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
Upstream-commit: d0e8fe18fc
Component: cli
2017-04-10 13:41:18 -07:00
0a65a7c11d Change "service inspect" to show defaults in place of empty fields
This adds a new parameter insertDefaults to /services/{id}. When this is
set, an empty field (such as UpdateConfig) will be populated with
default values in the API response. Make "service inspect" use this, so
that empty fields do not result in missing information when inspecting a
service.

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
Upstream-commit: e62ea2e54d
Component: cli
2017-04-10 13:41:16 -07:00
b75841303e Remove experimental from service logs
Service logs API is now stable. Service logs now support all features,
except retrieving details provided to the log driver.

Signed-off-by: Drew Erny <drew.erny@docker.com>
Upstream-commit: a29c0a6418
Component: cli
2017-04-10 13:40:45 -07:00
8c22ac9602 Show network names in "docker service inspect --pretty"
Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
Upstream-commit: 008f6d1b3f
Component: cli
2017-04-07 16:46:25 -07:00
d9f91ded10 cli: Allow service's networks to be updated
Resolve networks IDs on the client side.

Avoid filling in deprecated Spec.Networks field.

Sort networks in the TaskSpec for update stability.

Add an integration test for changing service networks.

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
Upstream-commit: 808ca15347
Component: cli
2017-04-07 16:46:25 -07:00
94a0b24057 Merge pull request #32339 from aluzzardi/selinux
services: Add support for Credential Spec and SELinux
Upstream-commit: 1b132eb374
Component: cli
2017-04-08 01:37:17 +02:00
e5c62e50ec Merge pull request #32154 from dperny/refactor-logs
Refactor logs and support service logs with TTY 
Upstream-commit: 5cf0c294d4
Component: cli
2017-04-07 18:06:50 -04:00
02ce22cff9 services: Add support for Credential Spec and SELinux
- Defined "normalized" type for Credential Spec and SELinux
- Added --credential-spec to docker service create & update
- SELinux is API only at the time

Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
Upstream-commit: 032d4098fb
Component: cli
2017-04-07 11:30:54 -07:00
7ca54a3979 refactor logs and support service logs /w tty
Refactor container logs system to make communicating log messages
internally much simpler. Move responsibility for marshalling log
messages into the REST server. Support TTY logs. Pave the way for fixing
the ambiguous bytestream format. Pave the way for fixing details.

Signed-off-by: Drew Erny <drew.erny@docker.com>
Upstream-commit: 938bf846e3
Component: cli
2017-04-06 17:54:11 -07:00
cb9af8f804 Add support for update order
This parameter controls the order of operations when rolling out an
update task. Either the old task is stopped before starting the new one,
or the new task is started first, and the running tasks will briefly
overlap.

This commit adds Rollout to the API, and --update-order / --rollback-order
flags to the CLI.

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
Upstream-commit: 2805c2e929
Component: cli
2017-04-06 17:23:36 -07:00
832db1aaae Merge pull request #28938 from elifa/master
Grace period option to health checks.
Upstream-commit: cd315197e3
Component: cli
2017-04-06 19:23:56 +02:00
1a49893201 Added start period option to health check.
Signed-off-by: Elias Faxö <elias.faxo@gmail.com>
Upstream-commit: a58f798fdf
Component: cli
2017-04-06 12:35:34 +02:00
9696fa517f cli: Preserve order of environment variables
Unless we are adding or removing environment variables, their order
shouldn't be changed. This makes it look like the service's TaskSpec has
changed relative to the old version of the service, and containers need
to be redeployed.

The existing code always rebuilds the list of environment variables by
converting them to a map and back, but there's no reason to do this if
no environment variables are being added.

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
Upstream-commit: 71d1b0507e
Component: cli
2017-04-04 18:16:57 -07:00
d9725d161b Merge pull request #32015 from dperny/service-logs-support-task-logs
Add Support for Service Task Logs
Upstream-commit: 4284efd232
Component: cli
2017-04-04 00:15:13 -07:00
1ea7589fcb Add support for task and arbitrary combo logs
Refactored the API to more easily accept new endpoints. Added REST,
client, and CLI endpoints for getting logs from a specific task. All
that is needed after this commit to enable arbitrary service log
selectors is a REST endpoint and handler.

Task logs can be retrieved by putting in a task ID at the CLI instead of
a service ID.

Signed-off-by: Drew Erny <drew.erny@docker.com>
Upstream-commit: b4ca6ebb09
Component: cli
2017-04-03 18:40:54 -07:00
ec52e4b8df Synchronous service create and service update
Change "service create" and "service update" to wait until the creation
or update finishes, when --detach=false is specified. Show progress bars
for the overall operation and for each individual task (when there are a
small enough number of tasks), unless "-q" / "--quiet" is specified.

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
Upstream-commit: d8ab3840e0
Component: cli
2017-04-03 09:46:01 -07:00
9942af3507 Add entrypoint flags to service cli.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: 951fdd11cd
Component: cli
2017-03-28 11:24:19 -07:00
1a3472a804 Merge pull request #30810 from allencloud/make-secret-ls-support-filter
make secret ls support filters in CLI
Upstream-commit: d14a4d4231
Component: cli
2017-03-28 13:43:19 +02:00
6445b15529 make secret ls support filters in CLI
Signed-off-by: allencloud <allen.sun@daocloud.io>
Upstream-commit: d6490e5de9
Component: cli
2017-03-27 10:16:45 +08:00
25b1b9c3c2 Replace fmt.Errorf() with errors.Errorf() in the cli
Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: e9d6193dfd
Component: cli
2017-03-24 16:58:07 -04:00
540d48f844 Merge pull request #31896 from aaronlehmann/move-secretrequestoption
api: Remove SecretRequestOption type
Upstream-commit: 2222824fd9
Component: cli
2017-03-16 21:31:15 +01:00
8698efadf8 api: Remove SecretRequestOption type
This type is only used by CLI code. It duplicates SecretReference in the
types/swarm package. Change the CLI code to use that type instead.

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
Upstream-commit: 395081fc6b
Component: cli
2017-03-16 11:20:31 -07:00
c74c88f8f7 Add missing API version annotations to commands
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Upstream-commit: d5d0d7795b
Component: cli
2017-03-16 13:40:12 +01:00
970755e1f9 Merge pull request #31775 from erxian/misleading-default-for-update-monitor-duration-flag
misleading default for --update-monitor duration
Upstream-commit: 96551fee53
Component: cli
2017-03-16 10:13:26 +01:00
559c313548 improve semantics of utility function in cli/command/service
Signed-off-by: Gaetan de Villele <gdevillele@gmail.com>
Upstream-commit: 59c79325bc
Component: cli
2017-03-15 13:49:52 -07:00
f462549c13 misleading default for --update-monitor duration
Signed-off-by: erxian <evelynhsu21@gmail.com>
Upstream-commit: 88a99ae70e
Component: cli
2017-03-15 14:20:02 +08:00
37cb7be49a Merge pull request #31809 from vieux/bump_api
bump API to 1.28
Upstream-commit: 5ce6afc459
Component: cli
2017-03-14 11:53:52 -07:00
29417b0159 bump API to 1.28
Signed-off-by: Victor Vieux <victorvieux@gmail.com>
Upstream-commit: a972d43e48
Component: cli
2017-03-14 09:32:50 -07:00
2e62b306a8 Merge pull request #31500 from dperny/fix-service-logs-cli
Add tail and since to service logs
Upstream-commit: 7ce0cb0cf0
Component: cli
2017-03-14 14:19:29 +01:00
aa331e2253 Add tail and since to service logs
This change adds the ability to do --tail and --since on docker service
logs. It wires up the API endpoints to each other and fixes some older
bugs. It adds integration tests for these new features.

Signed-off-by: Drew Erny <drew.erny@docker.com>
Upstream-commit: 7ce96255fd
Component: cli
2017-03-10 14:59:00 -08:00
ca1b295553 Fixed concerns, updated, and rebased PR.
Signed-off-by: Drew Erny <drew.erny@docker.com>
Upstream-commit: 3cda347b3d
Component: cli
2017-03-08 16:35:58 -08:00
ffb09e625f service logs: Improve formatting
- Align output. Previously, output would end up unaligned because of
longer task names (e.g. web.1 vs web.10)
- Truncate task IDs and add a --no-trunc option
- Added a --no-ids option to remove IDs altogether
- Got rid of the generic ID Resolver as we need more customization.

Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
Upstream-commit: 1d379b9691
Component: cli
2017-03-08 14:08:04 -08:00
4009dade43 Implement server-side rollback, for daemon versions that support this
Server-side rollback can take advantage of the rollback-specific update
parameters, instead of being treated as a normal update that happens to
go back to a previous version of the spec.

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
Upstream-commit: 78c204ef79
Component: cli
2017-03-03 16:33:34 -08:00
b3a86717f1 Add support for rollback flags
Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
Upstream-commit: 8de01fb7a8
Component: cli
2017-03-03 16:33:34 -08:00
3fc9649978 Add support for the "rollback" failure action
Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
Upstream-commit: 5232868f46
Component: cli
2017-03-03 16:33:34 -08:00
f2d2a3e9a6 Merge pull request #30725 from aaronlehmann/topology
Topology-aware scheduling
Upstream-commit: ff11b0523d
Component: cli
2017-03-03 15:01:12 +01:00
fd3a8adfe2 Merge pull request #30754 from yongtang/25696-stop-signal
Add `--stop-signal` for `service create` and `service update`
Upstream-commit: decce9cad1
Component: cli
2017-03-01 18:10:57 +01:00
3d78fa6385 Topology-aware scheduling
This adds support for placement preferences in Swarm services.

- Convert PlacementPreferences between GRPC API and HTTP API
- Add --placement-pref, --placement-pref-add and --placement-pref-rm to CLI
- Add support for placement preferences in service inspect --pretty
- Add integration test

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
Upstream-commit: 21d5d1fa9d
Component: cli
2017-02-27 13:29:54 -08:00
1195f9c5ee Delete dots to align with other commands description
Signed-off-by: yupengzte <yu.peng36@zte.com.cn>
Upstream-commit: 5b67f20a91
Component: cli
2017-02-23 16:46:08 +08:00
e1a9ffba6b Add --stop-signal for service create and service update
This fix tries to address the issue raised in 25696 where
it was not possible to specify `--stop-signal` for `docker service create`
and `docker service update`, in order to use special signal to stop
the container.

This fix adds `--stop-signal` and update the `StopSignal` in `Config`
through `service create` and `service update`.

Related docs has been updated.

Integration test has been added.

This fix fixes 25696.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
Upstream-commit: 9037f77d31
Component: cli
2017-02-21 15:19:45 -08:00
8daaeb5db9 Merge pull request #30814 from YuPengZTE/devSwarmCliExplain
fix the type
Upstream-commit: 0eacd8a363
Component: cli
2017-02-21 00:59:58 +01:00
d7f5ca1d45 add missing API changes
Signed-off-by: Victor Vieux <victorvieux@gmail.com>
Upstream-commit: e858f5f7c4
Component: cli
2017-02-19 01:33:43 -08:00
d296e1a385 Merge pull request #28213 from yongtang/11062016-service-ps-format
Add `--format` to `docker service ps`
Upstream-commit: 91da14c343
Component: cli
2017-02-17 10:23:18 -08:00
8a6ea28359 Merge pull request #29819 from vdemeester/service-validate-publish-simple-syntax
Make sure we validate simple syntax on service commands
Upstream-commit: 1de08ac417
Component: cli
2017-02-15 12:31:46 -08:00
193f92812e fix the type
Signed-off-by: yupengzte <yu.peng36@zte.com.cn>
Upstream-commit: 03aed78d68
Component: cli
2017-02-14 09:54:27 +08:00