Commit Graph

218 Commits

Author SHA1 Message Date
e529bcd027 Implement incremental file sync using client session
Also exposes shared cache and garbage collection/prune
for the source data.

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Upstream-commit: 5c3d2d552b0430672d5f481ab2d37036f6e92166
Component: engine
2017-06-22 11:52:35 -07:00
b1e4d7d884 Add long-running client session endpoint
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Upstream-commit: ec7b6238c31e26702ecf366731532e189b5da142
Component: engine
2017-06-22 11:22:41 -07:00
24b6b491fa pull client API version negotiation out of the CLI and into the client
Signed-off-by: Royce Remer <royceremer@gmail.com>
Upstream-commit: 5f1d94e569592fc2680f8661e16d0e5b02e82492
Component: engine
2017-06-20 22:58:16 -07:00
da632307b9 Make TestServiceCreateCompatiblePlatforms use actual API response
The `TestServiceCreateCompatiblePlatforms()` test was confusing, because it
did not actually use the mocked API response, but used a local
`distributionInspectBody` variable to verify that the `/distribution/` endpoint
was called.

This flow was especially confusing, because a comment in the test describes;

    "check if the /distribution endpoint returned correct output"

If (for whatever reason), the endpoint was not called, the test would panic,
because the `distributionInspectBody` would not be set.

This patch rewrites the test to use the actual API response that is returned
by the mock, and verifies that the information returned by the `/distribution/`
endpoint is properly used in the service's definition.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Upstream-commit: f3fce00ef3f3b7ead5ac211f9aafabfebf820c2f
Component: engine
2017-06-13 14:25:50 +02:00
88669e2de2 Merge pull request #33571 from thaJeztah/client-api-version-checks
Add API version checks to client
Upstream-commit: ae487e543c2916bec05dc01ebd364a9d3b88595d
Component: engine
2017-06-13 10:50:05 +02:00
99aad7f08b Add scope filter in /networks/<id>
This fix tries to add a `scope` in the query of `/networks/<id>`
(`NetworkInspect`) so that in case of duplicate network names,
it is possible to locate the network ID based on the network
scope (`local`, 'swarm', or `global`).

Multiple networks might exist in different scopes, which is a legitimate case.
For example, a network name `foo` might exists locally and in swarm network.

However, before this PR it was not possible to query a network name `foo`
in a specific scope like swarm.

This fix fixes the issue by allowing a `scope` query in `/networks/<id>`.

Additional test cases have been added to unit tests and integration tests.

This fix is related to docker/cli#167, moby/moby#30897, moby/moby#33561, moby/moby#30242

This fix fixes docker/cli#167

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
Upstream-commit: 158b2a1875cf33f3560dedaeb0149e1fbe54c1ef
Component: engine
2017-06-12 09:54:25 -07:00
1674838b6a Add API version checks to client
The Docker CLI already performs version-checks when
running commands, but other clients consuming the API
client may not do so.

This patch adds a version check to various
client functions.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Upstream-commit: 1401342f466bafbb902157a2460746ac829e0b01
Component: engine
2017-06-10 01:57:55 +02:00
7910a90b94 Merge pull request #33424 from allencloud/add-swarm-unlock-test-in-client
add swarm unlock test in client
Upstream-commit: 47218448113da4a06d6b0397821007d2b865ede5
Component: engine
2017-06-09 08:39:23 -04:00
a215dfc2d2 Merge pull request #33262 from keloyang/exec-block
Add a error check in postHijacked to avoid docker exec command blocking.
Upstream-commit: f35157433e38c90a9a067020609c7e250fc847af
Component: engine
2017-06-09 09:20:04 +08:00
523841f2f9 Add a error check in postHijacked to avoid docker exec command blocking.
When user execute docker exec command, docker daemon maybe have err return because
of ExecExists check, and then the hijack stream will not be close, it can lead to
docker exec command block.

