Commit Graph

618 Commits

Author SHA1 Message Date
0411944839 Merge pull request #31856 from jim-minter/more_races
Resolve a set of race conditions in logging and attaching code
Upstream-commit: 5eca7f7c5d7678f6548cd7d90199d67ce98d4c98
Component: engine
2017-04-26 16:04:02 -07:00
6c0f9bd02c Reduce the number of calls to b.image
In preparation for removing it from builder.

Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: 52626bb9199ca3562fa70f14d8fc7b8c12c8b0f5
Component: engine
2017-04-24 14:21:19 -04:00
7e9b6e3ca4 Change builder.dispatchers to use a dispatchRequest object
This change starts the process of splitting up the Builder into logical
components. Remove builder.flags and move it to the new dispatchRequest
object.

Use runConfig from dispatchRequest instead of from the builder.

More progress removing things from the Builder struct.

Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: e59327aaac338bd350746e0e6479489f21a0a1fa
Component: engine
2017-04-24 14:21:19 -04:00
57d7fd25ff Merge pull request #32500 from dnephin/refactor-from-dispatcher
Refactor from dispatcher
Upstream-commit: 3beb8d9c8bc77762abceea52a742c1221636ea44
Component: engine
2017-04-24 10:10:42 -07:00
3df8030542 Fix race on ContainerAttachRaw
Signed-off-by: Jim Minter <jminter@redhat.com>
Upstream-commit: 32ca1214fa55f55c54a54061ecf752b75f2c72c3
Component: engine
2017-04-20 12:27:50 +01: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
834babfd94 Merge pull request #32601 from dnephin/builder-shell-words-buffer
Use a bytes.Buffer for shell_words string concat
Upstream-commit: 41f4c3cf7e270086bb2f6a6bd4622d9aeb8f741f
Component: engine
2017-04-13 23:22:18 +02:00
aa3095ef47 remove increment flag on imageContexts.new()
Rename the methods to match my understanding of the behaviour.

Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: aafd7fa96909f48e43fd1b785c3c3a1f8b656ede
Component: engine
2017-04-13 14:56:57 -04:00
b84c939d61 Extract two functions from the FROM dispatcher
This helps clarify the difference cases for parsing ctxName, and for
getting an image.

Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: 4d62f67117ca515671fcc882807bfc4862067ea6
Component: engine
2017-04-13 14:56:57 -04:00
80987246bf Merge pull request #32580 from dnephin/refactor-builder-parser-directive
Refactor Dockerfile.parser and directive
Upstream-commit: 700b4807c3a120181973c675a8f69192d961e13f
Component: engine
2017-04-13 20:47:42 +02:00
964c3672d4 Use a bytes.Buffer for shell_words string concat
It's much faster

Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: 0055a48277b4dcec644ddfbf94d8b96c58d5e03e
Component: engine
2017-04-13 14:39:34 -04:00
0b7785856b Merge pull request #32328 from duglin/fixEnvVars
Minor tweaks to quotes in env vars
Upstream-commit: df3c4254072d110ecfcefeda94279c25e6a9f334
Component: engine
2017-04-13 10:41:28 -04:00
78d1a8154c Refactor dockerfile parser
Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: 4cbc953a5d80c850df7107b28e743e933bbeb1d3
Component: engine
2017-04-12 18:31:52 -04:00
96891f1f0d Cleanup processing of directives.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: 9c53fa2d0c1796d32aaba2193e7d802cd9b66763
Component: engine
2017-04-12 15:42:35 -04:00
e1a50e229d Minor tweaks to quotes in env vars
Addresses part of #32140, in particular:
- this will make it so that double backslashes in double-quoted
strings will result in a single backslash. While in single quotes it remains
a double backslash.
- missing closing " and ' will now generate an error

