Commit Graph

1618 Commits

Author SHA1 Message Date
Daniel Nephin 9d7ad796a3 bump requests to 2.7 to fix the ResponseNotReady() error, and add a missing default for tox posargs
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-09-03 14:11:44 -04:00
mnowster 2073805bc1 Merge pull request #1952 from aanand/bundle-schema-json
Bundle schema.json in binary
2015-09-03 10:40:11 +01:00
Aanand Prasad ecea79fd4e Bundle schema files
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-09-02 18:09:34 -07:00
Aanand Prasad b165ae07c9 Configure PyInstaller using docker-compose.spec
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-09-02 17:47:14 -07:00
Aanand Prasad 6baed6c354 Merge pull request #1965 from dnephin/fix_compose_up_attach
Attach to all containers when no service names are specified
2015-09-02 17:37:43 -07:00
Aanand Prasad 027414cfc0 Merge pull request #1918 from dnephin/fix_scripts_test
Fix scripts/test and add to note about pre-commit hook to contributing
2015-09-02 14:28:51 -07:00
Aanand Prasad 0060437f57 Merge pull request #1927 from mnowster/validate-extended-services
Validate and interpolate extended services
2015-09-02 13:41:21 -07:00
Daniel Nephin 48466d7d82 Fix #1961 - docker-compose up should attach to all containers with no service names are specified, and add tests.
Signed-off-by: Daniel Nephin <dnephin@gmail.com>
2015-09-02 16:08:18 -04:00
Mazz Mosley 6a399a5b2f Update tests to be compatible with validation
Some were missing build '.' from their dicts, others were the
incorrect type and one I've moved from integration to unit.

Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-09-02 15:43:52 +01:00
Mazz Mosley d31d24d19f Work around some coupling of links, net & volume_from
This is minimal disruptive change I could make to ensure
the service integration tests worked, now we have some validation
happening.

There is some coupling/entanglement/assumption going on here.

Project when creating a service, using it's class method from_dicts
performs some transformations on links, net & volume_from, which
get passed on to Service when creating. Service itself, then performs
some transformation on those values. This worked fine in the tests before
because those options were merely passed on via make_service_dict.

This is no longer true with our validation in place. You can't pass to
ServiceLoader [(obj, 'string')] for links, the validation expects it to be
a list of strings. Which it would be when passed into Project.from_dicts
method.

I think the tests need some re-factoring but for now, manually deleting
keys out of the kwargs and then putting them back in for Service Creation
allows the tests to continue.

I am not super happy about this approach. Hopefully we can come back and
improve it.

Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-09-02 15:43:52 +01:00
Mazz Mosley 9b8e404d13 Pass service_name to process_errors
Previously on Buffy... The process_errors was parsing a load of
ValidationErrors that we get back from jsonschema which included
assumptions about the state of the instance we're validating.

Now it's split in two and we're doing field separate to service,
those assumptions don't hold and we can't logically retrieve the
service_name from the error parsing when we're doing service schema
validation, have to explicitly pass this in.

process_errors is high on my list for some future re-factoring to help
make it a bit clearer, smaller state of doing things.

Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-09-02 15:42:38 +01:00
Mazz Mosley f51a5431ec Correct some schema field definitions
Now validation is split in two, the integration tests helped
highlight some places where the schema definition was incorrect.

Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-09-02 15:42:38 +01:00
Mazz Mosley 9979880c9f Add in volume_driver
I'd missed out this field by accident previously.

Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-09-02 15:42:38 +01:00
Mazz Mosley 4b487e3957 Refactor extends back out of __init__
If make_service_dict is our factory function then we'll give it the
responsibility of validation/construction and resolving.

Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-09-02 15:42:38 +01:00
Mazz Mosley 9fa6e42f55 process_errors handle both schemas
Now the schema has been split into two, we need to modify the
process_errors function to accomodate.

