mirror of https://github.com/docker/compose.git
commit
adcd1901e9
|
@ -1,4 +1,4 @@
|
|||
from __future__ import absolute_import
|
||||
from __future__ import unicode_literals
|
||||
|
||||
__version__ = '1.10.0-rc2'
|
||||
__version__ = '1.10.0'
|
||||
|
|
|
@ -56,9 +56,16 @@ def denormalize_service_dict(service_dict, version):
|
|||
service_dict = service_dict.copy()
|
||||
|
||||
if 'restart' in service_dict:
|
||||
service_dict['restart'] = types.serialize_restart_spec(service_dict['restart'])
|
||||
service_dict['restart'] = types.serialize_restart_spec(
|
||||
service_dict['restart']
|
||||
)
|
||||
|
||||
if version == V1 and 'network_mode' not in service_dict:
|
||||
service_dict['network_mode'] = 'bridge'
|
||||
|
||||
if 'depends_on' in service_dict and version != V2_1:
|
||||
service_dict['depends_on'] = sorted([
|
||||
svc for svc in service_dict['depends_on'].keys()
|
||||
])
|
||||
|
||||
return service_dict
|
||||
|
|
|
@ -12,6 +12,8 @@ from six.moves.queue import Empty
|
|||
from six.moves.queue import Queue
|
||||
|
||||
from compose.cli.signals import ShutdownException
|
||||
from compose.errors import HealthCheckFailed
|
||||
from compose.errors import NoHealthCheckConfigured
|
||||
from compose.errors import OperationFailedError
|
||||
from compose.utils import get_output_stream
|
||||
|
||||
|
@ -48,7 +50,7 @@ def parallel_execute(objects, func, get_name, msg, get_deps=None):
|
|||
elif isinstance(exception, APIError):
|
||||
errors[get_name(obj)] = exception.explanation
|
||||
writer.write(get_name(obj), 'error')
|
||||
elif isinstance(exception, OperationFailedError):
|
||||
elif isinstance(exception, (OperationFailedError, HealthCheckFailed, NoHealthCheckConfigured)):
|
||||
errors[get_name(obj)] = exception.msg
|
||||
writer.write(get_name(obj), 'error')
|
||||
elif isinstance(exception, UpstreamError):
|
||||
|
@ -164,21 +166,27 @@ def feed_queue(objects, func, get_deps, results, state):
|
|||
|
||||
for obj in pending:
|
||||
deps = get_deps(obj)
|
||||
|
||||
if any(dep[0] in state.failed for dep in deps):
|
||||
log.debug('{} has upstream errors - not processing'.format(obj))
|
||||
results.put((obj, None, UpstreamError()))
|
||||
state.failed.add(obj)
|
||||
elif all(
|
||||
dep not in objects or (
|
||||
dep in state.finished and (not ready_check or ready_check(dep))
|
||||
) for dep, ready_check in deps
|
||||
):
|
||||
log.debug('Starting producer thread for {}'.format(obj))
|
||||
t = Thread(target=producer, args=(obj, func, results))
|
||||
t.daemon = True
|
||||
t.start()
|
||||
state.started.add(obj)
|
||||
try:
|
||||
if any(dep[0] in state.failed for dep in deps):
|
||||
log.debug('{} has upstream errors - not processing'.format(obj))
|
||||
results.put((obj, None, UpstreamError()))
|
||||
state.failed.add(obj)
|
||||
elif all(
|
||||
dep not in objects or (
|
||||
dep in state.finished and (not ready_check or ready_check(dep))
|
||||
) for dep, ready_check in deps
|
||||
):
|
||||
log.debug('Starting producer thread for {}'.format(obj))
|
||||
t = Thread(target=producer, args=(obj, func, results))
|
||||
t.daemon = True
|
||||
t.start()
|
||||
state.started.add(obj)
|
||||
except (HealthCheckFailed, NoHealthCheckConfigured) as e:
|
||||
log.debug(
|
||||
'Healthcheck for service(s) upstream of {} failed - '
|
||||
'not processing'.format(obj)
|
||||
)
|
||||
results.put((obj, None, e))
|
||||
|
||||
if state.is_done():
|
||||
results.put(STOP)
|
||||
|
|
|
@ -60,12 +60,13 @@ sed -i -e 's/logo.png?raw=true/https:\/\/github.com\/docker\/compose\/raw\/maste
|
|||
./script/build/write-git-sha
|
||||
python setup.py sdist bdist_wheel
|
||||
if [ "$(command -v twine 2> /dev/null)" ]; then
|
||||
twine upload ./dist/docker-compose-${VERSION/-/}.tar.gz ./dist/docker-compose-${VERSION/-/}-py2.py3-none-any.whl
|
||||
twine upload ./dist/docker-compose-${VERSION/-/}.tar.gz ./dist/docker_compose-${VERSION/-/}-py2.py3-none-any.whl
|
||||
else
|
||||
python setup.py upload
|
||||
fi
|
||||
|
||||
echo "Testing pip package"
|
||||
deactivate || true
|
||||
virtualenv venv-test
|
||||
source venv-test/bin/activate
|
||||
pip install docker-compose==$VERSION
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
|
||||
set -e
|
||||
|
||||
VERSION="1.10.0-rc2"
|
||||
VERSION="1.10.0"
|
||||
IMAGE="docker/compose:$VERSION"
|
||||
|
||||
|
||||
|
|
|
@ -1443,7 +1443,7 @@ class ProjectTest(DockerClientTestCase):
|
|||
project = Project.from_config(
|
||||
name='composetest', config_data=config_data, client=self.client
|
||||
)
|
||||
with pytest.raises(HealthCheckFailed):
|
||||
with pytest.raises(ProjectError):
|
||||
project.up()
|
||||
containers = project.containers()
|
||||
assert len(containers) == 1
|
||||
|
@ -1479,7 +1479,7 @@ class ProjectTest(DockerClientTestCase):
|
|||
project = Project.from_config(
|
||||
name='composetest', config_data=config_data, client=self.client
|
||||
)
|
||||
with pytest.raises(NoHealthCheckConfigured):
|
||||
with pytest.raises(ProjectError):
|
||||
project.up()
|
||||
containers = project.containers()
|
||||
assert len(containers) == 1
|
||||
|
|
|
@ -22,6 +22,7 @@ from compose.config.config import V3_0
|
|||
from compose.config.environment import Environment
|
||||
from compose.config.errors import ConfigurationError
|
||||
from compose.config.errors import VERSION_EXPLANATION
|
||||
from compose.config.serialize import denormalize_service_dict
|
||||
from compose.config.types import VolumeSpec
|
||||
from compose.const import IS_WINDOWS_PLATFORM
|
||||
from compose.utils import nanoseconds_from_time_seconds
|
||||
|
@ -3269,3 +3270,33 @@ def get_config_filename_for_files(filenames, subdir=None):
|
|||
return os.path.basename(filename)
|
||||
finally:
|
||||
shutil.rmtree(project_dir)
|
||||
|
||||
|
||||
class SerializeTest(unittest.TestCase):
|
||||
def test_denormalize_depends_on_v3(self):
|
||||
service_dict = {
|
||||
'image': 'busybox',
|
||||
'command': 'true',
|
||||
'depends_on': {
|
||||
'service2': {'condition': 'service_started'},
|
||||
'service3': {'condition': 'service_started'},
|
||||
}
|
||||
}
|
||||
|
||||
assert denormalize_service_dict(service_dict, V3_0) == {
|
||||
'image': 'busybox',
|
||||
'command': 'true',
|
||||
'depends_on': ['service2', 'service3']
|
||||
}
|
||||
|
||||
def test_denormalize_depends_on_v2_1(self):
|
||||
service_dict = {
|
||||
'image': 'busybox',
|
||||
'command': 'true',
|
||||
'depends_on': {
|
||||
'service2': {'condition': 'service_started'},
|
||||
'service3': {'condition': 'service_started'},
|
||||
}
|
||||
}
|
||||
|
||||
assert denormalize_service_dict(service_dict, V2_1) == service_dict
|
||||
|
|
Loading…
Reference in New Issue