Signed-off-by: Doug Davis <dug@us.ibm.com>
Upstream-commit: 2fb7c3c4f0b2fe15e279729a87c465df4fa70879
Component: engine
2017-04-12 12:20:14 -07:00
7e99490a6a Keep parser.Directive internal to parser
Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: 64c4c1c3d5e0fe364d83db5a8dc99a24fd121754
Component: engine
2017-04-12 14:48:09 -04:00
bbeb6127dc Hide builder.parser.Directive internals
Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: bb429da9a977a9d89121052fe1143528294b8a0c
Component: engine
2017-04-12 14:48:09 -04:00
203ab34184 Merge pull request #32532 from dnephin/refactor-some-builder-parts
[builder] cleanup env dispatcher and Builder.build()
Upstream-commit: d2ab40e5b99bc2ab0abfea146544a20ce6081942
Component: engine
2017-04-12 11:11:06 -07:00
cdb97bb321 Merge pull request #32370 from AkihiroSuda/improve-build-error
builder/dockerfile: improve error message about build stage name
Upstream-commit: 3c072598820e8b435151289ee0d8b74cb7e047ba
Component: engine
2017-04-12 16:33:23 +02:00
5aac0fb7d6 builder/dockerfile: improve error message about build stage name
Signed-off-by: Akihiro Suda <suda.akihiro@lab.ntt.co.jp>
Upstream-commit: 50a9be4bf5b8a57acc455eaf7c3842b2df046f71
Component: engine
2017-04-12 05:27:39 +00:00
862dffcf24 Remove unused Builder.Cancel()
Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: 068f344e032ad4489a88665adec683e06ad6f3c7
Component: engine
2017-04-11 20:33:13 -04:00
a00fca972d Remove unused id field from Builder.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: a6abd57b83dc0aaf0cedeeb488c8a41262e46b7d
Component: engine
2017-04-11 14:44:32 -04:00
a5b8a0845e Factor out functions from builder/dockerfile/builder.go:Builder.build()
Remove the block comment which is stale, and redundant now that the
function is just as readable as the comment.

Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: bfcd95817afaedb078022fc2f335ead64afee55c
Component: engine
2017-04-11 14:44:32 -04:00
6fb208126e Cleanup in dispatcher.env
Remove commented code blocks
Remove some duplication in comparing and restructuring env

Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: c7fad9b750f8f143a22cc5a85a1dc26573025414
Component: engine
2017-04-11 14:44:28 -04:00
443e2161ff Merge pull request #32495 from dnephin/cleanup-builder-dispatcher-env
Remove Builder.dockerfile field
Upstream-commit: b764c471bf1a648342a4b4f58de1e9768b49b4ed
Component: engine
2017-04-11 14:50:55 +09: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
4eb0844e51 Remove the dockerfile field from Builder.
Return dockerfile from parseDockerfile and pass the dockerfile nodes
as an arg

Strip unused arg from builder.NewBuilder.

Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: f3e205ddc15040ec80ef047959afa7b75586a491
Component: engine
2017-04-10 18:09:17 -04:00
43f24a2541 Merge pull request #31352 from dnephin/allow-arg-in-fromt
[dockerfile] Allow ARG in FROM
Upstream-commit: 4d9e32a08e8e2613601cbc5d36bd8c7ecf32a772
Component: engine
2017-04-10 13:23:40 -04:00
8c6400b4e4 Refactor BuildArgs
Add MetaArgs for ARG that occur before the first FROM
Integration test for these cases.

Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: 239c53bf836174108dbae445a394a290f5fe2898
Component: engine
2017-04-07 17:57:47 -04:00
bc5cfcbd12 Fix arg in from when arg is not defined
Add mock builder backend
Add tests for ARG in FROM

Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: 9b4aa7629c527bc2076de984e77627757f20db68
Component: engine
2017-04-07 17:57:47 -04:00
d6d79998e2 Allow ARG to come before FROM to support variables in FROM.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: f0a9c2e3f4ea101c8a56a31ae6cb11559bc78683
Component: engine
2017-04-07 17:57:47 -04:00
4c321e8e20 Test and fix forbidden path for COPY --from on Windows
Paths resolving to c:\ or c:\windows are forbidden

Replaced the obscure (and non-working) regex with a simple case
insensitive comparison to the black listed paths (we should forbid c:\,
c:\windows but not d:\)

Also, add a test ensuring paths are case insensitive on windows

Also, made sure existing multi-staged build tests pass on windows

