Commit Graph

97 Commits

Author SHA1 Message Date
87c76eb0d7 Pass upstream client's user agent through to registry on operations beyond pulls
This adds support for the passthrough on build, push, login, and search.

Revamp the integration test to cover these cases and make it more
robust.

Use backticks instead of quoted strings for backslash-heavy string
contstands.

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
Upstream-commit: c44e7a3e632c3ea961cb8c12ba45371f54e6699c
Component: engine
2016-03-21 14:31:47 -07:00
6c1d291a31 Merge pull request #21306 from mgoelzer/issue20001-nodeps
Pass upstream client's user agent through to registry on image pulls
Upstream-commit: 278d3962a8cb6a42e9841789bdb8b49a29617e24
Component: engine
2016-03-21 14:26:59 -07:00
78405a5d4a Merge pull request #21283 from runcom/update-test
vendor docker/distribution d06d6d3b093302c02a93153ac7b06ebc0ffd1793
Upstream-commit: a05fdd680662d36c6d79add46b07ad5dcee7f6d7
Component: engine
2016-03-21 09:46:28 -07:00
6143e6c8cf Pass upstream client's user agent through to registry on image pulls
Changes how the Engine interacts with Registry servers on image pull.
Previously, Engine sent a User-Agent string to the Registry server
that included only the Engine's version information.  This commit
appends to that string the fields from the User-Agent sent by the
client (e.g., Compose) of the Engine.  This allows Registry server
operators to understand what tools are actually generating pulls on
their registries.

Signed-off-by: Mike Goelzer <mgoelzer@docker.com>
Upstream-commit: d1502afb63a10df0bfce20ae2957774cfb3e58d8
Component: engine
2016-03-20 04:30:09 -07:00
6ab75fcf92 distribution: errors: do not retry if no token in response
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
Upstream-commit: 264b5b60832bf1f1342618d059c0ece3358de7e1
Component: engine
2016-03-19 12:20:14 +01:00
8ba16d91c8 Replace execdrivers with containerd implementation
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
Signed-off-by: Anusha Ragunathan <anusha@docker.com>
Upstream-commit: 9c4570a958df42d1ad19364b1a8da55b891d850a
Component: engine
2016-03-18 13:38:32 -07:00
f9e5200e21 distribution: errors: do not access the errors slice if it's empty
- cherry-pick from 1.10.3 branch: 0186f4d4223a094a050d06f456355da3ae431468
- add token service test suite
- add integration test (missing in 1.10.3 branch)

Signed-off-by: Antonio Murdaca <runcom@redhat.com>
Upstream-commit: 1b5c2e1d722757a55364fb45cf3fcec7f2c75fb4
Component: engine
2016-03-16 09:00:39 +01:00
9042585b0d Merge pull request #21222 from aaronlehmann/pull-with-no-layers
Fix pulling images that contain no layers at all
Upstream-commit: 2b1b235acf9aa029218e1bd5cd97a369c500e4f5
Component: engine
2016-03-15 23:03:42 -07:00
5a76e4397a Fix flaky test TestTransfer
This test was checking that it received every progress update that was
produced. But delivery of these intermediate progress updates is not
guaranteed. A new update can overwrite the previous one if the previous
one hasn't been sent to the channel yet.

The call to t.Fatalf exited the current goroutine which was consuming
the channel, which caused a deadlock and eventual test timeout rather
than a proper failure message.

Failure seen here:
https://jenkins.dockerproject.org/job/Docker-PRs-experimental/16400/console

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
Upstream-commit: 2f4aa9658408ac72a598363c6e22eadf93dbb8a7
Component: engine
2016-03-15 16:26:16 -07:00
66aada1792 Fix pulling images that contain no layers at all
The download manager assumed there was at least one layer involved in
all images. This can be false if the image is essentially a copy of
`scratch`.

Fix a nil pointer dereference that happened in this case. Add
integration tests that involve schema1 and schema2 manifests.