Signed-off-by: yangshukui <yangshukui@huawei.com>
Upstream-commit: 26231b29e7881d25822bffd740d5f73fc2687460
Component: engine
2017-06-08 15:46:50 +08:00
6f84604b78 client: Use string concatenation instead of Sprintf
Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
Upstream-commit: 44c9ccc069c1bfda25ad6fb5932eeeceaa8de491
Component: engine
2017-06-02 14:01:57 +02:00
02f992f2b8 Fix Typos: continer,contianer -> container
Signed-off-by: Chen Min <chenmin46@huawei.com>
Upstream-commit: 2b62eb434be4770c101ef79666a952fd7f43a742
Component: engine
2017-06-01 19:21:01 +08:00
db321ad50e add swarm unlock test in client
Signed-off-by: allencloud <allen.sun@daocloud.io>
Upstream-commit: 8ff023fe5a6c33a7d4663978cf57afb2fffba9af
Component: engine
2017-05-29 00:22:24 +08:00
d64468f256 Merge pull request #33279 from nishanttotla/fix-service-image-issues
Ensure service images get default tag and print familiar strings
Upstream-commit: 5648a1ada223d692615072af26d0ce6e23415006
Component: engine
2017-05-22 21:45:11 +01:00
45dcc1512b Merge pull request #33253 from dave-tucker/clientHost
client: Expose ClientHost to client users
Upstream-commit: ab2abb0d940476fcb56d2ee565afdf1bc4d525d4
Component: engine
2017-05-22 16:27:43 +01:00
4a211248b9 client: Expose DaemonHost to client users
This commit exposes `Client.host` as `Client.DaemonHost()`
This allows users of the client, a CLI for example, to query the Host
that the client is attempting to contact and vary their behaviour
accordingly. For example, to allow client-side configuration of
HTTP proxy settings for a number of different docker hosts.

Signed-off-by: Dave Tucker <dt@docker.com>
Upstream-commit: 6ce6ae1cd11d888e0c8ede20926b86981cee5ce1
Component: engine
2017-05-22 13:25:11 +01:00
8d6081fcd1 Adding unit tests for pin by digest (client)
Signed-off-by: Nishant Totla <nishanttotla@gmail.com>
Upstream-commit: 75c7536d2e2e328b644bf69153de879d1d197988
Component: engine
2017-05-19 10:48:12 -07:00
93bcab0aa8 Ensure service images get default tag and print familiar strings
Signed-off-by: Nishant Totla <nishanttotla@gmail.com>
Upstream-commit: 5efcec77170dd6c4087d4f1fb3695c32d94edfb4
Component: engine
2017-05-19 10:35:34 -07:00
87298d4be7 Remove deadlock in ContainerWait
when `cli.post(...)` fails `errC <- err` blocks because `errC` is unbufferd.

Signed-off-by: Simon Menke <simon.menke@gmail.com>
Upstream-commit: 4d2d2ea39336aade783c5c415b83d129bdd339bb
Component: engine
2017-05-19 09:23:52 +02:00
0d783a82c9 Merge pull request #33267 from YuPengZTE/devImageWithDigestString
ineffectual assignment to isCanonical, delete it, and make the "if" sentence to fit the golang usage
Upstream-commit: b0dd3dfc1184b210854b62c231b7b074dd6dbd26
Component: engine
2017-05-18 23:37:52 +02:00
a8771c2674 ineffectual assignment to isCanonical, delete it
Signed-off-by: yupengzte <yu.peng36@zte.com.cn>
Upstream-commit: b28c1eae01e73fb92fe46f60a1bbd4e4f5a223b1
Component: engine
2017-05-18 17:16:19 +08:00
5e539a93fd Updating test for compatible platforms to test unmarshal body
Signed-off-by: Nishant Totla <nishanttotla@gmail.com>
Upstream-commit: 7d4b8fb3b56168326f36157064741539f34490b7
Component: engine
2017-05-17 17:12:22 -07:00
3ff6579fec Adding compatible platforms to service spec
Signed-off-by: Nishant Totla <nishanttotla@gmail.com>
Upstream-commit: 587d07cca89be978b9f9ca3203ad28b7179e49fd
Component: engine
2017-05-17 16:20:42 -07:00
6f26254653 Merge pull request #32237 from jlhawn/update_container_wait
Update Container Wait
Upstream-commit: c053a2069e1c8e99488517071540fb3e526233f3
Component: engine
2017-05-17 02:39:52 +02:00
fa44d02011 Update ContainerWait API
This patch adds the untilRemoved option to the ContainerWait API which
allows the client to wait until the container is not only exited but
also removed.

This patch also adds some more CLI integration tests for waiting for a
created container and waiting with the new --until-removed flag.

Docker-DCO-1.1-Signed-off-by: Josh Hawn <josh.hawn@docker.com> (github: jlhawn)

Handle detach sequence in CLI

Docker-DCO-1.1-Signed-off-by: Josh Hawn <josh.hawn@docker.com> (github: jlhawn)

Update Container Wait Conditions

Docker-DCO-1.1-Signed-off-by: Josh Hawn <josh.hawn@docker.com> (github: jlhawn)

Apply container wait changes to API 1.30

The set of changes to the containerWait API missed the cut for the
Docker 17.05 release (API version 1.29). This patch bumps the version
checks to use 1.30 instead.

This patch also makes a minor update to a testfile which was added to
the builder/dockerfile package.