Previously if an error.path was empty then it meant they were root
errors. Now that service_schema checks after the service has been
resolved, our service name is a key within the dictionary and
so our root error logic check is no longer true.

Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-09-02 15:42:38 +01:00
Mazz Mosley 950577d60f Split validation into fields and service
We want to give feedback to the user as soon as possible about the
validity of the config supplied for the services.

When extending a service, we can validate that the fields are
correct against our schema but we must wait until the *end* of
the extends cycle once all of the extended dicts have been merged
into the service dict, to perform the final validation check on the
config to ensure it is a complete valid service.

Doing this before that had happened resulted in false reports of
invalid config, as common config when split out, by itself, is not
a valid service but *is* valid config to be included.

Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-09-02 15:42:38 +01:00
Mazz Mosley 4a8b2947ca Interpolate extended config
This refactoring is now really coming together. Construction is
happening in the __init__, which is a constructor and helps
clean up the design and clarity of intent of the code. We can now
see (nearly) everything that is being constructed when a ServiceLoader
is created. It needs all of these data constructs to perform the
domain logic and actions. Which are now clearer to see and moving
more towards the principle of functions doing (mostly)one thing and
function names being more descriptive.

resolve_extends is now concerned with the resolving of extends, rather
than the construction, validation, pre processing and *then* resolving
of extends.

Happy days :)

Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-09-02 15:42:38 +01:00
Mazz Mosley 36757cde1c Validate extended service against our schema
Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-09-02 15:42:38 +01:00
Mazz Mosley 37bf8235b7 Get extended config path
Refactored out into it's own function.

Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-09-02 15:42:38 +01:00
Mazz Mosley 538a501eec Refactor validating extends file path
Separating out the steps we need to resolve extends, so that it
will be clear to insert pre-processing of interpolation and
validation.

Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-09-02 15:42:38 +01:00
Mazz Mosley 02c52ae673 Move resolve_environment within __init__
resolve_environment is specific to ServiceLoader, the function
does not need to be on the global scope, it is a part of the
ServiceLoader object. The environment needs to be resolved
before we can make any service dicts, it belongs in the
constructor.

This is cleaning up the design a little and being clearer
about intent and scope of functions.

Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-09-02 15:42:38 +01:00
Mazz Mosley 8a6061bfb9 __init__ takes service name and dict
Moving service name and dict out of the function make_service_dict
and into __init__. We always call make_service_dict with those so
let's put them in the initialiser. Slightly cleaner design intent.

The whole purpose of the ServiceLoader is to take a
service name&service dictionary then validate, process and return
service dictionaries ready to be created.

This is also another step towards cleaning the code up so we can
interpolate and validate an extended dictionary.

Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-09-02 15:42:38 +01:00
Mazz Mosley 1344533b24 filename is not optional
While it can be set to ultimately a value of None, when a
config file is read in from stdin, it is not optional.

We kinda make use of it's ability to be set to None in our
tests but functionally and design wise, it is required.

If filename is not set, extends does not work.

Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-09-02 15:42:38 +01:00
Mazz Mosley c907f35e74 Raise if working_dir is None
Check for this in the init so we can remove the duplication of
raising in further functions.

