Commit Graph

675 Commits

Author SHA1 Message Date
a10bff4186 Merge pull request #32088 from simonferquel/windows-dockerignore-fix
Fix behavior of absolute paths in .dockerignore
Upstream-commit: c21c17c64260f474824d9591a4c026a7a01e66e5
Component: engine
2017-06-13 13:36:39 +02:00
63a5fba1a8 builder: add a test for ENV name (without =value)
Signed-off-by: Akihiro Suda <suda.akihiro@lab.ntt.co.jp>
Upstream-commit: 09eca591f723f9acd0909b04144c229b6cd59912
Component: engine
2017-06-07 05:23:26 +00:00
a7fe10a440 Fix Cache with ONBUILD
Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: f1ade82d82e6436971c6b7d08eb1da57ed9ba756
Component: engine
2017-06-06 10:52:29 -04:00
80e1c19817 Merge pull request #33500 from dnephin/fix-onbuild-copy
Fix ONBUILD COPY
Upstream-commit: 34f1cd26b67271c0fce60ab87c0c51e28f1ab6f2
Component: engine
2017-06-05 11:48:57 +02:00
4358607de5 Fix ONBUILD COPY
the source was missing from the second dispatch

Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: 3f2604157790408acf5ad05c74cebe105f2b6979
Component: engine
2017-06-02 17:47:03 -04:00
b8e386fca4 Move pkg/gitutils to remotecontext/git
Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: b9d85ac58db8b8d4480fca93f8b952d084ea36f5
Component: engine
2017-06-02 16:54:50 -04:00
b9c4f53912 Remove the last of pkg/httputil
Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: 4060d6ee0b130cf74294c309dfbd3c860fd2a7f8
Component: engine
2017-06-02 16:54:36 -04:00
04eec7106a Move httputils/mimtype to the single consumser, and remove unused function.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: c91521be68182b450a22f018ccc9d780571a5936
Component: engine
2017-06-02 16:10:39 -04:00
cfcd7c0452 Merge pull request #33436 from Microsoft/jjh/parserdirective
Builder: Fix parser directive refactoring
Upstream-commit: 57ca00240b9b73d967aad1deae07294fef092f98
Component: engine
2017-06-01 21:21:46 -07:00
4cb2e1a089 Builder: Fix parser directive refactoring
Signed-off-by: John Howard <jhoward@microsoft.com>
Upstream-commit: c97170d618b7a1f35f47672143bd287666802287
Component: engine
2017-05-31 18:48:27 -07:00
733e94a59a Merge pull request #33363 from tonistiigi/fix-chunked-build
Fix cancelling builder on chunked requests
Upstream-commit: 7ea0d1ecc6436063bfc9c72d09a75f15b029ac88
Component: engine
2017-05-31 20:18:35 +02:00
e549564e77 Fix cancelling builder on chunked requests
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Upstream-commit: 23628bd7efb0aae565cea5ee040e373b0c93fd8d
Component: engine
2017-05-23 16:29:13 -07:00
850d525b5f Extract imageProber and ContainerBackend from Builder
Extract a common function for builder.createContainer
Extract imageCache for doing cache probes
Removes the cacheBuested field from Builder
Create a new containerManager class which reduces the interface between the
builder and managing containers to 3 functions (from 6)

Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: 19f3b0715cf89f336efa286ea1d3f8b57d8c4973
Component: engine
2017-05-23 15:12:58 -04:00
1f72326d67 Refactor builder.calcCopyInfo and dependencies
Remove pathCache from imageContexts
Extract validateCopySourcePath
Extract copyWithWildcards
Extract copyInfoForFile and walkSource from calcCopyInfo
Move copy internals to copy.go
remove source from Builder

Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: 213ed02e255d881826aab002ad1d5df67de56b20
Component: engine
2017-05-17 09:54:39 -04: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
3f22cbeb2a Update Container Wait Backend
This patch consolidates the two WaitStop and WaitWithContext methods
on the container.State type. Now there is a single method, Wait, which
takes a context and a bool specifying whether to wait for not just a
container exit but also removal.