Docker-DCO-1.1-Signed-off-by: Josh Hawn <josh.hawn@docker.com> (github: jlhawn)

Remove wait changes from CLI

Docker-DCO-1.1-Signed-off-by: Josh Hawn <josh.hawn@docker.com> (github: jlhawn)

Address minor nits on wait changes

- Changed the name of the tty Proxy wrapper to `escapeProxy`
- Removed the unnecessary Error() method on container.State
- Fixes a typo in comment (repeated word)

Docker-DCO-1.1-Signed-off-by: Josh Hawn <josh.hawn@docker.com> (github: jlhawn)

Use router.WithCancel in the containerWait handler

This handler previously added this functionality manually but now uses
the existing wrapper which does it for us.

Docker-DCO-1.1-Signed-off-by: Josh Hawn <josh.hawn@docker.com> (github: jlhawn)

Add WaitCondition constants to api/types/container

Docker-DCO-1.1-Signed-off-by: Josh Hawn <josh.hawn@docker.com> (github: jlhawn)

Address more ContainerWait review comments

- Update ContainerWait backend interface to not return pointer values
  for container.StateStatus type.
- Updated container state's Wait() method comments to clarify that a
  context MUST be used for cancelling the request, setting timeouts,
  and to avoid goroutine leaks.
- Removed unnecessary buffering when making channels in the client's
  ContainerWait methods.
- Renamed result and error channels in client's ContainerWait methods
  to clarify that only a single result or error value would be sent
  on the channel.

Docker-DCO-1.1-Signed-off-by: Josh Hawn <josh.hawn@docker.com> (github: jlhawn)

Move container.WaitCondition type to separate file

... to avoid conflict with swagger-generated code for API response

Docker-DCO-1.1-Signed-off-by: Josh Hawn <josh.hawn@docker.com> (github: jlhawn)

Address more ContainerWait review comments

Docker-DCO-1.1-Signed-off-by: Josh Hawn <josh.hawn@docker.com> (github: jlhawn)
Upstream-commit: 4921171587c09d0fcd8086a62a25813332f44112
Component: engine
2017-05-16 15:11:39 -07:00
6b1b90eeb8 Disabling digest pinning for API versions < 1.30
Signed-off-by: Nishant Totla <nishanttotla@gmail.com>
Upstream-commit: c0afd9c873183604e57282e1cf47605c1f1e4d43
Component: engine
2017-05-15 16:42:43 -07:00
6b46f385fc Moving docker service digest pinning to client side
Signed-off-by: Nishant Totla <nishanttotla@gmail.com>
Upstream-commit: c1635c1ae3459e41fea3adb8188d9b3ce94f21a0
Component: engine
2017-05-15 16:42:43 -07:00
e768870c69 Merge pull request #32987 from allencloud/add-swarm-get-unlock-key-test-in-client
add swarm get unlock key test for client package
Upstream-commit: 3183031581d16e06b5386b1860ea6bfaa734ebce
Component: engine
2017-05-15 09:56:43 -04:00
81db28deb9 Merge pull request #32996 from dperny/service-logs-support-details
Fix Ambigious Logs Format and Add Support for Details in Service Logs
Upstream-commit: 7fd8a9382c0fd3f23002288e357b5612b869a974
Component: engine
2017-05-15 13:57:44 +02:00
462508ec1a fix typos in function comments
Signed-off-by: allencloud <allen.sun@daocloud.io>
Upstream-commit: 4a98f9ef7fdb6f6f77516fb030293fbc0ff659dc
Component: engine
2017-05-14 13:05:41 +08:00
25f28a5159 add swarm get unlock key test for client package
Signed-off-by: allencloud <allen.sun@daocloud.io>
Upstream-commit: a86023eaa93f18bfefb345a5e13c88156abaa6fa
Component: engine
2017-05-14 11:09:19 +08:00
51fcae249a Change log details encoding format and support details on service logs
URL query encode log details, so that characters like spaces don't make
log parsing ambiguous. Add a helper function to parse these details to a
map, if needed

Add support for details on service logs

Signed-off-by: Drew Erny <drew.erny@docker.com>
Upstream-commit: 68f21418ac1f1acb2874b45878a5938475becf1f
Component: engine
2017-05-12 10:53:44 -07:00
f1fba04069 Add configs support to client
Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
Upstream-commit: 102738101a68711c2ca50e36b24d389c35d087df
Component: engine
2017-05-11 10:08:21 -07:00
9d2b3f6463 Return error on client redirect
From Go 1.8 HTTP client redirect behaviour is changed:
When status code is 301, 307 or 308, the client
automatically converts it to a new HTTP request.

