Add support for creating volume and network with label definition#3898
Add support for creating volume and network with label definition#3898shin- merged 1 commit intodocker:masterfrom
Conversation
| v for v in self.client.volumes().get('Volumes', []) | ||
| if v['Name'].startswith('composetest_') | ||
| ] | ||
|
|
There was a problem hiding this comment.
nit: we don't need sorted() here since there's a single element
|
Thanks! This is quite thourough. There's a few things I see:
|
|
@alexmavr I'm sorry I close this pr by accident just now. |
shin-
left a comment
There was a problem hiding this comment.
Hey @dbdd4us - sorry it took so long to get back to you. I wanted to have the changes from #3653 merged before we move forward with this.
I added a few comments to highlight the changes that need to be made to make the labels directives part of the 2.1 file format. They're trivial changes, but let me know if anything is unclear and I'll be happy to help. :)
| }, | ||
| "internal": {"type": "boolean"} | ||
| "internal": {"type": "boolean"}, | ||
| "labels": {"$ref": "#/definitions/list_or_dict"} |
There was a problem hiding this comment.
Now that config_schema_v2.1.json has been merged, we can move this property there.
| "name": {"type": "string"} | ||
| } | ||
| }, | ||
| "labels": {"$ref": "#/definitions/list_or_dict"}, |
There was a problem hiding this comment.
Now that config_schema_v2.1.json has been merged, we can move this property there.
requirements.txt
Outdated
| backports.ssl-match-hostname==3.5.0.1; python_version < '3' | ||
| cached-property==1.2.0 | ||
| docker-py==1.9.0 | ||
| docker-py==1.10.2 |
There was a problem hiding this comment.
You'll probably get a merge conflict here since we bumped to 1.10.3 in master.
| @@ -754,6 +754,46 @@ def test_up_with_external_default_network(self): | |||
| container = self.project.containers()[0] | |||
| assert list(container.get('NetworkSettings.Networks')) == [network_name] | |||
|
|
|||
| assert [n['Name'] for n in networks] == [network_with_label] | ||
|
|
||
| assert networks[0]['Labels'] == {'label_key': 'label_val'} | ||
|
|
| @@ -783,6 +783,42 @@ def test_project_up_with_network_internal(self): | |||
|
|
|||
| assert network['Internal'] is True | |||
|
|
|||
| @@ -809,6 +845,46 @@ def test_project_up_volumes(self): | |||
| self.assertEqual(volume_data['Name'], full_vol_name) | |||
| self.assertEqual(volume_data['Driver'], 'local') | |||
|
|
|||
docs/compose-file.md
Outdated
| name: actual-name-of-volume | ||
|
|
||
| ### labels | ||
|
|
There was a problem hiding this comment.
Needs the > Added in version 2.1 file format line, similar to this
docs/compose-file.md
Outdated
| name: actual-name-of-network | ||
|
|
||
| ### labels | ||
|
|
There was a problem hiding this comment.
Needs the > Added in version 2.1 file format line, similar to this
73da01e to
0fcdeb3
Compare
|
@shin- PR Updated, PTAL I'm confused about the |
|
"Reorder python imports" is a lint/style check performed by pre-commit. It means the imports are not ordered correctly. You can either install http://pre-commit.com/ and run it to fix the issue, or you can re-order them manually. Imports should be sorted and grouped according to "built-in", "third-party", "local" I think in this case it doesn't like the multiple imports on a single line, and is moving it onto a new line |
|
@dnephin |
|
WIth the docs moving to a separate repository, this needs a rebase that removes the |
|
@shin- |
Signed-off-by: dbdd <wangtong2712@gmail.com>
|
LGTM (IANAM) |
|
Closes #3107 |
Fixes #3892
- What I did
Add volume and network label support for compose file v2
- How I did it
-How to verify it
Add test in tests/unit/config/config_test.py, tests/integration/project_test.py and tests/acceptance/cli_test.py
@shin- PTAL
Signed-off-by: dbdd wangtong2712@gmail.com