Fixes #21213

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
Upstream-commit: 7cf894ce1013e5843d5c151f24520b51d34515d0
Component: engine
2016-03-15 11:10:03 -07:00
3e1d30a506 Merge pull request #20949 from imjching/master
Fix typo for download and upload retry messages
Upstream-commit: 90ce409e3581b455ab8ac6532684ef3e9475772a
Component: engine
2016-03-14 21:08:49 +01:00
Jay
6157c6cb94 Fix typo for download and upload retry messages
Signed-off-by: Jay <jay@imjching.com>
Upstream-commit: f8d14bd4c6a0e3c58130be159b05b8aa63374f6e
Component: engine
2016-03-15 00:56:19 +08:00
2f7e1dc6a8 Merge pull request #21159 from runcom/fix-retry-push-bug
distribution: errors: do not retry if no credentials provided
Upstream-commit: 0b962f72a97c5e1cde020cc948704e61ab8dfc0a
Component: engine
2016-03-14 09:47:13 -07:00
2909d7c372 distribution: errors: do not retry if no credentials provided
Fix and add test for case c) in #21054

Signed-off-by: Antonio Murdaca <runcom@redhat.com>
Upstream-commit: 497d545093bce4f01455bf8d2e1658435dbb040b
Component: engine
2016-03-12 20:41:47 +01:00
8ca8fa6b76 Add support for identity token with token handler
Use token handler options for initialization.
Update auth endpoint to set identity token in response.
Update credential store to match distribution interface changes.

Signed-off-by: Derek McGowan <derek@mcgstyle.net> (github: dmcgowan)
Upstream-commit: e896d1d7c4459c4b357efdd780e9fb9dd9bc90e0
Component: engine
2016-03-09 13:47:57 -08:00
cde30fac56 Merge pull request #20832 from aaronlehmann/login-endpoint-refactor
Update login to use token handling code from distribution
Upstream-commit: 17156ba98ff8d29048b0f05f600fae9ccbd858a2
Component: engine
2016-03-03 19:04:42 +01:00
94732a171a Merge pull request #20868 from LK4D4/unused_ctx
Remove unused ctx from v1Pusher
Upstream-commit: 613d364e238ca002c502bcaf6b61760066ef956a
Component: engine
2016-03-02 10:05:46 -08:00
098b339ade Remove unused ctx from v1Pusher
Signed-off-by: Alexander Morozov <lk4d4@docker.com>
Upstream-commit: a4dbbe7d898ae6db366076cbe13049a8f88fc731
Component: engine
2016-03-02 07:59:12 -08:00
d04c4d1cf0 Login update and endpoint refactor
Further differentiate the APIEndpoint used with V2 with the endpoint type which is only used for v1 registry interactions
Rename Endpoint to V1Endpoint and remove version ambiguity
Use distribution token handler for login

Signed-off-by: Derek McGowan <derek@mcgstyle.net>
Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
Upstream-commit: f2d481a299f7404f5cabbe0f8e6a4ae3c3211c1e
Component: engine
2016-03-01 11:52:32 -08:00
357a20e2b5 Fix concurrent uploads that share layers
Concurrent uploads which share layers worked correctly as of #18353,
but unfortunately #18785 caused a regression. This PR removed the logic
that shares digests between different push sessions. This overlooked the
case where one session was waiting for another session to upload a
layer.

This commit adds back the ability to propagate this digest information,
using the distribution.Descriptor type because this is what is received
from stats and uploads, and also what is ultimately needed for building
the manifest.

Surprisingly, there was no test covering this case. This commit adds
one. It fails without the fix.

