Skip to content

Add support for declaring named volumes in compose files - #2421

Merged
aanand merged 16 commits into
docker:masterfrom
shin-:2110-compose_yml_v2
Jan 7, 2016
Merged

aanand merged 16 commits into
docker:masterfrom
shin-:2110-compose_yml_v2

Conversation

@shin-

@shin- shin- commented Nov 19, 2015

Copy link
Copy Markdown
  • Bump default API version to 1.21 (required for named volume management)
  • Introduce new, versioned compose file format while maintaining support
    for current (legacy) format
  • Test updates to reflect changes made to the internal API

Fixes #2110, replaces #2113

WIP:

  • Tests
  • Documentation

Comment thread compose/config/config.py Outdated

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think ServiceExtendsResolver.validate_and_construct_extends() will need to call this with a version as well.

Since version is a required parameter can we make it a position arg instead of a kwarg?

@shin-

shin- commented Dec 10, 2015

Copy link
Copy Markdown
Author

I think I addressed most of the points brought up in the earlier review, except for the documentation part.

Comment thread compose/config/config.py Outdated

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I'm reading this right, you could have a legacy main file and a version-1 override file, and the ultimate version would be 1.

It scares me that the version decided upon is dependent on the override files. I think it'd be better if we enforced that all files must be the same version.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, I think I might be misreading this. The possible versions are actually 1 and 2, so what does it mean when we return None from get_version?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When one config file is empty, as tested here. In that case we can't assume the version to be a specific one, but we don't want to fail either.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't we just assume the version is 1? An "empty" v2 file should look like this, in my opinion:

version: 2

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you think that's better, that's an easy change to make.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated af9291e

@shin-

shin- commented Jan 4, 2016

Copy link
Copy Markdown
Author

@dnephin @aanand Do we need anything else to proceed with merging this?

Comment thread script/test-versions Outdated

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mind adding a TODO here to set this back to 2 after the first RC is released?

@dnephin

dnephin commented Jan 5, 2016

Copy link
Copy Markdown

LGTM, I think we can address the remaining (documentation, and using existing volumes) after this is merged

dnephin and others added 16 commits January 5, 2016 15:09
Fixes a regression after the API changed to use Mounts.

Signed-off-by: Daniel Nephin <[email protected]>
* Bump default API version to 1.21 (required for named volume management)
* Introduce new, versioned compose file format while maintaining support
  for current (legacy) format
* Test updates to reflect changes made to the internal API

Signed-off-by: Joffrey F <[email protected]>
Add volume configuration reference section.

Signed-off-by: Joffrey F <[email protected]>
Also includes several bugfixes for resolution and validation.

Signed-off-by: Joffrey F <[email protected]>
When created through the compose file, volumes are prefixed
with the name of the project they belong to + underscore,
similarly to how containers are currently handled.

Signed-off-by: Joffrey F <[email protected]>
Assume version=1 if file is empty in get_config_version
Empty files are invalid anyway, so this simplifies the algorithm
somewhat.
docker#2421 (comment)

Don't leak version considerations in interpolation/service validation

Signed-off-by: Joffrey F <[email protected]>
@shin-
shin- force-pushed the 2110-compose_yml_v2 branch from d5bc144 to 1dcdd98 Compare January 5, 2016 23:25
@shin-

shin- commented Jan 5, 2016

Copy link
Copy Markdown
Author

Squashed some commits + rebased.

aanand added a commit that referenced this pull request Jan 7, 2016
Add support for declaring named volumes in compose files
@aanand
aanand merged commit ed87d1f into docker:master Jan 7, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants