Commit Graph

80 Commits

Author SHA1 Message Date
142883d5b3 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: 6052f2b3969feadb01662d8e2f30337d9c7f61af
Component: engine
2017-04-14 12:03:21 -07:00
3cad237312 updates for review comments
- runtimeUrl -> type_url
- runtimes -> runtime

Signed-off-by: Evan Hazlett <ejhazlett@gmail.com>
Upstream-commit: 8c2c69d31ec0ce4a9b125ca3cbf7b04ee81ce579
Component: engine
2017-04-11 14:02:01 -04:00
21134b3d48 filter services by runtime; default to container
Signed-off-by: Evan Hazlett <ejhazlett@gmail.com>
Upstream-commit: f71bdc67a21a63b901e484a0650bea36d15eece5
Component: engine
2017-04-11 14:02:01 -04:00
b214dc7ba1 stack rm should accept multiple arguments
Signed-off-by: Arash Deshmeh <adeshmeh@ca.ibm.com>
Upstream-commit: ff0899ad2f9f94f541b45047798dbd469d72038a
Component: engine
2017-04-05 01:08:37 -04:00
69182c0d50 Merge pull request #31709 from dnephin/better-errors
Replace fmt.Errorf() with errors.Errorf() in the cli
Upstream-commit: 99aaf6b9233d0a0a577e79f536288bca36794c50
Component: engine
2017-03-28 10:17:46 +02:00
333f4f4d72 Set the alias to the service name instead of the network name
This makes it work a little closer to compose part and it is more
correct 👼

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
Upstream-commit: ee08c8542aed078e06f1d9c559d62560e97f371d
Component: engine
2017-03-27 11:42:15 +02:00
7cc7eec39f Replace fmt.Errorf() with errors.Errorf() in the cli
Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: 7b7ea8ab810190018346cb7d84c161bb94f7ca60
Component: engine
2017-03-24 16:58:07 -04:00
bddb190597 Merge pull request #30781 from AkihiroSuda/fix-stack-env
compose: fix environment interpolation from the client
Upstream-commit: 8bc703804de45bafe4e6362d150d6c74db8dd7db
Component: engine
2017-03-17 15:56:50 +01:00
6a9291e20f Add --prune to stack deploy.
Add to command line reference.

Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: 644fd804fce63499812259331b0a9f2a4a3ebcc4
Component: engine
2017-03-14 16:09:28 -04:00
258019e01c Fix environment resolving.
Load from env should only happen if the value is unset.
Extract a buildEnvironment function and revert some changes to tests.

Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: a9c86b63c03fc3557748d7792c11041387cb93d9
Component: engine
2017-03-14 16:00:43 -04:00
52e6564dcd compose: fix environment interpolation from the client
For an environment variable defined in the yaml without value,
the value needs to be propagated from the client, as in Docker Compose.

Signed-off-by: Akihiro Suda <suda.akihiro@lab.ntt.co.jp>
Upstream-commit: ea43c33330ec9a1e9a9b8a85348c1757fdae65c4
Component: engine
2017-03-14 15:59:40 -04:00
ff11389227 Enhance network inspect to show all tasks, local & non-local, in swarm mode
Signed-off-by: Santhosh Manohar <santhosh@docker.com>
Upstream-commit: 14f76a21db71c5a817cb4d1e27f9940cefd5c820
Component: engine
2017-03-13 17:52:08 -07:00
b7f72f988d Merge pull request #28213 from yongtang/11062016-service-ps-format
Add `--format` to `docker service ps`
Upstream-commit: b1debf1374ca7be7e7b4d4fcd41eceaf8b7cf153
Component: engine
2017-02-17 10:23:18 -08:00
5f5d704cba split compose deploy from deploy.go
Signed-off-by: allencloud <allen.sun@daocloud.io>
Upstream-commit: f46a14f7b611276256c7e8148e87c1d570201d74
Component: engine
2017-02-17 17:13:31 +08:00
492545a1db Sort docker stack ls by name
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
Upstream-commit: 97d85127c231d1b0823a3459d638dbd4f0ba1460
Component: engine
2017-02-16 14:30:39 +01:00
08e260c901 Add --format to docker service ps
This fix tries to address the issue raised in 27189 where
it is not possible to support configured formatting stored in
config.json.

