Commit Graph

106 Commits

Author SHA1 Message Date
Daniel Nephin 681c921528 Remove testutil
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2018-03-06 14:38:35 -05:00
Daniel Nephin 5155cda716 Post migration fixes
Fix tests that failed when using cmp.Compare()
internal/test/testutil/assert
InDelta
Fix DeepEqual with kube metav1.Time
Convert some ErrorContains to assert

Signed-off-by: Daniel Nephin <dnephin@docker.com>
2018-03-05 19:41:17 -05:00
Daniel Nephin 39c2ca57c1 Automated migration
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2018-03-05 19:41:17 -05:00
Daniel Nephin 93615dd967 Update some assertions.
and fix some tests

Signed-off-by: Daniel Nephin <dnephin@docker.com>
2018-03-05 17:15:24 -05:00
Arash Deshmeh 5d8ce59a25 fix the error message in Substitute function
Signed-off-by: Arash Deshmeh <adeshmeh@ca.ibm.com>
2018-02-26 15:29:17 -05:00
Arash Deshmeh e33bc48752 Added error message check to TestMandatoryVariableErrors test
Signed-off-by: Arash Deshmeh <adeshmeh@ca.ibm.com>
2018-02-26 15:29:17 -05:00
Daniel Nephin ce544823b6 Refactor substitute to reduce cyclo complexity
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2018-02-26 15:29:17 -05:00
Arash Deshmeh 99ecf57c6c added support for mandatory variables to cli/compose
Signed-off-by: Arash Deshmeh <adeshmeh@ca.ibm.com>
2018-02-26 15:29:17 -05:00
Joffrey F 56f26d1134
Fix typo in 3.6 schema ID
Signed-off-by: Joffrey F <joffrey@docker.com>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2018-02-21 19:55:12 +01:00
Daniel Nephin cea4d37bca
Merge pull request #824 from ethan-haynes/820-bind-mount-source-missing-error
added check for empty source in bind mount
2018-02-21 13:33:24 -05:00
Vincent Demeester cf86a4d922
Simplify the marshaling of compose types.Config
- Add `Version` to `types.Config`
- Add a new `Services` types (that is just `[]ServiceConfig`) and add
  `MarshalYAML` method on it.
- Clean other top-level custom marshaling as `Services` is the only one
  required.

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2018-02-21 18:47:10 +01:00
Daniel Nephin 939938b976
Merge pull request #891 from vdemeester/k8s-loader-make-sure-version
Make sure we marshall version too…
2018-02-21 11:45:14 -05:00
Vincent Demeester 9f9f1c8515
Make sure we marshall version too…
… otherwise the k8s controller might fail to parse the file as it will
think it's version 1.

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2018-02-21 15:36:51 +01:00
Brian Goff 5730ef8ea0
Merge pull request #874 from dnephin/replace-go-bindata
Replace go-bindata with esc
2018-02-20 17:00:22 -05:00
Vincent Demeester 570ee9cb54
Share the compose loading code between swarm and k8s stack deploy
To ensure we are loading the composefile the same wether we are pointing
to swarm or kubernetes, we need to share the loading code between both.

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2018-02-14 14:07:48 +01:00
Daniel Nephin b127b8d927 Replace go-bindata with esc
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2018-02-12 14:23:19 -05:00
Vincent Demeester 1872bd802c
Add support for multiple composefile when deploying
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2018-01-29 17:27:25 -08:00
Ethan Haynes e76d8c9eae added check for empty source in bind mount
Signed-off-by: Ethan Haynes <ethanhaynes@alumni.harvard.edu>

fixed error by removing punctuation

Signed-off-by: Ethan Haynes <ethanhaynes@alumni.harvard.edu>

removed period

Signed-off-by: Ethan Haynes <ethanhaynes@alumni.harvard.edu>

backtick string to escape double quotes in error messages

Signed-off-by: Ethan Haynes <ethanhaynes@alumni.harvard.edu>

simplified test for bind no source error message

Signed-off-by: Ethan Haynes <ethanhaynes@alumni.harvard.edu>
2018-01-22 18:33:58 -06:00
Ethan Haynes cd69d082ea added support for tmpfs-mode in compose file
Signed-off-by: Ethan Haynes <ethanhaynes@alumni.harvard.edu>
2018-01-16 10:52:26 -06:00
Ethan Haynes b15362ce32 adding tmpfs field to the compose 3.6v file spec and updating binary
Signed-off-by: Ethan Haynes <ethanhaynes@alumni.harvard.edu>
2018-01-16 10:50:40 -06:00
Ethan Haynes 2b8cc52409 adding config_schema_v3.6.json and updating binary
Signed-off-by: Ethan Haynes <ethanhaynes@alumni.harvard.edu>
2018-01-16 10:44:08 -06:00
Sebastiaan van Stijn 70a29b492d
Add "pid" to unsupported options list
Services do not support custom "pid"-modes (e.g. `--pid=host`), but this
option was ignored silently when deploying a stack.

This patch adds `pid` to the list of unsupported options so that a warning
is printed;

With this patch applied:

    $ docker stack deploy -c docker-compose.yml foobar
    Ignoring unsupported options: pid

    Creating network foobar_default
    Creating service foobar_test

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2017-12-27 12:45:42 +01:00
Daniel Nephin 9da2602f38 Fix external networks
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-12-11 11:29:49 -05:00
Joffrey F 88bbaca294 Add missing additionalProperties marker on mount definitions
Signed-off-by: Joffrey F <joffrey@docker.com>
2017-12-06 12:37:38 -08:00
Joffrey F e49f14cf36 Add shm_size property to build configuration in Compose schema
Signed-off-by: Joffrey F <joffrey@docker.com>
2017-12-06 12:34:12 -08:00
Daniel Nephin d0b8aa7701 Support network.name in the compose schema.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-12-06 10:05:24 -05:00
Vincent Demeester 5ed399e588
Add unit tests on config/secret indempotence in stack deploy
Related PR : https://github.com/docker/cli/pull/509

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2017-11-30 09:45:32 +01:00
Renaud Gaubert 1ff73f867d Added support of Generic resources in compose file
Signed-off-by: Renaud Gaubert <renaud.gaubert@gmail.com>
2017-11-28 21:52:09 +01:00
Ilya Sotkov ec47003ecb Remove duplication for secrets / configs, combine 3.5 loader tests, remove extraneous error call, regenerate schema correctly
Signed-off-by: Ilya Sotkov <ilya@sotkov.com>
2017-11-22 13:41:16 +02:00
Ilya Sotkov 1f10b31017 Add tests for secret.name in compose files.
Signed-off-by: Ilya Sotkov <ilya@sotkov.com>
2017-11-22 13:18:05 +02:00
Ilya Sotkov 4f7f3d2f61 Add secret.name and config.name in compose.
Signed-off-by: Ilya Sotkov <ilya@sotkov.com>
2017-11-22 13:18:05 +02:00
Simon Ferquel 47cf2ea683 Add isolation mode on service update/create and compose files
Signed-off-by: Simon Ferquel <simon.ferquel@docker.com>
2017-11-17 15:31:13 +01:00
Simon Ferquel 787e30d57a Preparing for compose schema v3.5
Signed-off-by: Simon Ferquel <simon.ferquel@docker.com>
2017-11-17 15:30:32 +01:00
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