The behavior has been changed slightly so that a wait call during a
Created state will not return immediately but instead wait for the
container to be started and then exited.

The interface has been changed to no longer block, but instead returns
a channel on which the caller can receive a *StateStatus value which
indicates the ExitCode or an error if there was one (like a context
timeout or state transition error).

These changes have been propagated through the rest of the deamon to
preserve all other existing behavior.

Docker-DCO-1.1-Signed-off-by: Josh Hawn <josh.hawn@docker.com> (github: jlhawn)
Upstream-commit: cfdf84d5d04c8ee656e5c4ad3db993c258e52674
Component: engine
2017-05-16 15:09:14 -07:00
9ca246ac83 Merge pull request #32959 from simonferquel/tar-filemode-windows
Respect tar entries modes when rewriting them on Windows
Upstream-commit: ad846a136a75637c64423d7f9eb0f2f5e433a360
Component: engine
2017-05-16 11:45:42 -07:00
418f2b9f51 Merge pull request #33179 from tonistiigi/fix-from-scratch
Fix resetting image metadata between stages for scratch case
Upstream-commit: 4e0fdc9098e2ff9e4e78287f8d60aef8af465d55
Component: engine
2017-05-13 21:17:02 -07:00
e5c39230b9 Merge pull request #32700 from jphuynh/more-maintainer-deprecation
MAINTAINER deprecation follow up. Relates to #25466
Upstream-commit: 20255ade2965440d22e149cdd7c32e207f6918ba
Component: engine
2017-05-13 17:28:52 +02:00
033ef466ec Fix resetting image metadata between stages for scratch case
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Upstream-commit: b192218503427a49b6de0a093e38e2697a22427a
Component: engine
2017-05-12 12:00:55 -07:00
df464dbe2f Refactor imageContexts into two different structs.
buildStages now tracks the imageID and runConfig for a build stage

imageMounter tracks image mounts so they can released when the build ends.

Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: 6c28e8edd5f047d5b1438f773d49882f28d7a006
Component: engine
2017-05-10 17:59:30 -04:00
01b4a22798 Refactor interaction between dispatcher.from and dispatchState
Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: ab3a037a5b77220d0524ce2b17105e1daae39425
Component: engine
2017-05-10 17:58:57 -04:00
e526b1e1d8 Expose a smaller interface for the Builder retrieving images from daemon
Removes 3 methods from the builder.Backend interface
Remove the coupling between imageContexts, imageMounts and the builder.

Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: b3bc7b28d09138a37ab5476eb46dfe74f8984f18
Component: engine
2017-05-10 17:58:57 -04:00
a27f8db366 Merge pull request #33090 from tonistiigi/fix-release-mounts
builder: Fix releasing implicit mounts
Upstream-commit: a3eebaf50937c715936480a1ef46577b0df8b686
Component: engine
2017-05-10 14:46:58 -07:00
f04e158c49 Merge pull request #33114 from dnephin/fix-builder-warn-on-unused-builtint
Fix warning for unused build args
Upstream-commit: 22a03192fbf10f583003135421fcbc72c38f1ee4
Component: engine
2017-05-10 09:38:07 +02:00
89b14a8486 Merge pull request #32997 from dnephin/fix-builder-scratch-with-name
Fix a rare case where using FROM scratch as NAME would fail
Upstream-commit: 543dfde6370e2d9b959fe1f8bcf0e51125d75af2
Component: engine
2017-05-09 18:15:33 -04:00
6044c2ae89 Merge pull request #32792 from rogaha/extra_prometheus_metrics
Add extra prometheus metrics
Upstream-commit: 1a6f8a92b2c5912058828d560f52281ba0424472
Component: engine
2017-05-09 21:48:34 +02:00
3a59c54458 Fix warning for unused build args.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: 72cc81ee8dcfca5503f3a02289f8f3d4a08582ad
Component: engine
2017-05-09 11:25:33 -04:00
a7451e12cd Add extra prometheus metrics
- buildsTriggered
 - buildsFailed
    - valid options:
        metricsDockerfileSyntaxError,
        metricsDockerfileEmptyError,
        metricsCommandNotSupportedError,
        metricsErrorProcessingCommandsError,
        metricsBuildTargetNotReachableError,
        metricsMissingOnbuildArgumentsError,
        metricsUnknownInstructionError,
        metricsBuildCanceled,