See recent comments on #9132.

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
Upstream-commit: 5c99eebe81958a227dfaed1145840374ce50bbbb
Component: engine
2016-03-01 11:14:44 -08:00
1922dbc3eb Merge pull request #20772 from Microsoft/jjh/testunitdistribution-xfer
Windows CI Unit Test: Distribution\xfer turn off failing tests
Upstream-commit: 8ffec1fca5d851e9f8e33e3dfab5c6ebc9562284
Component: engine
2016-02-29 10:45:57 -05:00
351fe56c91 Merge pull request #20771 from Microsoft/jjh/disableunittestsdistribution
Windows CI Unit Test: Distribution turn off failing tests
Upstream-commit: da4f2ce6294f9333a7b9011f80d7b64815cc2059
Component: engine
2016-02-29 12:56:10 +01:00
cdf59b59f2 Windows CI Unit Test: Distribution\xfer turn off failing tests
Signed-off-by: John Howard <jhoward@microsoft.com>
Upstream-commit: dd2ff281bf62037948a9da18dd2223b977056a4e
Component: engine
2016-02-28 20:08:34 -08:00
f53e7a1a3f Windows CI Unit Test: Distribution turn off failing tests
Signed-off-by: John Howard <jhoward@microsoft.com>
Upstream-commit: 621a1b9aca7f0ad2ac6b83f990644c3dc983d659
Component: engine
2016-02-28 20:02:51 -08:00
acc7d09962 Improve fallback behavior for cross-repository push
Attempt layer mounts from up to 3 source repositories, possibly
falling back to a standard blob upload for cross repository pushes.
Addresses compatiblity issues with token servers which do not grant
multiple repository scopes, resulting in an authentication failure for
layer mounts, which would otherwise cause the push to terminate with an
error.

Signed-off-by: Brian Bland <brian.bland@docker.com>
Upstream-commit: 1d3480f9ba3525309030497d5c8a3dd5725ed15a
Component: engine
2016-02-24 19:13:35 -08:00
e240ca3d3c Change APIEndpoint to contain the URL in a parsed format
This allows easier URL handling in code that uses APIEndpoint.
If we continued to store the URL unparsed, it would require redundant
parsing whenver we want to extract information from it. Also, parsing
the URL earlier should give improve validation.

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
Upstream-commit: 79db131a358f15d4bdef37e251daf27429d116b3
Component: engine
2016-02-17 17:48:15 -08:00
80c4954d96 Smarter push/pull TLS fallback
With the --insecure-registry daemon option (or talking to a registry on
a local IP), the daemon will first try TLS, and then try plaintext if
something goes wrong with the push or pull. It doesn't make sense to try
plaintext if a HTTP request went through while using TLS. This commit
changes the logic to keep track of host/port combinations where a TLS
attempt managed to do at least one HTTP request (whether the response
code indicated success or not). If the host/port responded to a HTTP
using TLS, we won't try to make plaintext HTTP requests to it.

This will result in better error messages, which sometimes ended up
showing the result of the plaintext attempt, like this:

    Error response from daemon: Get
    http://myregistrydomain.com:5000/v2/: malformed HTTP response
    "\x15\x03\x01\x00\x02\x02"

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
Upstream-commit: 5e8af46fda3f4e17e06726237fc6b9ab6957e3ea
Component: engine
2016-02-12 13:47:48 -08:00
043a0cfc7b Merge pull request #20247 from aaronlehmann/distribution-errors
Push/pull errors improvement and cleanup
Upstream-commit: e17afedfe061ce2f02451c213b7c8b7aae01ba2f
Component: engine
2016-02-12 11:57:25 +01:00
992182031d Merge pull request #20250 from vieux/fix_misspell
fix common misspells
Upstream-commit: 5ca6d3bafd0dd53dd26f8251218c68a8016e5ce7
Component: engine
2016-02-11 17:22:06 -08:00
fbf0db8827 Push/pull errors improvement and cleanup
Several improvements to error handling:

- Introduce ImageConfigPullError type, wrapping errors related to
  downloading the image configuration blob in schema2. This allows for a
  more descriptive error message to be seen by the end user.

- Change some logrus.Debugf calls that display errors to logrus.Errorf.
  Add log lines in the push/pull fallback cases to make sure the errors
  leading to the fallback are shown.