Since `--format` was not supported in `docker service ps`,
the flag `--format` has also been added in this fix.

This fix
1. Add `--format` to `docker service ps`
2. Add `tasksFormat` to config.json
3. Add `--format` to `docker stack ps`
4. Add `--format` to `docker node ps`

The related docs has been updated.

An integration test has been added.

This fix fixes 27189.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
Upstream-commit: f8c7c921d905615acf1d2c6577ae1cfb4600bec0
Component: engine
2017-02-10 16:53:04 -08:00
256ff53fbd Add --format to docker service ls
This fix tries to improve the display of `docker service ls`
and adds `--format` flag to `docker service ls`.

In addition to `--format` flag, several other improvement:
1. Updates `docker stacks service`.
2. Adds `servicesFormat` to config file.

Related docs has been updated.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
Upstream-commit: 000f0403d9084e8da427bafac3b594a822b3c386
Component: engine
2017-02-01 08:33:19 -08:00
c74a5fc7cf Merge pull request #30186 from thaJeztah/add-version-annotation-to-flags
Add version annotation to various flags added in 1.13
Upstream-commit: a08da82a28848b4857e86b9a493143e9ac3fcee6
Component: engine
2017-01-30 12:33:36 -08:00
3526619d18 remove cli/command/secrets/utils.go
Signed-off-by: allencloud <allen.sun@daocloud.io>
Upstream-commit: 51b37a7983435edcd2331571bcb85b2686cbd006
Component: engine
2017-01-29 13:32:49 +08:00
9e92b82db9 Remove secrets as part of stack remove.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: f0a5531c46c3fe602b372de434125a3cd046a0b6
Component: engine
2017-01-26 11:33:15 -05:00
5ed83fcbc5 Add integration test for stack deploy with secrets.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: 6ec84ef76df30663d5728f903b314f4486587135
Component: engine
2017-01-26 11:33:15 -05:00
fc26836a78 Implement secret types for compose file.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: 9419e7df2b54b684bef6c787239a2c92fbb4acda
Component: engine
2017-01-26 11:33:15 -05:00
be728731d1 Add version annotation to various flags added in 1.13
Pull request https://github.com/docker/docker/pull/27745 added support for the
client to talk to older versions of the daemon. Various flags were added to
docker 1.13 that are not compatible with older daemons.

This PR adds annotations to those flags, so that they are automatically hidden
if the daemon is older than docker 1.13 (API 1.25).

Not all new flags affect the API (some are client-side only). The following
PR's added new flags to docker 1.13 that affect the API;

- https://github.com/docker/docker/pull/23430 added `--cpu-rt-period`and `--cpu-rt-runtime`
- https://github.com/docker/docker/pull/27800 / https://github.com/docker/docker/pull/25317 added `--group` / `--group-add` / `--group-rm`
- https://github.com/docker/docker/pull/27702 added `--network` to `docker build`
- https://github.com/docker/docker/pull/25962 added `--attachable` to `docker network create`
- https://github.com/docker/docker/pull/27998 added `--compose-file` to `docker stack deploy`
- https://github.com/docker/docker/pull/22566 added `--stop-timeout` to `docker run` and `docker create`
- https://github.com/docker/docker/pull/26061 added `--init` to `docker run` and `docker create`
- https://github.com/docker/docker/pull/26941 added `--init-path` to `docker run` and `docker create`
- https://github.com/docker/docker/pull/27958 added `--cpus` on `docker run` / `docker create`
- https://github.com/docker/docker/pull/27567 added `--dns`, `--dns-opt`, and `--dns-search` to `docker service create`
- https://github.com/docker/docker/pull/27596 added `--force` to `docker service update`
- https://github.com/docker/docker/pull/27857 added `--hostname` to `docker service create`
- https://github.com/docker/docker/pull/28031 added `--hosts`, `--host-add` / `--host-rm` to `docker service create` and `docker service update`
- https://github.com/docker/docker/pull/28076 added `--tty` on `docker service create` / `docker service update`
- https://github.com/docker/docker/pull/26421 added `--update-max-failure-ratio`, `--update-monitor` and `--rollback` on `docker service update`
- https://github.com/docker/docker/pull/27369 added `--health-cmd`, `--health-interval`, `--health-retries`, `--health-timeout` and `--no-healthcheck` options to `docker service create` and `docker service update`

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Upstream-commit: bbbddeebba5fb8856dc977eada90c22f1f20c394
Component: engine
2017-01-16 18:21:20 +01:00
c1d7d93cb3 Few stack deploy network fixes
- Make sure we use the correct network name for external ones.
- Make the default network overridable and only creates networks that
  are used by services — so that default network is only created if a
  service doesn't declare a network.

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
Upstream-commit: 3191f5809bc1233bbf2103d2432b75cac93567bb
Component: engine
2017-01-10 10:29:09 +01:00
edfbbc6ec9 Replace vendor of aanand/compose-file with a local copy.
Add go-bindata for including the schema.

Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: f5af9b9738892b5988f987ce5fbce6e31a10e768
Component: engine
2016-12-27 16:17:24 -05:00
98d0c42181 Remove docker stack ps -a to match removal of docker service/node ps -a
In #28507 and #28885, `docker service/node ps -a` has been removed so that
information about slots are show up even without `-a` flag.

