Commit Graph

73 Commits

Author SHA1 Message Date
Daniel Nephin f1cc679618 Add unit tests for some convert/service
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-11-10 16:28:39 -05:00
Daniel Nephin a68c940f1a Remove duplication in compose/convert
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-11-10 15:56:11 -05:00
Daniel Nephin 7bd26ed690 Remove duplication in loader
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-11-10 15:56:11 -05:00
Daniel Nephin aea9544db5 Only warn on volume.external.name for version 3.4
Also remove use of volume.external.name

Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-11-06 17:04:36 -05:00
Sebastiaan van Stijn dbdf8f6468
Preserve sort-order of extra hosts, and allow duplicate entries
Extra hosts (`extra_hosts` in compose-file, or `--hosts` in services) adds
custom host/ip mappings to the container's `/etc/hosts`.

The current implementation used a `map[string]string{}` as intermediate
storage, and sorted the results alphabetically when converting to a service-spec.

As a result, duplicate hosts were removed, and order of host/ip mappings was not
preserved (in case the compose-file used a list instead of a map).

According to the **host.conf(5)** man page (http://man7.org/linux/man-pages/man5/host.conf.5.html)

    multi  Valid values are on and off.  If set to on, the resolver
      library will return all valid addresses for a host that
      appears in the /etc/hosts file, instead of only the first.
      This is off by default, as it may cause a substantial
      performance loss at sites with large hosts files.

Multiple entries for a host are allowed, and even required for some situations,
for example, to add mappings for IPv4 and IPv6 addreses for a host, as illustrated
by the example hosts file in the **hosts(5)** man page (http://man7.org/linux/man-pages/man5/hosts.5.html):

    # The following lines are desirable for IPv4 capable hosts
    127.0.0.1       localhost

    # 127.0.1.1 is often used for the FQDN of the machine
    127.0.1.1       thishost.mydomain.org  thishost
    192.168.1.10    foo.mydomain.org       foo
    192.168.1.13    bar.mydomain.org       bar
    146.82.138.7    master.debian.org      master
    209.237.226.90  www.opensource.org

    # The following lines are desirable for IPv6 capable hosts
    ::1             localhost ip6-localhost ip6-loopback
    ff02::1         ip6-allnodes
    ff02::2         ip6-allrouters

This patch changes the intermediate storage format to use a `[]string`, and only
sorts entries if the input format in the compose file is a mapping. If the input
format is a list, the original sort-order is preserved.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2017-10-30 01:48:09 +01:00
Daniel Nephin af8f563922 Fix load order
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-10-05 12:03:29 -04:00
Daniel Nephin 18ddec447a Cast interpolated values
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-10-04 17:36:47 -04:00
Daniel Nephin 0aa7ca943c Update interface of Interpolate
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-10-04 17:36:43 -04:00
Daniel Nephin 9f73b8c718 Support parsing of named pipes for compose volumes.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-09-26 11:24:23 -04:00
Vincent Demeester 0da9f14821
Fix loader error with different build syntax
`build: .` was not working anymore. Fixing this by adding a new
tranform function for BuildConfig.

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2017-09-20 14:02:33 +02:00
Vincent Demeester f34655ecf8
Tidying up compose/loader test a bit
- Use `require` instead of `assert` when the assumption is "breaking" for the code
following. For example when asserting an error is not nil and then doing
`err.Error` on it ; if `err` is nil, the test will panic instead of fail.
- Use `assert.Len` when possible. The error message is better.

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2017-09-19 16:48:52 +02:00
Vincent Demeester a09a2c6d15 Merge pull request #509 from xificurC/fix-secrets-and-configs-idempotence
sort secrets and configs to ensure idempotence
2017-09-15 15:43:59 +02:00
Vincent Demeester 2eb31e6b60 Merge pull request #481 from cdrage/add-build-to-service-config
Add 'build' to types.go
2017-09-13 18:20:42 +02:00
Charlie Drage 9bdb0763b9 Add 'build' to types.go
This adds 'build' to types.go in order for projects that use docker/cli
to parse Docker Compose files to correctly retrieve `build` keys

Signed-off-by: Charlie Drage <charlie@charliedrage.com>
2017-09-13 10:47:17 -04:00
pnagy 27e8bdf32b sort secrets and configs to ensure idempotence
`docker stack deploy` keeps restarting services it doesn't need to (no changes)
because the entries' order gets randomized at some previous (de)serialization.
Maybe it would be worth looking into this at a higher level and ensure
all (de)serialization happens in an ordered collection.

This quick fix sorts secrets and configs (in place, mutably) which ensures the
same order for each run.

Based on
https://github.com/moby/moby/pull/30506

Fixes
https://github.com/moby/moby/issues/34746

Signed-off-by: Peter Nagy <xificurC@gmail.com>
2017-09-08 16:09:48 +02:00
Simon Ferquel a0113c3a44 updated vendoring
Signed-off-by: Simon Ferquel <simon.ferquel@docker.com>
2017-09-01 19:41:06 -04:00
Daniel Nephin e636a5388c Merge pull request #475 from AliyunContainerService/start_period
Support start_period for healthcheck in Docker Compose
2017-08-30 14:11:43 -04:00
Victor Vieux 8ea02f6f08 Merge pull request #477 from dnephin/some-tests-for-container-command
A few tests for container command
2017-08-30 09:38:38 -07:00
Li Yi e02fcfd34e Change the type of interval, timeout and start_period of healthcheck from string to * time.Duration
Signed-off-by: Li Yi <denverdino@gmail.com>
2017-08-30 23:39:12 +08:00
Daniel Nephin e7f90b6b38 Reduce complexity in cli/command/container
Add tests for exec and cleanup existing tests.

Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-08-29 19:25:50 -04:00
Daniel Nephin bdc8cf364e Add ulimits to unsupported compose fields.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-08-29 17:05:16 -04:00
Li Yi 0abdad615f Support start_period for healthcheck in Docker Compose
Signed-off-by: Li Yi <denverdino@gmail.com>
2017-08-29 11:19:29 +08:00
Daniel Nephin d318c4112b Reduce complexity of two formatters
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-08-28 12:49:07 -04:00
Daniel Nephin d83752cdf2 Merge pull request #452 from dnephin/compose-allow-x-fields
Allow extension fields in the v3.4 version of the compose format
2017-08-25 12:37:47 -04:00
Daniel Nephin 2a1857e899 Allow extension fields in the v3.4 version of the compose format.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-08-22 10:42:49 -04:00
Daniel Nephin 846a31aa50 Use new internal testutil.ErrorContains()
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-08-22 10:14:25 -04:00
Joffrey F 1667073908 Update schemas to prevent invalid properties in deploy.resources
Signed-off-by: Joffrey F <joffrey@docker.com>
2017-08-17 15:58:51 -07:00
Daniel Nephin 15837afa77 Replace pkg/testutil/tempfile with gotestyourself/fs
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-08-16 14:23:28 -04:00
Daniel Nephin eef256943b Add network and target to build in v3.4
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-08-09 10:50:32 -04:00
Sebastiaan van Stijn 1cd402b192 Merge pull request #360 from akalipetis/compose-update-order
Add support for update order in compose deployments
2017-08-01 22:24:48 +02:00
Vincent Demeester f386d476ba Merge pull request #388 from christopherobin/feature/stopsignal
Add support for stop-signal in stack command
2017-08-01 09:53:13 +02:00
Antonis Kalipetis 2950667f07
Support the "order" key in "update_config" for compose
Signed-off-by: Antonis Kalipetis <akalipetis@gmail.com>
2017-07-28 22:50:55 +03:00
Liping Xue 27a3080825 Change to enable volume name can be customized.
Signed-off-by: Liping Xue <lipingxue@gmail.com>
Change to enable volume name can be customized.
Signed-off-by: Liping Xue <lipingxue@gmail.com>

Change to enable volume name can be customized.

Remove unused debug info.

Address comments from Daniel and solve the lint error.
Signed-off-by: Liping Xue <lipingxue@gmail.com>

Address Daniel's comments to print warning message when name of external volume is set in loader code.
Signed-off-by: Liping Xue <lipingxue@gmail.com>

Address Daniel's comments to return error when external volume is set in loader code.
Signed-off-by: Liping Xue <lipingxue@gmail.com>

Address Daniel's comments to return error when external volume is set in loader code.
Signed-off-by: Liping Xue <lipingxue@gmail.com>

Remove the case that specifying external volume name in full-example.yml.

More fix.

Add unit test.
Signed-off-by: Liping Xue <lipingxue@gmail.com>

Address comments from Daniel, move the schema change to v3.4.
Signed-off-by: Liping Xue <lipingxue@gmail.com>

Address comments from Sebastiaan. Signed-off-by: Liping Xue <lipingxue@gmail.com>

Address comments from Misty.
Signed-off-by: Liping Xue <lipingxue@gmail.com>
2017-07-27 15:09:05 -07:00
Christophe Robin b129a70b5c
Add support for stop-signal in stack command
Signed-off-by: Christophe Robin <crobin@nekoo.com>
2017-07-27 13:18:05 +09:00
Daniel Nephin 0adccacb38 Add Compose format 3.4
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-07-19 14:24:59 -07:00
Charlie Drage d3f9a6c610 on_failure -> on-failure in compose code
on_failure should be on-failure

Signed-off-by: Charlie Drage <charlie@charliedrage.com>
2017-06-28 11:10:02 -04:00
Daniel Nephin 732261f774 Use compose volume spec parser for container volume flag
Restore testcases for Volume spec parsing.
And correctly interpret the parsed volume.

Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-06-21 11:16:04 -04:00
Daniel Nephin db6ff357a7 Some improvements to compose volume spec parsing
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-06-21 11:13:52 -04:00
Daniel Nephin 3724fb7f37 Add gosimple lint
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-06-14 16:55:08 -07:00
Daniel Nephin 01e1e58ada Add unused linter.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-06-14 16:54:27 -07:00
Aaron Lehmann 4d980880f3 Merge pull request #121 from nishanttotla/digest-pinning-stack-deploy
Enable client side digest pinning for stack deploy
2017-06-08 23:20:02 +03:00
Vincent Demeester c944d20b1f Merge pull request #163 from vdemeester/export-convertservice
Update ConvertService for external usage 👼
2017-06-08 10:55:56 +02:00
Vincent Demeester 96dc07a8cf Update ConvertService for external usage 👼
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2017-06-08 10:44:05 +02:00
Nishant Totla f790e839fc
Change --no-resolve-image flag to --resolve-image string flag
Signed-off-by: Nishant Totla <nishanttotla@gmail.com>
2017-06-07 12:30:11 -07:00
Nishant Totla 9f1bea2657
Enable client side digest pinning for stack deploy
Signed-off-by: Nishant Totla <nishanttotla@gmail.com>
2017-06-07 12:30:11 -07:00
Aaron Lehmann 9d12d6fc87 Merge pull request #145 from dnephin/improve-compose-secrets-errors
Compose: Improve error messages when resource create/update fails
2017-06-07 18:51:10 +03:00
Vincent Demeester 44ac80881f
Update vendoring of docker/docker
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2017-06-06 00:23:21 +02:00
Daniel Nephin 97ebc19438 Use a map instad of a switch/case for Compose transform.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-06-01 15:22:09 -04:00
Daniel Nephin 729d07a371 Compose: Improve error messages when resource creation/updates fail.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-06-01 15:03:04 -04:00
Brian Goff bf22fc6781 Merge pull request #136 from johnstep/fix_stack_service_volumes
Fix stack compose bind-mount volumes for Windows
2017-06-01 11:06:06 -04:00