- Move error-related types and functions which are only used by the
  distribution package out of the registry package.

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
Upstream-commit: 8f26fe4f59ce515c68440da1443ace4c96e89d4a
Component: engine
2016-02-11 16:28:56 -08:00
697a990701 fix common misspell
Signed-off-by: Victor Vieux <vieux@docker.com>
Upstream-commit: 99a396902f0ea9d81ef87a683489b2435408f415
Component: engine
2016-02-11 15:49:36 -08:00
bd6d7c6931 Fall back to V1 when there are no basic auth credentials
This makes the behavior consistent with having incorrect credentials.

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
Upstream-commit: 7b81bc147cf75cb32697e8fdf88e05ae879cb879
Component: engine
2016-02-11 10:48:11 -08:00
9e9ae7353a Attempt to resume downloads after certain errors
Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
Upstream-commit: 056bf9f25ec95a927eb150bef3adea630ce71414
Component: engine
2016-02-09 14:12:28 -08:00
1a12277ae5 Move temporary download file to download descriptor scope
This will allow it to be reused between download attempts in a
subsequent commit.

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
Upstream-commit: f425529e7e0a6b15c8cc43f0c1dbb7a42572e30d
Component: engine
2016-02-09 14:12:28 -08:00
2c1fe5f691 Merge pull request #19887 from aaronlehmann/vendor-resumable-downloads
Vendor updated distribution for resumable downloads
Upstream-commit: 9f0095f14a007950a17b000f268bb29ac5a5fa5c
Component: engine
2016-02-05 12:58:53 -08:00
d323843da1 Vendor updated distribution for resumable downloads
Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
Upstream-commit: 4d437a29d28ec2d47ff7cf0868390b921ededa03
Component: engine
2016-02-04 17:33:37 -08:00
e7c326da3c Merge pull request #19702 from tiborvass/host-specific-passthru-token
Add test to make sure the new registry pass-thru token is only sent to the intended hosts
Upstream-commit: 66a4e557f955713adea5c97e42202fdbc0f5c06c
Component: engine
2016-02-03 21:57:32 -05:00
d3428a009e Merge pull request #19971 from aaronlehmann/revert-19743
Revert "Set idle timeouts for HTTP reads and writes in communications with the registry"
Upstream-commit: 3fa0d09e74131f4a4dca43a1a28eb014028be62d
Component: engine
2016-02-03 15:33:29 -05:00
d9ed04ff60 Merge pull request #18680 from aaronlehmann/duplicate-pull-complete-message
Avoid outputting last progress item twice
Upstream-commit: bce70cdc2c4f80e75ca7435e2f3016b904b5c3f2
Component: engine
2016-02-03 11:01:45 -08:00
cc7637793b Revert "Set idle timeouts for HTTP reads and writes in communications with the registry"
This reverts commit 84b2162c1a15256ac09396ad0d75686ea468f40c.

The intent of this commit was to set an idle timeout on a HTTP
connection. If a read took more than 60 seconds to complete, or a write
took more than 60 seconds to complete, the connection would be
considered dead.

This doesn't work properly, because the HTTP internals apparently read
from the connection concurrently while writing. An upload that doesn't
complete in 60 seconds leads to a timeout.

Fixes #19967

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
Upstream-commit: cbda80aaff026329a13bb2d0943a4c428251e207
Component: engine
2016-02-03 09:59:56 -08:00
45a13ca311 Fix panic on network timeout during push
`Upload` already closes the reader returned by `compress` and the
progressreader passed into it, before returning. But even so, the
io.Copy inside compress' goroutine needs to attempt a read from the
progressreader to notice that it's closed, and this read has a side
effect of outputting a progress message. If this happens after `Upload`
returns, it can result in a write to a closed channel. Change `compress`
to return a channel that allows the caller to wait for its goroutine to
finish before freeing any resources connected to the reader that was
passed to it.

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
Upstream-commit: e273445dd407df6803d7b80863b644a6cfa2c1f5
Component: engine
2016-01-29 14:34:50 -08:00
85dd8b9875 distribution: add test to ensure pass-thru registry token is host-bound
Signed-off-by: Tibor Vass <tibor@docker.com>
Upstream-commit: f3df50d115c81c13349835a15f5bad0f2c15dfe4
Component: engine
2016-01-28 16:23:06 -08:00
665c7f7ff1 Set idle timeouts for HTTP reads and writes in communications with the registry
Otherwise, some operations can get stuck indefinitely when the remote
side is unresponsive.