The output of `docker stack ps` reused the same output as `docker service/node ps`.
However, the `-a` was still there. It might make sense to remove `docker stack ps -a`
as well to bring consistency with `docker service/node ps`.

This fix is related to #28507, #28885, and #25983.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
Upstream-commit: 9155e14e77a8235791a6de752f6f43e83308e23d
Component: engine
2016-12-26 13:47:43 -08:00
c9e434865c Move pkg to cli/compose/convert
Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: 643fd775edb0a05d649f4d484e966428eb3a6b09
Component: engine
2016-12-16 12:27:31 -05:00
930d936818 Move ConvertService to composetransform package.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: 655e48e65309f0191bbbb8b2e9730b6976e148cd
Component: engine
2016-12-16 12:20:07 -05:00
cb4b458233 Move ConvertVolumes to composetransform package.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: 7685e80fc9cb79206d81757eee071f0244323600
Component: engine
2016-12-16 11:51:13 -05:00
20aacdd131 Move ConvertNetworks to composetransform package.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: 6b778c96336fe9c0bcfea477092aab8cdfc0c896
Component: engine
2016-12-16 11:51:13 -05:00
97f2808afa Remove --port and update --publish for services to support syntaxes
Add support for simple and complex syntax to `--publish` through the
use of `PortOpt`.

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
Upstream-commit: 75bf18c9f01d050e5fccab98fb671306c7c5f6d2
Component: engine
2016-12-11 23:14:54 +01:00
4ef31d0696 Handle logging in compose to swarm
Logging configuration was completely ignore when deploy a compose file
to swarm. This fixes it.

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
Upstream-commit: 806cc1e0f815d7c4e4b7bd4fa537e3d4c3535e23
Component: engine
2016-12-05 15:18:36 +01:00
5ee1b1203e Merge pull request #28876 from vdemeester/28835-better-handling-of-external-networks
stack deploy: handle external network when deploying
Upstream-commit: b8dac5dc995cefbd9f92f5a52a7435ddf4250873
Component: engine
2016-11-29 15:00:35 -08:00
2ae9ad9ad5 Use namespace label on stack volumes.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: 4013a7c6d897051bb79982230f31279ee0c9a026
Component: engine
2016-11-28 18:02:39 -05:00
37ea301199 stack deploy: handle external network when deploying
If the network is marked as external, don't use the namespace on
it. Otherwise, it's not found.

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
Upstream-commit: 6fff8454099092780655e8a2c7d71402ce547c5c
Component: engine
2016-11-28 17:38:41 +01:00
ac43a15799 Add a short flag for docker stack deploy
Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: f1dd721b6978f1c24bb2761b88c83d9e385bd781
Component: engine
2016-11-25 13:23:36 -05:00
64466e9e79 Better error message on stack deploy against not a swarm.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: c72daf953aaa8c7c8cbe60a103700d3b1d56c50d
Component: engine
2016-11-23 12:15:11 -05:00
4ce562265c Merge pull request #28677 from dnephin/remove-deploy-experimental
Move `docker stack` out of experimental
Upstream-commit: eac91a19d632dc82b04f19eb11f83ed1dcefb8ae
Component: engine
2016-11-21 14:33:35 -08:00
2beb803d6c Move docker stack out of experimental
Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: 6df5baf30f96e5af3338551b9e632748d7886ead
Component: engine
2016-11-21 15:30:25 -05:00
2b291d4bab Do not panic if network is nil
network is `nil` if the following case:

