From 060e4e05da19c85d4008dd6ce90504b5469d0e2a Mon Sep 17 00:00:00 2001 From: aiordache Date: Tue, 8 Sep 2020 10:37:09 +0200 Subject: [PATCH 1/8] Add 1.27.0 release notes to changelog and bump dev version Signed-off-by: aiordache --- CHANGELOG.md | 43 +++++++++++++++++++++++++++++++++++++++++++ compose/__init__.py | 2 +- 2 files changed, 44 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2e7a6bbf0..5aac988d3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,49 @@ Change log ========== +1.27.0 (2020-09-07) +------------------- + +### Features + +- Merge 2.x and 3.x compose formats and align with COMPOSE_SPEC schema + +- Implement service mode for ipc + +- Pass `COMPOSE_PROJECT_NAME` environment variable in container mode + +- Make run behave in the same way as up + +- Use `docker build` on `docker-compose run` when `COMPOSE_DOCKER_CLI_BUILD` environment variable is set + +- Use docker-py default API version for engine queries (`auto`) + +- Parse `network_mode` on build + +### Bugs + +- Ignore build context path validation when building is not required + +- Fix float to bytes conversion via docker-py bump to 4.3.1 + +- Fix scale bug when deploy section is set + +- Fix `docker-py` bump in `setup.py` + +- Fix experimental build failure detection + +- Fix context propagation to docker cli + +### Miscellaneous + +- Bump `docker-py` to 4.3.1 + +- Bump `tox` to 3.19.0 + +- Bump `virtualenv` to 20.0.30 + +- Add script for docs syncronization + 1.26.1 (2020-06-30) ------------------- diff --git a/compose/__init__.py b/compose/__init__.py index 76e27d25f..444d27edb 100644 --- a/compose/__init__.py +++ b/compose/__init__.py @@ -1 +1 @@ -__version__ = '1.27.0dev' +__version__ = '1.28.0dev' From 3ee52f2f28344a56b4621bf023b4f27baf7ffb5b Mon Sep 17 00:00:00 2001 From: aiordache Date: Tue, 8 Sep 2020 10:57:05 +0200 Subject: [PATCH 2/8] Add 1.26.2 release notes to changelog Signed-off-by: aiordache --- CHANGELOG.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5aac988d3..e2bdbbd3a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -44,6 +44,13 @@ Change log - Add script for docs syncronization +1.26.2 (2020-07-02) +------------------- + +### Bugs + +- Enforce `docker-py` 4.2.2 as minimum version when installing with pip + 1.26.1 (2020-06-30) ------------------- From b111ef63224f0f08d999e197f9b63675ffe4ee76 Mon Sep 17 00:00:00 2001 From: aiordache Date: Wed, 9 Sep 2020 10:23:10 +0200 Subject: [PATCH 3/8] Re-enable 0 scale/deploy.replicas Signed-off-by: aiordache --- compose/project.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/compose/project.py b/compose/project.py index a5bb39b93..420cb6548 100644 --- a/compose/project.py +++ b/compose/project.py @@ -311,12 +311,12 @@ class Project: return 1 if scale is None else scale replicas = deploy_dict.get('replicas', None) - if scale and replicas: + if scale is not None and replicas is not None: raise ConfigurationError( "Both service.scale and service.deploy.replicas are set." " Only one of them must be set." ) - if replicas: + if replicas is not None: scale = replicas if scale is None: return 1 From 884a1c4286d1ec556ff8d07304a5761b66f6cc7b Mon Sep 17 00:00:00 2001 From: aiordache Date: Thu, 10 Sep 2020 09:56:49 +0200 Subject: [PATCH 4/8] Allow driver property for external networks Signed-off-by: aiordache --- compose/config/config.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/compose/config/config.py b/compose/config/config.py index 881f5d683..eb1c7809c 100644 --- a/compose/config/config.py +++ b/compose/config/config.py @@ -441,6 +441,8 @@ def load_mapping(config_files, get_func, entity_type, working_dir=None): def validate_external(entity_type, name, config, version): for k in config.keys(): + if entity_type == 'Network' and k == 'driver': + continue if k not in ['external', 'name']: raise ConfigurationError( "{} {} declared as external but specifies additional attributes " From 9f47d4e5d7c1c4eea52f8a94b3171842b2d0a29d Mon Sep 17 00:00:00 2001 From: Ulysses Souza Date: Wed, 9 Sep 2020 15:31:01 +0200 Subject: [PATCH 5/8] Pin `docker-compose config`'s version to `3.9` This avoids bugs on using it's output on swarm Signed-off-by: Ulysses Souza --- compose/const.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compose/const.py b/compose/const.py index c51e6ac0b..043429802 100644 --- a/compose/const.py +++ b/compose/const.py @@ -24,7 +24,7 @@ SECRETS_PATH = '/run/secrets' WINDOWS_LONGPATH_PREFIX = '\\\\?\\' COMPOSEFILE_V1 = ComposeVersion('1') -COMPOSE_SPEC = ComposeVersion('3') +COMPOSE_SPEC = ComposeVersion('3.9') # minimum DOCKER ENGINE API version needed to support # features for each compose schema version From 6979a337e072d6313c46af05f40c0fa0069794db Mon Sep 17 00:00:00 2001 From: aiordache Date: Thu, 10 Sep 2020 12:11:02 +0200 Subject: [PATCH 6/8] Set service scale to 1 for oneoff containers Signed-off-by: aiordache --- compose/cli/main.py | 1 + 1 file changed, 1 insertion(+) diff --git a/compose/cli/main.py b/compose/cli/main.py index 7ec09bea2..d01bf86a4 100644 --- a/compose/cli/main.py +++ b/compose/cli/main.py @@ -1304,6 +1304,7 @@ def run_one_off_container(container_options, project, service, options, toplevel native_builder = toplevel_environment.get_boolean('COMPOSE_DOCKER_CLI_BUILD') detach = options.get('--detach') use_network_aliases = options.get('--use-aliases') + service.scale_num = 1 containers = project.up( service_names=[service.name], start_deps=not options['--no-deps'], From fde1c681a7a7829d35abd4048183f768d1276758 Mon Sep 17 00:00:00 2001 From: Ulysses Souza Date: Thu, 10 Sep 2020 11:20:29 +0200 Subject: [PATCH 7/8] Preserve the version when specified in the file Signed-off-by: Ulysses Souza --- compose/config/config.py | 2 -- tests/acceptance/cli_test.py | 18 +++++++++--------- tests/unit/config/config_test.py | 31 +++++++++++++------------------ 3 files changed, 22 insertions(+), 29 deletions(-) diff --git a/compose/config/config.py b/compose/config/config.py index 881f5d683..899e8c5b7 100644 --- a/compose/config/config.py +++ b/compose/config/config.py @@ -224,8 +224,6 @@ class ConfigFile(namedtuple('_ConfigFile', 'filename config')): if version.startswith("1"): version = V1 - else: - version = VERSION if version == V1: raise ConfigurationError( diff --git a/tests/acceptance/cli_test.py b/tests/acceptance/cli_test.py index ced0a2733..3d9a31c2d 100644 --- a/tests/acceptance/cli_test.py +++ b/tests/acceptance/cli_test.py @@ -284,7 +284,7 @@ services: output = yaml.safe_load(result.stdout) expected = { - 'version': str(VERSION), + 'version': '2', 'volumes': {'data': {'driver': 'local'}}, 'networks': {'front': {}}, 'services': { @@ -308,7 +308,7 @@ services: self.base_dir = 'tests/fixtures/restart' result = self.dispatch(['config']) assert yaml.safe_load(result.stdout) == { - 'version': str(VERSION), + 'version': '2', 'services': { 'never': { 'image': 'busybox', @@ -354,12 +354,12 @@ services: result = self.dispatch(['config']) json_result = yaml.safe_load(result.stdout) assert json_result == { - 'version': str(VERSION), + 'version': '2.4', 'services': { 'web': { 'command': 'true', 'image': 'alpine:latest', - 'ports': [{'target': 5643}, {'target': 9999}] + 'ports': ['5643/tcp', '9999/tcp'] } } } @@ -369,12 +369,12 @@ services: result = self.dispatch(['--env-file', '.env2', 'config']) json_result = yaml.safe_load(result.stdout) assert json_result == { - 'version': str(VERSION), + 'version': '2.4', 'services': { 'web': { 'command': 'false', 'image': 'alpine:latest', - 'ports': [{'target': 5644}, {'target': 9998}] + 'ports': ['5644/tcp', '9998/tcp'] } } } @@ -384,12 +384,12 @@ services: result = self.dispatch(['--project-directory', 'alt/', 'config']) json_result = yaml.safe_load(result.stdout) assert json_result == { - 'version': str(VERSION), + 'version': '2.4', 'services': { 'web': { 'command': 'echo uwu', 'image': 'alpine:3.10.1', - 'ports': [{'target': 3341}, {'target': 4449}] + 'ports': ['3341/tcp', '4449/tcp'] } } } @@ -501,7 +501,7 @@ services: self.base_dir = 'tests/fixtures/v3-full' result = self.dispatch(['config']) assert yaml.safe_load(result.stdout) == { - 'version': str(VERSION), + 'version': '3.5', 'volumes': { 'foobar': { 'labels': { diff --git a/tests/unit/config/config_test.py b/tests/unit/config/config_test.py index 03e95f77a..8b0d37526 100644 --- a/tests/unit/config/config_test.py +++ b/tests/unit/config/config_test.py @@ -160,25 +160,20 @@ class ConfigTest(unittest.TestCase): } def test_valid_versions(self): - for version in ['2', '2.0']: + cfg = config.load( + build_config_details({ + 'services': { + 'foo': {'image': 'busybox'}, + 'bar': {'image': 'busybox', 'environment': ['FOO=1']}, + } + }) + ) + assert cfg.version == VERSION + + for version in ['2', '2.0', '2.1', '2.2', '2.3', + '3', '3.0', '3.1', '3.2', '3.3', '3.4', '3.5', '3.6', '3.7', '3.8']: cfg = config.load(build_config_details({'version': version})) - assert cfg.version == VERSION - - cfg = config.load(build_config_details({'version': '2.1'})) - assert cfg.version == VERSION - - cfg = config.load(build_config_details({'version': '2.2'})) - assert cfg.version == VERSION - - cfg = config.load(build_config_details({'version': '2.3'})) - assert cfg.version == VERSION - - for version in ['3', '3.0']: - cfg = config.load(build_config_details({'version': version})) - assert cfg.version == VERSION - - cfg = config.load(build_config_details({'version': '3.1'})) - assert cfg.version == VERSION + assert cfg.version == version def test_v1_file_version(self): cfg = config.load(build_config_details({'web': {'image': 'busybox'}})) From 46fb338812976fd2009a83f9be9f8c69084f6b13 Mon Sep 17 00:00:00 2001 From: aiordache Date: Wed, 9 Sep 2020 11:02:22 +0200 Subject: [PATCH 8/8] Fix release notest for 1.27.0 - add removal of python2 support Signed-off-by: aiordache --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index e2bdbbd3a..a319cbb49 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -36,6 +36,8 @@ Change log ### Miscellaneous +- Drop support for Python 2.7 + - Bump `docker-py` to 4.3.1 - Bump `tox` to 3.19.0