Commit Graph

49 Commits

Author SHA1 Message Date
547342d777 Improved push and pull with upload manager and download manager
This commit adds a transfer manager which deduplicates and schedules
transfers, and also an upload manager and download manager that build on
top of the transfer manager to provide high-level interfaces for uploads
and downloads. The push and pull code is modified to use these building
blocks.

Some benefits of the changes:

- Simplification of push/pull code
- Pushes can upload layers concurrently
- Failed downloads and uploads are retried after backoff delays
- Cancellation is supported, but individual transfers will only be
  cancelled if all pushes or pulls using them are cancelled.
- The distribution code is decoupled from Docker Engine packages and API
  conventions (i.e. streamformatter), which will make it easier to split
  out.

This commit also includes unit tests for the new distribution/xfer
package. The tests cover 87.8% of the statements in the package.

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
Upstream-commit: 572ce802306a4e919802e5b77cbeca94acda7c0a
Component: engine
2015-12-09 19:13:35 -08:00
7d8daf7bad Fix flaky test TestPullAllTagsFromCentralRegistry
This test was directly comparing lines of output from "docker images".
Sometimes, when busybox had been pushed to the hub recently, the
relative creation times would differ like this:

... obtained []string = []string{"busybox", "latest", "d9551b4026f0", "27", "minutes", "ago", "1.113", "MB"}
... expected []string = []string{"busybox", "latest", "d9551b4026f0", "26", "minutes", "ago", "1.113", "MB"}

Fixing by removing the time-since-creation fields from the comparison.

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
Upstream-commit: d17669999fff55219f5ed236f00fdf8a08d09304
Component: engine
2015-12-08 11:23:04 -08:00
e105a29374 Update daemon and docker core to use new content addressable storage
Add distribution package for managing pulls and pushes. This is based on
the old code in the graph package, with major changes to work with the
new image/layer model.

Add v1 migration code.