Signed-off-by: Simon Ferquel <simon.ferquel@docker.com>
Upstream-commit: b0e75888738f6e427b545922a195837c00158749
Component: engine
2017-04-07 18:00:36 +02:00
e25f6c5a1b Added start period option to health check.
Signed-off-by: Elias Faxö <elias.faxo@gmail.com>
Upstream-commit: e401f63735d8ebcff387c571d1f61ce52bdea86e
Component: engine
2017-04-06 12:35:34 +02:00
b40d1c6a48 Merge pull request #32063 from tonistiigi/named-contexts
Add support for named build stages
Upstream-commit: 2e96c1739be45f2ff8342cb3e222db3eb1616839
Component: engine
2017-04-04 12:53:59 -07:00
86cf613824 Merge pull request #31750 from dnephin/some-builder-cleanup
Fix `docker build --label` when the label includes single quotes and a space
Upstream-commit: 6abbc933ae02b69afad72e229f7b9d5ef8a6f431
Component: engine
2017-04-04 09:37:00 -07:00
71418f1299 Add support for FROM using named block
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Upstream-commit: 672ea30a94933eec228d71217b033da5d6572b8d
Component: engine
2017-04-04 09:34:28 -07:00
da4a3b24f4 Implicit copy-from with reference
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Upstream-commit: 73b4b8ed7f86b8df70d7028c5ac7c2ba61ee0a8c
Component: engine
2017-04-04 09:34:28 -07:00
d51100a9ef Add named context support
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Upstream-commit: 87512bbc8490aca261133a7f3a3ea6518d703c34
Component: engine
2017-04-04 09:34:28 -07:00
b4a1c08afc builder: Fix setting command with custom shell
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Upstream-commit: a1fa59ea123555a910c1de1f7b88b75000f2bec4
Component: engine
2017-03-30 13:29:21 -07:00
ac093860f7 Display created tags on successful build
Signed-off-by: Alexandre Garnier <alexandre.garnier@zenika.com>
Signed-off-by: Alexandre Garnier <zigarn@gmail.com>
Upstream-commit: d0052198300dfe9fd220f780184d1ec82c50006c
Component: engine
2017-03-25 11:46:20 +01:00
20ac55606f Fix --label being env var expanded.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: 434d77bc0edf21b970e0414ee54112768a490aaa
Component: engine
2017-03-24 12:29:14 -04:00
3bea1ce0e2 Fix --label on docker build when a single quote is used in the value
Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: 726fb269cf004814bd7065ca2f29f6955746a9d9
Component: engine
2017-03-24 12:29:14 -04:00
fa11164129 Refactor some builder code
Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: d7807c73169469c50e551704cc1957f798868f71
Component: engine
2017-03-24 12:29:14 -04:00
c90ad1369f Merge pull request #31257 from tonistiigi/nested-build
build: add multi-stage build support
Upstream-commit: 2fa8fe400d926b3ceb0c84640a8f4e0f36e51463
Component: engine
2017-03-23 19:14:13 -07:00
dc0d47d701 Fix relative path on windows for uuid paths
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Upstream-commit: 684633f734f86b6a66873b42c9356eb543e12917
Component: engine
2017-03-23 15:12:19 -07:00
e59b5a1439 Add support for COPY from previous rootfs
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Upstream-commit: f95f58283b2a69f4fd06d01de2281641e09b06bb
Component: engine
2017-03-23 15:12:15 -07:00
cc2d5e2aaf Ignore built-in allowed build-args in image history
Removes the build-args from the image history if they are in the
BuiltinAllowedBuildArgs map unless they are explicitly defined in an ARG
instruction.

Signed-off-by: Dave Tucker <dt@docker.com>
Upstream-commit: 89a2a885c82bade2774f4b669b4e09ede8f840c3
Component: engine
2017-03-21 16:36:48 +00:00
00541f8de2 Fix cache for dockerfiles with multiple FROM
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Upstream-commit: acad599210b5c00a4f3a8eae05de21d0d9ef8a88
Component: engine
2017-03-20 11:24:50 -07:00
fb83132fe7 Fix ARG scoping for Dockerfiles with multiple FROM
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Upstream-commit: 09f308ce211cd00f24d4e0f8cc797816b4fff1b6
Component: engine
2017-03-20 11:24:44 -07:00
a835f1babb fix misspell in utils.go
Signed-off-by: Helen Xie <chenjg@harmonycloud.cn>
Upstream-commit: 2b79dbc89bf15c276145a0fa3d3728308349f86e
Component: engine
2017-03-20 19:52:00 +08:00