```
services:
  foo:
    image: nginx
    networks:
      mynetwork:
```

It's a valid compose so we should not panic.

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
Upstream-commit: 158388ef8d66723ec1f8ee4770d7488948234d16
Component: engine
2016-11-21 17:59:29 +01:00
86d2b2a2e1 Merge pull request #28294 from vdemeester/compose-swarm-healthcheck
Add support for healthcheck in compose to swarm
Upstream-commit: 3739c3bed37a3493a20bff3c9abb17561e1a732d
Component: engine
2016-11-21 10:28:37 +01:00
fd22b67295 swap position of "host" and "ip"
the service definition uses the format as defined
in  http://man7.org/linux/man-pages/man5/hosts.5.html
(IP_address canonical_hostname [aliases...])

This format is the _reverse_ of the format used in
the container API.

Commit f32869d956eb175f88fd0b16992d2377d8eae79c
inadvertently used the incorrect order.

This fixes the order, and correctly sets it to;

    IP-Address hostname

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Upstream-commit: f1b9df91722a229fd0cefd7a0868933b6b811544
Component: engine
2016-11-18 22:04:27 +01:00
2efd6e2078 Return warnings from service create and service update when digest pinning fails
Modify the service update and create APIs to return optional warning
messages as part of the response. Populate these messages with an
informative reason when digest resolution fails.

This is a small API change, but significantly improves the UX. The user
can now get immediate feedback when they've specified a nonexistent
image or unreachable registry.

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
Upstream-commit: 948e60691e523022f88e7f8129f02106a0f8826c
Component: engine
2016-11-18 09:31:31 -08:00
6a67c61a99 Default parallelism to 1.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: 7c1b39923505adeb13512d6294855b31102963a6
Component: engine
2016-11-18 16:17:08 +01:00
65faee61a6 Add support for healthcheck in composefile v3
`docker stack deploy` now supports a composefile v3 format that have a
healthcheck.

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
Upstream-commit: 3bd64de7a9c3eecbd57cb11d861a6fe94a5bb788
Component: engine
2016-11-18 15:09:13 +01:00
9f30feb096 Merge pull request #28554 from vieux/showhelp
refactor help func in CLI
Upstream-commit: 43de09045c3aa7e1d2f45533cbd243a6e2d26f5e
Component: engine
2016-11-17 14:27:26 -08:00
2e39dde1e5 refactor help func in CLI
Signed-off-by: Victor Vieux <victorvieux@gmail.com>
Upstream-commit: bf95472105e5dad55314cfff599abea5b81b134a
Component: engine
2016-11-17 10:54:10 -08:00
dcce853abc Fix several issues with go vet and go fmt
For some reason, `go vet` and `go fmt` validate does not capture
several issues.

The following was the output of `go vet`:
```
ubuntu@ubuntu:~/docker$ go vet ./... 2>&1 | grep -v ^vendor | grep -v '^exit status 1$'
cli/command/formatter/container_test.go:393: possible formatting directive in Log call
volume/volume_test.go:257: arg mp.RW for printf verb %s of wrong type: bool
```

The following was the output of `go fmt -s`:
```
ubuntu@ubuntu:~/docker$ gofmt -s -l . | grep -v ^vendor
cli/command/stack/list.go
daemon/commit.go
```

Fixed above issues with `go vet` and `go fmt -s`

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
Upstream-commit: ace786e9d517777473bd431e65d6c464d82e4f65
Component: engine
2016-11-17 06:31:28 -08:00
bb992b4f94 Merge pull request #28297 from vdemeester/compose-swarm-openstdin
Add support for stdin_open in compose to swarm
Upstream-commit: e8469c0e63160174d00f60cdc2cc909593ab04b2
Component: engine
2016-11-11 17:09:04 +01:00
50bcf47873 Add support for extra_hosts in composefile v3
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
Upstream-commit: f32869d956eb175f88fd0b16992d2377d8eae79c
Component: engine
2016-11-11 15:20:02 +01:00