- engineInfo

Signed-off-by: Roberto Gandolfo Hashioka <roberto_hashioka@hotmail.com>
Upstream-commit: a28b173a780cd06db6d93197c54b00a7d616b3dc
Component: engine
2017-05-09 01:04:40 -07:00
35368a62c5 builder: Fix releasing implicit mounts
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Upstream-commit: 29efb93a19fd46e026055892ccd5c5f44743277d
Component: engine
2017-05-08 10:32:20 -07:00
bd17f42bef Add docker build --iidfile=FILE
This is synonymous with `docker run --cidfile=FILE` and writes the digest of
the newly built image to the named file. This is intended to be used by build
systems which want to avoid tagging (perhaps because they are in CI or
otherwise want to avoid fixed names which can clash) by enabling e.g. Makefile
constructs like:

    image.id: Dockerfile
    	docker build --iidfile=image.id .

    do-some-more-stuff: image.id
    	do-stuff-with <image.id

Currently the only way to achieve this is to use `docker build -q` and capture
the stdout, but at the expense of losing the build output.

In non-silent mode (without `-q`) with API >= v1.29 the caller will now see a
`JSONMessage` with the `Aux` field containing a `types.BuildResult` in the
output stream for each image/layer produced during the build, with the final
one being the end product.  Having all of the intermediate images might be
interesting in some cases.

In silent mode (with `-q`) there is no change, on success the only output will
be the resulting image digest as it was previosuly.

There was no wrapper to just output an Aux section without enclosing it in a
Progress, so add one here.

Added some tests to integration cli tests.

Signed-off-by: Ian Campbell <ian.campbell@docker.com>
Upstream-commit: 5894bc1abf8186802d360d20739b57bfffed51df
Component: engine
2017-05-05 16:35:54 +01:00
a3ce4c9995 Fix a rare case where using FROM scracth as NAME would fail
Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: 28379bd29a88a58dee8bf8f4059f3f7854ec8249
Component: engine
2017-05-05 11:14:03 -04:00
5ce7dab3ff Merge pull request #33033 from YuPengZTE/devReadAll
check err
Upstream-commit: b61ffbfb527cf9d9998b8d2c514749a51e7640ae
Component: engine
2017-05-05 22:33:23 +09:00
a7c561e6df check err
Signed-off-by: yupengzte <yu.peng36@zte.com.cn>
Upstream-commit: 0d99cb862997d9421d5c5c4dc96983067ddc4d84
Component: engine
2017-05-05 13:33:40 +08:00
965d054208 Some refactoring of dispatch()
Remove runConfig from Builder and dispatchRequest. It is not only on
dispatchState.

Move dispatch state fields from Builder to dispatchState

Move stageName tracking to dispatchRequest.

Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: 2f0ebba0e7f43908a41d5ff9bbb1b9b78743a6ab
Component: engine
2017-05-04 17:11:08 -04:00
9494cbba92 Merge pull request #32749 from dnephin/rm-ContainerUpdateCmdOnBuild
[Builder] Remove ContainerUpdateCmdOnBuild
Upstream-commit: 37be26382614d833e4855b4fc1eb89a6817d8426
Component: engine
2017-05-03 14:02:08 -04:00
0046c26e1e Merge pull request #32949 from dnephin/refactor-streamformatter-and-progress
Refacator pkg/streamformatter
Upstream-commit: 08d7fad45dce832dc03934e9f4fc904899220c96
Component: engine
2017-05-03 09:05:26 -07:00
d3da06632a Fix run with entrypoint in base image
Update a test to use a base image with entrypoint to that the linux build
has at least one test that behaves like all the windows tests.

Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: d9371ee80764d0eecf7b8a562121f0a6234167a3
Component: engine
2017-05-03 10:59:38 -04:00
8e846811d4 Remove ContainerUpdateCmdOnBuild, it does nothing.
Set a blank entrypoint to preserve the old behaviour.

Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: 97f860716497f6f75236b72e4af90e01afad832c
Component: engine
2017-05-03 10:59:38 -04:00
4886c78246 Fix setting b.runConfig.Image at arbitrary places.
Previously this value was set at some point attrbitrarily between when it was updated and when it was going to be used next.