This behaviour change manifests in the client in that
before the 301 was not followed and the client did not generate
an error, but now results in an error message:
"Error response from daemon: page not found."

To fix that a new redirect policy is forced by setting
HTTP Client's CheckRedirect.
That policy is to return an error for any 301, 307 or 308
in the response's status code to a non-GET request.
The error message specifies that the daemon could not
process the request and it is probably due to bad
arguments that were provided by the user.

Signed-off-by: Boaz Shuster <ripcurld.github@gmail.com>
Upstream-commit: eb36d6021618f788012c166a533f1b321cda9695
Component: engine
2017-05-11 15:39:41 +03:00
45bfaee41a add disk usage test for client
Signed-off-by: allencloud <allen.sun@daocloud.io>
Upstream-commit: d70fde8ffea7bb2d4bb6fca3cebcab0a7a675afa
Component: engine
2017-05-03 12:37:28 +08:00
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
866adfbbee Merge pull request #28923 from erikh/fix-copy
Fix copy API (`docker cp`, etc) uid/gid handling
Upstream-commit: d40a17ffc2f6592396a3dfc0f5ebe396c2107536
Component: engine
2017-04-12 08:21:17 -07:00
1386ad9dee daemon/archive.go: Fix copy routines to preserve UID.
This changes the long-standing bug of copy operations not preserving the
UID/GID information after the files arrive to the container.

Signed-off-by: Erik Hollensbe <github@hollensbe.org>
Upstream-commit: 8a7ff5ff746a77e0be601c11540562341b2228c1
Component: engine
2017-04-12 10:33:19 +00:00
640fde4eb4 client: Allow hex strings as source references for ImageTag
The source of a tag operation is allowed to be a 64-character hex
string. This means it should use ParseAnyReference for validation
instead of ParseNormalizedNamed.

This fixes a regression that happened in 17.04.

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
Upstream-commit: 4a0704cdbd1805d0d9ef046eb62a77352f1feab0
Component: engine
2017-04-11 13:37:04 -07:00
d2aa64e45c Merge pull request #32284 from aaronlehmann/fix-service-defaults
Improve default handling for "service create"
Upstream-commit: a258ef58d8a100467d5d948b026a884ebe58eaf4
Component: engine
2017-04-11 13:06:53 +02:00
a89a2c21c5 builder: add an option for specifying build target
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Upstream-commit: 33e07f41adc0ec96edad5f22bc2cfaec0d26ea58
Component: engine
2017-04-10 16:21:43 -07:00
3d267a0dc8 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: 1d274e9acfe96b98be3ec956636ff4e5c70e98af
Component: engine
2017-04-10 13:41:16 -07:00
6d75b7a10d Merge pull request #30740 from yongtang/29999-prune-filter-label
Add `label` filter for `docker system prune`
Upstream-commit: 4460312ce1a53316e3c474ab951b85e737a902c5
Component: engine
2017-04-10 19:38:01 +02:00
1f0e0155dc use an encrypted client certificate to connect to a docker daemon
Signed-off-by: Arash Deshmeh <adeshmeh@ca.ibm.com>
Upstream-commit: 603dd8b3b48273c0c7e1f2aef5f344acac66424e
Component: engine
2017-04-07 01:50:51 -04:00
83d9648a45 Add label filter for docker system prune
This fix tries to address the issue raised in 29999 where it was not
possible to mask these items (like important non-removable stuff)
from `docker system prune`.

This fix adds `label` and `label!` field for `--filter` in `system prune`,
so that it is possible to selectively prune items like:
```
$ docker container prune --filter label=foo

$ docker container prune --filter label!=bar
```

Additional unit tests and integration tests have been added.

This fix fixes 29999.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
Upstream-commit: 702524732427ce028277f99f215e1fab297e6001
Component: engine
2017-04-06 09:11:25 -07:00
93e346635c 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: d330dc3223df7e6c2b066373718709e34e19efca
Component: engine
2017-04-03 18:40:54 -07:00
95794e3edc Merge pull request #31710 from sanimej/drillerrr
Add verbose flag to network inspect to show all services & tasks in swarm mode
Upstream-commit: cdf66ba715c573f85338a2b2a432db6cb9a48e6d
Component: engine
2017-03-13 21:12:32 -07: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
da38e7fbf1 Hide command options that are related to Windows
Signed-off-by: Boaz Shuster <ripcurld.github@gmail.com>
Upstream-commit: 7199522ea2e77c77bf931474eca92aa502ce0031
Component: engine
2017-03-12 08:47:17 +02:00
d82df5d4ba 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: f9bd8ec8b268581f93095c5a80679f0a8ff498bf
Component: engine
2017-03-03 16:33:34 -08:00