Update registry, api/*, and daemon packages to use the reference
package's types where applicable.

Update daemon package to use image/layer/tag stores instead of the graph
package

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Upstream-commit: 4352da7803d182a6013a5238ce20a7c749db979a
Component: engine
2015-11-24 09:40:25 -08:00
eb67a37877 Calculate hash based image IDs on pull
Generate a hash chain involving the image configuration, layer digests,
and parent image hashes. Use the digests to compute IDs for each image
in a manifest, instead of using the remotely specified IDs.

To avoid breaking users' caches, check for images already in the graph
under old IDs, and avoid repulling an image if the version on disk under
the legacy ID ends up with the same digest that was computed from the
manifest for that image.

When a calculated ID already exists in the graph but can't be verified,
continue trying SHA256(digest) until a suitable ID is found.

"save" and "load" are not changed to use a similar scheme. "load" will
preserve the IDs present in the tar file.

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
Upstream-commit: 504e67b867865a2835e8002c01087a2cfd7bfd0e
Component: engine
2015-10-12 10:51:28 -07:00
3d19f9af55 Add unit tests for integration cli utils function
- utils_test.go and docker_utils_test.go
- Moved docker related function to docker_utils.go
- add a test for integration-cli/checker

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
Upstream-commit: 5109071706cab06257b21172627ce51e5fa3a88c
Component: engine
2015-09-09 15:36:44 +02:00
c03ccb6893 Windows: Get Integration CLI running
Signed-off-by: John Howard <jhoward@microsoft.com>
Upstream-commit: f9a3558a9d75ed6a2f9f1b2d80800226afaa74a5
Component: engine
2015-09-04 12:32:40 -07:00
0249cbd7d9 Update image pull tests
Update and migrate existing tests to the `DockerHubPullSuite`. Most
tests were preserved, but refactored and made more exhaustive. One test
was deliberately removed (`TestPullVerified`) as it is unreliable and
that the feature was obsoleted by content trust.

Move all trust related tests to `docker_cli_pull_trusted_test.go`.

Move tests depending on a local registry to `docker_cli_pull_local_test.go`.

Signed-off-by: Arnaud Porterie <arnaud.porterie@docker.com>
Upstream-commit: f324f4851f28edfd8dab82cd624a4ec1f01cd207
Component: engine
2015-09-03 15:57:41 -07:00
190c9ba004 Use DockerSuite for PullClientDisconnect test
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Upstream-commit: 9dd6c8822ddccff1952dfd611263ba551693ff7d
Component: engine
2015-08-27 11:22:54 -07:00
2a748ae2e6 Fix pull on client disconnect
Fixes #15589

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Upstream-commit: 8eeafa058c762b303436422a4682c364fe469985
Component: engine
2015-08-18 09:41:37 -07:00
4c1bdea55d Skip notary tests which update system clock
Currently some notary tests change the system clock to check for expiration.
Skip these tests until the code can be refactored to not rely on updating the system clock.

Signed-off-by: Derek McGowan <derek@mcgstyle.net> (github: dmcgowan)
Upstream-commit: bf3c1e6a3afc951e41643b8d55d4ac25fa9cb06d
Component: engine
2015-07-29 12:09:40 -07:00
6e14356132 Don't pass check.C to dockerCmdWithError
Signed-off-by: Brian Goff <cpuguy83@gmail.com>
Upstream-commit: 693ba98cb9118bf15caaabc69ca281c0ce604226
Component: engine
2015-07-27 14:33:32 -04:00
99a373ceb8 Rename to flags and environment variables to content trust
Update help line to allow 90 characters instead of 80

The trust flag pushes out the help description column wider, requiring more room to display help messages.

Signed-off-by: Derek McGowan <derek@mcgstyle.net> (github: dmcgowan)
Upstream-commit: 259cadb0b19a9049302e78fec529b0105efabb1d
Component: engine
2015-07-24 16:31:18 -07:00
e5887c6923 Added tests for expired snapshots and timestamps
Signed-off-by: Diogo Monica <diogo@docker.com>
Upstream-commit: 3e90b12d42f6f937639edafa4b2ddc12badf8895
Component: engine
2015-07-24 16:31:18 -07:00
937cba2db1 Add tests simulating an evil server
Signed-off-by: Nathan McCauley <nathan.mccauley@docker.com>
Upstream-commit: 268fa5af4768f7b1df32501d5f7ba0daba2c2da1
Component: engine
2015-07-24 16:31:18 -07:00
97834446bf Add build integration cli tests
Clean up tests to remove duplicate code

Add tests which run pull and create in an isolated configuration directory.
Add build test for untrusted tag

Signed-off-by: Derek McGowan <derek@mcgstyle.net> (github: dmcgowan)
Upstream-commit: 871d2b96ed5cf234c41a5e731a34fc9deda4e9f1
Component: engine
2015-07-24 16:31:12 -07:00
08efdea505 Add test for incorrect nonroot passphrase
Fix failing tests for create, push, and pull

Signed-off-by: Diogo Monica <diogo@docker.com>
Upstream-commit: eeb6d0a71b754c1c99748f7ba08be27e4d8b8eb9
Component: engine
2015-07-24 14:08:20 -07:00
be6fe06878 Add trust tests for Docker create, run, push, and pull
Created date util function

Signed-off-by: Nathan McCauley <nathan.mccauley@docker.com>
Upstream-commit: 1406cb35fd814a987b91f92ed1a4b61a21205736
Component: engine
2015-07-24 14:08:20 -07:00
5eae9c3c28 Add more integration tests for trusted push and pull
Signed-off-by: Diogo Monica <diogo@docker.com>
Upstream-commit: 356b07c89602e4f5e9c9d4c53ec24b341b4e7865
Component: engine
2015-07-24 14:08:20 -07:00
b82ed8bb95 Add integration cli trust tests
Added notary server to docker base image.
Created trust suite which runs trust server for running trusted commands.

Signed-off-by: Derek McGowan <derek@mcgstyle.net> (github: dmcgowan)
Upstream-commit: 58a1de9b59594948df152f0003e759b77bcaa56a
Component: engine
2015-07-24 14:08:20 -07:00
1492d5ce64 Update graph to use vendored distribution client for the v2 codepath
Signed-off-by: Derek McGowan <derek@mcgstyle.net> (github: dmcgowan)
Signed-off-by: Tibor Vass <tibor@docker.com>
Upstream-commit: 19515a7ad859b28c474d81e756ac245afcd968e3
Component: engine
2015-07-16 13:13:47 -04:00
abe73960d5 Use dockerCmd when possible (#14603)
- integration-cli/docker_cli_attach_test.go
- integration-cli/docker_cli_attach_unix_test.go
- integration-cli/docker_cli_build_test.go
- integration-cli/docker_cli_build_unix_test.go
- integration-cli/docker_cli_by_digest_test.go
- integration-cli/docker_cli_commit_test.go
- integration-cli/docker_cli_config_test.go
- integration-cli/docker_cli_cp_test.go
- integration-cli/docker_cli_create_test.go
- integration-cli/docker_cli_pause_test.go
- integration-cli/docker_cli_port_test.go
- integration-cli/docker_cli_port_unix_test.go
- integration-cli/docker_cli_proxy_test.go
- integration-cli/docker_cli_ps_test.go
- integration-cli/docker_cli_pull_test.go
- integration-cli/docker_cli_push_test.go

- docker_api_attach_test.go
- docker_api_containers_test.go
- docker_api_events_test.go
- docker_api_exec_resize_test.go
- docker_api_exec_test.go
- docker_api_images_test.go
- docker_api_info_test.go

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
Upstream-commit: 5c295460da2098d971eda28a73b416ff6be62f53
Component: engine
2015-07-14 21:52:43 +02:00
f310d0a0b6 Add TestPullImageWithAllTagFromCentralRegistry test case.
Signed-off-by: Yuan Sun <sunyuan3@huawei.com>
Upstream-commit: c9a4c1401fc79d6cdee222a2b82cdb8379402552
Component: engine
2015-07-08 19:47:33 +08:00
a2a6303a84 Implement DockerRegistrySuite in integration-cli
To avoid manually creating and destroying registrys in tests.

Signed-off-by: Alexander Morozov <lk4d4@docker.com>
Upstream-commit: f696b1071a296bee1f4ac7cafa807ce337fb9f2c
Component: engine
2015-04-24 14:17:00 -07:00
c48fdf0abd Implement teardown removeAllImages
Signed-off-by: Alexander Morozov <lk4d4@docker.com>
Upstream-commit: a9688cdca5577d6db65d76f38bcbe4c1e6f5994f
Component: engine
2015-04-24 10:37:21 -07:00
88eea81abe Merge pull request #12655 from jlhawn/fix_12281
Validate repo name before image pull
Upstream-commit: 68fc79f5924bc76111422eec5b7713a586febd96
Component: engine
2015-04-23 13:12:12 -07:00
8cb2465efc Validate repo name before image pull
Checks for reserved 'scratch' image name.

fixes #12281

Docker-DCO-1.1-Signed-off-by: Josh Hawn <josh.hawn@docker.com> (github: jlhawn)
Upstream-commit: 18f46883851e47387ec2bd116940cdae97ba3c8d
Component: engine
2015-04-23 11:44:46 -07:00
f72daf37a9 add integration test for error pull nonexistent
Signed-off-by: Jessica Frazelle <princess@docker.com>
Upstream-commit: 7a525c6cb74af854d621f5560868b32694d2553b
Component: engine
2015-04-22 14:11:25 -07:00
1884ef3b9b Use suite for integration-cli
It prints test name and duration for each test.
Also performs deleteAllContainers after each test.

Signed-off-by: Alexander Morozov <lk4d4@docker.com>
Upstream-commit: dc944ea7e48d11a2906e751d3e61daf08faee054
Component: engine
2015-04-21 10:28:52 -07:00
7e8cef686e Skip TestPullVerified
Signed-off-by: Arnaud Porterie <arnaud.porterie@docker.com>
Upstream-commit: 9a4fa9c19167756cf39a4d002efe81d4bcd3bb75
Component: engine
2015-04-16 23:05:47 -07:00
11fbf94cfd Revert all but TestPullImageFromCentralRegistry changes
Signed-off-by: Arnaud Porterie <arnaud.porterie@docker.com>
Upstream-commit: 8900ae2928cea8f4b5d52ff68253cad2504edd6c
Component: engine
2015-03-24 16:27:35 -07:00
92fbf90d6e Fix the TestPullImageFromCentralRegistry to skip and add local v1 registry test when net=none
Closes #10966
Signed-off-by: Srini Brahmaroutu <srbrahma@us.ibm.com>
Upstream-commit: 5d70a97b1fff8286220d2bef9ceb248401f046d1
Component: engine
2015-03-23 22:53:04 +00:00
293d14edd7 Merge pull request #11264 from brahmaroutu/fixtest_10967
Test image api through local V1 repo, skip network test.
Upstream-commit: 3b4ff1c132669017f04d3b2e67517ff0c9a1a3df
Component: engine
2015-03-23 15:20:39 -07:00
31ae66ceae Test image api through local V1 repo
Closes #10967
Signed-off-by: Srini Brahmaroutu <srbrahma@us.ibm.com>
Upstream-commit: 5daa9260bcef2a47c493adc04e6638c9d200a9cf
Component: engine
2015-03-23 16:45:48 +00:00
67fed9c55e Restore TestPullVerified test
Signed-off-by: Arnaud Porterie <arnaud.porterie@docker.com>
Upstream-commit: 33448ac3c9c0c63fb07f7bf04cec998d3536fc10
Component: engine
2015-03-22 17:56:05 -07:00
503af64bfc Skip TestPullVerified because hello-world image cannot be verified
Signed-off-by: Tibor Vass <tibor@docker.com>
Upstream-commit: df389df9904dc1585160d7992c6f3dc150490e05
Component: engine
2015-03-22 19:34:40 -04:00
e071644a3f Update verification message logic
Only show the verification message if all the tarsum checks pass and the image manifest is verified.
No longer return an error when a tarsum verification fails, just reset the verification flag.
Tarsum verification is less meaningful without a verified manifest and therefore it should not cause an error.
Updated the verified image test to pull an image which expected to have a verified manifest and contents.

Signed-off-by: Derek McGowan <derek@mcgstyle.net> (github: dmcgowan)
Upstream-commit: 6088df20c33afafa523b9dd9b0acdd3b987c4534
Component: engine
2015-02-05 17:46:55 -08:00
3ae87a3a28 Fix some go vet errors
Signed-off-by: Alexander Morozov <lk4d4@docker.com>
Upstream-commit: 4ee05a4d3e6f9ad955d96075a1e63d59ed73ac78
Component: engine
2015-02-02 14:53:20 -08:00
12b02aa7f6 Revert client signature
Supports multiple tag push with daemon signature

Fixes #10444

Signed-off-by: Derek McGowan <derek@mcgstyle.net> (github: dmcgowan)
Upstream-commit: 403d981d70dc8a493a9a10be4b5d2e2ce871f380
Component: engine
2015-01-30 14:20:32 -08:00
f6fc27f6b6 Add test for pull verified
Docker-DCO-1.1-Signed-off-by: Jessica Frazelle <jess@docker.com> (github: jfrazelle)
Upstream-commit: 614e09a8c7990e05509edb4c335c4b59001cea61
Component: engine
2015-01-21 16:25:01 -08:00
ce12855fec Fix failing integration tests
Signed-off-by: Derek McGowan <derek@mcgstyle.net> (github: dmcgowan)
Upstream-commit: f29aacbc4804e3aca1c21b9411e960b2a2543da1
Component: engine
2015-01-16 11:34:45 -08:00
557565cd70 Test pulling image with aliases
Signed-off-by: Arnaud Porterie <arnaud.porterie@docker.com>
Upstream-commit: 92d5eafe03eca8ca931ddca5ef7d6e41ca25caad
Component: engine
2015-01-15 14:05:06 -08:00
5aa04a56fb Deprecating ResolveRepositoryName
Passing RepositoryInfo to ResolveAuthConfig, pullRepository, and pushRepository

Moving --registry-mirror configuration to registry config

Created resolve_repository job

Repo names with 'index.docker.io' or 'docker.io' are now synonymous with omitting an index name.

Adding test for RepositoryInfo

Adding tests for opts.StringSetOpts and registry.ValidateMirror

Fixing search term use of repoInfo

Adding integration tests for registry mirror configuration

Normalizing LookupImage image name to match LocalName parsing rules

Normalizing repository LocalName to avoid multiple references to an official image

Removing errorOut use in tests

Removing TODO comment

gofmt changes

golint comments cleanup.  renaming RegistryOptions => registry.Options, and RegistryServiceConfig => registry.ServiceConfig

Splitting out builtins.Registry and registry.NewService calls

Stray whitespace cleanup

Moving integration tests for Mirrors and InsecureRegistries into TestNewIndexInfo unit test

Factoring out ValidateRepositoryName from NewRepositoryInfo

Removing unused IndexServerURL

Allowing json marshaling of ServiceConfig.  Exposing ServiceConfig in /info

Switching to CamelCase for json marshaling

PR cleanup; removing 'Is' prefix from boolean members.  Removing unneeded json tags.

Removing non-cleanup related fix for 'localhost:[port]' in splitReposName

Merge fixes for gh9735

Fixing integration test

Reapplying #9754

Adding comment on config.IndexConfigs use from isSecureIndex

Remove unused error return value from isSecureIndex

Signed-off-by: Don Kjer <don.kjer@gmail.com>

Adding back comment in isSecureIndex

Signed-off-by: Don Kjer <don.kjer@gmail.com>
Upstream-commit: 568f86eb186731b907b659e4ec64bda21c2fe31d
Component: engine
2015-01-08 20:14:58 +00:00
98bb6eba72 Make FROM scratch a special cased 'no-base' spec
There has been a lot of discussion (issues 4242 and 5262) about making
`FROM scratch` either a special case or making `FROM` optional, implying
starting from an empty file system.

This patch makes the build command `FROM scratch` special cased from now on
and if used does not pull/set the the initial layer of the build to the ancient
image ID (511136ea..) but instead marks the build as having no base image. The
next command in the dockerfile will create an image with a parent image ID of "".
This means every image ever can now use one fewer layer!

This also makes the image name `scratch` a reserved name by the TagStore. You
will not be able to tag an image with this name from now on. If any users
currently have an image tagged as `scratch`, they will still be able to use that
image, but will not be able to tag a new image with that name.

Goodbye '511136ea3c5a64f264b78b5433614aec563103b4d4702f3ba7d4d2698e22c158',
it was nice knowing you.

Fixes #4242

Docker-DCO-1.1-Signed-off-by: Josh Hawn <josh.hawn@docker.com> (github: jlhawn)
Upstream-commit: 8936789919c5c8004f346f44a3452d1521818b60
Component: engine
2014-12-18 14:03:38 -08:00
07c8c2eea7 Fix vet errors
Signed-off-by: Alexandr Morozov <lk4d4@docker.com>
Upstream-commit: 18d9f1978b311ff9cadce9f0237313db14502f9f
Component: engine
2014-11-05 08:26:22 -08:00
2c526d9f92 Cleanup errorOut resp pull tests
Docker-DCO-1.1-Signed-off-by: Jessica Frazelle <jess@docker.com> (github: jfrazelle)
Upstream-commit: eeb009729430f0858f56be37011325f3f9486386
Component: engine
2014-10-16 15:06:20 -07:00
4092cbb7ff Pull all image aliases for id. Closes #8141.
Docker-DCO-1.1-Signed-off-by: Jessica Frazelle <jess@docker.com> (github: jfrazelle)
Upstream-commit: 7d74be162c9704df848c865a9b4bcd4047da9124
Component: engine
2014-09-25 11:48:49 -07:00
901086a5c9 integcli: pull scratch for pull test
Docker-DCO-1.1-Signed-off-by: Cristian Staretu <cristian.staretu@gmail.com> (github: unclejack)
Upstream-commit: 77d29847e2a59a7b3e56144c774c28a3b7370c91
Component: engine
2014-09-22 19:03:19 +03:00
82a799b98b pull only busybox:latest
Docker-DCO-1.1-Signed-off-by: Victor Vieux <vieux@docker.com> (github: vieux)
Upstream-commit: b8932abcd3f3932b6b56aa859b4c0762a95f7179
Component: engine
2014-06-02 19:54:17 +00:00
624997be0f initial version of cli integration tests
Docker-DCO-1.1-Signed-off-by: Cristian Staretu <cristian.staretu@gmail.com> (github: unclejack)
Upstream-commit: 6db32fdefdae49843ed9535b3af1099e6bd2755d
Component: engine
2014-03-29 23:09:40 +02:00