Instead always set it as the last step of dispatch.

Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: 3dcab289821ddd4575b7e48d463ba8ef2af492ea
Component: engine
2017-05-03 10:59:37 -04:00
755f9321e1 Refacator pkg/streamformatter
StreamFormatter suffered was two distinct structs mixed into a single struct
without any overlap.

Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: c87d67b0ad788a6a80d1af89488e2d1f22726c34
Component: engine
2017-05-02 17:38:12 -04:00
0802cc654a Respect tar entries modes when rewriting them on Windows
Previously, only perm-related bits where preserved when rewriting
FileMode in tar entries on Windows. This had the nasty side effect of
having tarsum returning different values when executing from a tar filed
produced on Windows or Linux.

This fix the issue, and pave the way for incremental build context
to work in hybrid contexts.

Signed-off-by: Simon Ferquel <simon.ferquel@docker.com>
Upstream-commit: 41eb61d5c2a44c745b11ada948034fd3bcc42db5
Component: engine
2017-05-02 11:36:43 +02:00
dbcc3f98b6 Cleanup all the mutate + defer revert of b.runConfig in the builder
Instead of mutating and reverting, just create a copy and pass the copy
around.

Add a unit test for builder dispatcher.run

Fix two test failures

Fix image history by adding a CreatedBy to commit options. Previously the
createdBy field was being created by modifying a reference to the runConfig that
was held from when the container was created.

Fix a test that expected a trailing slash. Previously the runConfig was being
modified by container create. Now that we're creating a copy of runConfig
instead of sharing a reference the runConfig retains the trailing slash.

Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: 9f738cc574d50d0a2accdf6f6deb30405c24a80c
Component: engine
2017-05-01 18:36:53 -04:00
3d193f829d Extract squash and tagging from the Dockerfile builder.
Remove pathCache and replace it with syncmap
Cleanup NewBuilder
Create an api/server/backend/build
Extract BuildTagger

Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: 0296797f0f39477d675128c93c1646b3186937ee
Component: engine
2017-05-01 12:07:32 -04:00
5d06c101d8 Fix cache miss when builtin build args are used.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: 721e1736ae31914902d2c2196aed5f92e1a0982d
Component: engine
2017-04-28 12:49:50 -04:00
ad91de1337 Merge pull request #32772 from dnephin/refactor-builder-split-commit
[Builder] Refactor `Builder.commit()`
Upstream-commit: ec67cea96e0fd90a7a266e1adac9fe1867c8ae13
Component: engine
2017-04-28 11:18:55 -04:00
9f6af10310 Merge pull request #32763 from dave-tucker/fix-32744
builder: Make builtin arg pruning work with > 1 arg
Upstream-commit: 9f0ebea33579b1c6cec8ae445ac3b21655aa3bcd
Component: engine
2017-04-28 10:24:13 -04:00
b5c88cd04e Merge pull request #32504 from dongluochen/healthcheck_duration
do not allow duration less than 1 ms in healthcheck parameters
Upstream-commit: a7519152d9be7a0dd6941d529ea4b83cf4b7f1d4
Component: engine
2017-04-27 23:54:00 -04:00
f6bbbde171 Extract commitContainer from commit() to separate the distinct branches
Remove unused arguments to commit.
This will allow us to remove all the runConfig mutate+revert code that
is scattered around builder dispatchers/internals

Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: 0d9e66b98ac9237b561d9beee5ecfe6a133ffc8f
Component: engine
2017-04-27 20:49:38 -04:00
ce59d98dee Merge pull request #32858 from dnephin/builder-shell-words-interface
[Builder] Remove b.escapeToken, create ShellLex
Upstream-commit: aee2da3bdf6665939722dacf3b0c149499c35d90
Component: engine
2017-04-27 13:16:40 -04:00