Fixes #12823

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
Upstream-commit: 84b2162c1a15256ac09396ad0d75686ea468f40c
Component: engine
2016-01-26 12:40:39 -08:00
dfa69d7101 Avoid outputting last progress item twice
A watcher would output the current progress item when it was detached,
in case it missed that item earlier, which would leave the user seeing
some intermediate step of the operation. This commit changes it to only
output it on detach if it didn't already output the same item.

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
Upstream-commit: fde2329eaa1fab2327ae2e775af5aa04e2726ed5
Component: engine
2016-01-26 10:03:28 -08:00
bc025bbadc Merge pull request #19701 from aaronlehmann/remove-downloads-on-error
Remove temporary layer download file on error
Upstream-commit: 4158b671f3c5ac13605892aa31c0a9ed22f2e8fd
Component: engine
2016-01-26 10:55:43 +01:00
25849c48bc Merge pull request #19057 from dnephin/remove_version_from_registry_pkg
Remove dockerversion from registry package
Upstream-commit: 07e2dedecb3a0b7381ebf0f8fb4d08d082754cd0
Component: engine
2016-01-25 22:45:06 -08:00
1a98d85d03 Remove temporary layer download file on error
Currently, the temporary file storing downloaded layer data is only
removed after a successful download or a digest verification error. A
transport-level error does not cause it to be removed. This is a
regression from 1.9 that could cause disk usage to grow until the Docker
daemon is restarted.

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
Upstream-commit: 5a363ce60bee3dc26a433c7e2cee6dc76939849e
Component: engine
2016-01-25 18:20:18 -08:00
1edf55ab4c Fix watching a released transfer
Things could go wrong if Watch was called after the last existing
watcher was released. The call to Watch would succeed even though it was
not really adding a watcher, and the corresponding call to Release would
close hasWatchers a second time.

The fix for this is twofold:

1. We allow transfers to gain new watchers after the watcher count has
touched zero. This means that the channel returned by Released should
not be closed until all watchers have been released AND the transfer is
no longer tracked by the transfer manager, meaning it won't be possible
for additional calls to Watch to race with closing the channel returned
by Released.

The Transfer interface has a new method called Close so the transfer can
know when the transfer manager no longer references it.

Remove the Cancel method. It's not used and should not be exported.

2. Even though (1) makes it possible to add watchers after all the
previous watchers have been released, we want to avoid doing this in
practice. A transfer that has had all its watchers released is in the
process of being cancelled, and attaching to one of these will never be
the correct behavior. Add a check if a watcher is attaching to a
cancelled transfer.  In this case, wait for the transfer to be removed
from the map and try again. This will ensure correct behavior when a
watcher tries to attach during the race window.

Either (1) or (2) should be sufficient to fix the race involved here,
but the combination is the most correct approach. (1) fixes the
low-level plumbing to be resilient to the race condition, and (2) avoids
using it in a racy way.

Fixes #19606

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
Upstream-commit: 3e2b50ccaadb5ecbd70bf27adc287973f0417573
Component: engine
2016-01-25 13:28:02 -08:00
5696850b38 Merge pull request #19509 from BrianBland/master
Fixes layer MediaTypes in manifests created from a cross-repository push
Upstream-commit: 2731dbc7977dba00405c974c47c4f079d441a2b2
Component: engine
2016-01-22 14:27:47 -05:00
91f8ed84f8 Merge pull request #19551 from aaronlehmann/fix-retry-on-enospc
Don't retry downloads when disk is full
Upstream-commit: 26334b7a7d80fe233f27773bb65ac2d57d3af2a0
Component: engine
2016-01-21 15:37:50 -05:00