A ServiceLoader isn't valid without one.

Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-09-02 15:42:38 +01:00
Aanand Prasad 3bee62e4c5 Merge pull request #1956 from bfirsh/link-to-zenhub
Link to ZenHub instead of Waffle
2015-09-01 17:31:45 -07:00
Ben Firshman 6969829a70 Link to ZenHub instead of Waffle
Signed-off-by: Ben Firshman <ben@firshman.co.uk>
2015-09-01 17:23:39 -07:00
Aanand Prasad c63ae64ca6 Merge pull request #1920 from dnephin/use_pytest
Use py.test as a test runner
2015-09-01 15:29:24 -07:00
Daniel Nephin c1ed1efde8 Use py.test as the test runner
Signed-off-by: Daniel Nephin <dnephin@gmail.com>
2015-09-01 16:27:44 -04:00
Daniel Nephin 6ac617bae1 Split requirements-build.txt from requirements-dev.txt to support a leaner tox.ini
Signed-off-by: Daniel Nephin <dnephin@gmail.com>
2015-09-01 16:27:44 -04:00
Aanand Prasad 8479108ee8 Merge pull request #1945 from dnephin/issue_triage_doc
Add ISSUE-TRIAGE.md
2015-09-01 13:25:37 -07:00
Daniel Nephin 74782a56b5 Fix script/test by just calling script/test-versions directly instead of launching another container.
Signed-off-by: Daniel Nephin <dnephin@gmail.com>
2015-08-31 17:08:47 -04:00
Daniel Nephin 5a5f28228a Document installing of pre-commit hooks.
Signed-off-by: Daniel Nephin <dnephin@gmail.com>
2015-08-31 17:08:47 -04:00
Aanand Prasad 83c514f838 Merge pull request #1933 from dnephin/fix_scale_test_flakes
Fix flaky test
2015-08-31 13:52:33 -07:00
Daniel Nephin 235fe21fd0 Prevent flaky test by changing container names.
Signed-off-by: Daniel Nephin <dnephin@gmail.com>
2015-08-31 14:57:06 -04:00
mnowster 17bd11c334 Merge pull request #1940 from hermanjunge/patch-1
Fix doc install.md
2015-08-31 10:43:30 +01:00
Daniel Nephin 8f310767a6 Add ISSUE-TRIAGE.md doc
Signed-off-by: Daniel Nephin <dnephin@gmail.com>
2015-08-28 14:10:15 -04:00
Herman Junge 9543cb341b Fix doc install.md
termial -> terminal

Signed-off-by: Herman Junge <hermanalonsojunge@gmail.com>
2015-08-28 11:51:04 -03:00
mnowster 0074d74d7a Merge pull request #1914 from bbirand/patch-1
Export COMPOSE_FILE
2015-08-28 12:13:42 +01:00
mnowster f5d73fee57 Merge pull request #1932 from mrfuxi/image-dockerfile-validation
Do not allow to specify both image and dockerfile in configuration.
2015-08-28 10:12:54 +01:00
Daniel Nephin d264c2e33a Resolves #1804
Fix mutation of service.options when a label or environment variable is specified in the config.

Signed-off-by: Daniel Nephin <dnephin@gmail.com>
2015-08-27 18:05:21 -04:00
Karol Duleba 477d4f491d Do not allow to specify both image and dockerfile in configuration. Closes #1908
Signed-off-by: Karol Duleba <mr.fuxi@gmail.com>
2015-08-27 19:36:39 +01:00
Daniel Nephin 21c16a787a Merge pull request #1928 from albers/completion-timeout
Bash completion for `docker-compose scale --timeout`
2015-08-27 12:37:55 -04:00
Daniel Nephin d45f00df13 Merge pull request #1935 from aanand/normalise-ignore-files
Normalise ignore files
2015-08-27 10:39:24 -04:00
Aanand Prasad e777d08854 Merge pull request #1924 from dnephin/python3_fix_for_logs
Fix `docker-compose logs` on python3
2015-08-27 14:19:42 +01:00
Aanand Prasad b39e549c87 Normalise ignore files
- Consistent order and contents (where possible)
- Prepend .gitignore paths with slashes where appropriate

Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-08-27 13:51:51 +01:00
Aanand Prasad 7c8c23e0c7 Merge pull request #1917 from sdurrheimer/master
Update zsh completion with last changes
2015-08-27 13:17:19 +01:00
Aanand Prasad 4602ceca18 Merge pull request #1931 from dnephin/fix_regression_in_up
Only show logs for listed services in `up`
2015-08-27 13:00:59 +01:00
mnowster 5865df3633 Merge pull request #1934 from aanand/fix-release-process-typo
Fix typo in release process docs
2015-08-27 10:38:20 +01:00
Aanand Prasad acca22206a Fix typo
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-08-27 10:36:12 +01:00
mnowster 0286d282f9 Merge pull request #1916 from aanand/improve-release-docs
Improve release docs
2015-08-27 10:34:32 +01:00