Merge pull request #4340 from docker/bump-1.10.0

Bump 1.10.0
This commit is contained in:
Joffrey F 2017-01-17 15:25:06 -08:00 committed by GitHub
commit adcd1901e9
7 changed files with 69 additions and 22 deletions

View File

@ -1,4 +1,4 @@
from __future__ import absolute_import from __future__ import absolute_import
from __future__ import unicode_literals from __future__ import unicode_literals
__version__ = '1.10.0-rc2' __version__ = '1.10.0'

View File

@ -56,9 +56,16 @@ def denormalize_service_dict(service_dict, version):
service_dict = service_dict.copy() service_dict = service_dict.copy()
if 'restart' in service_dict: 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: if version == V1 and 'network_mode' not in service_dict:
service_dict['network_mode'] = 'bridge' 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 return service_dict

View File

@ -12,6 +12,8 @@ from six.moves.queue import Empty
from six.moves.queue import Queue from six.moves.queue import Queue
from compose.cli.signals import ShutdownException from compose.cli.signals import ShutdownException
from compose.errors import HealthCheckFailed
from compose.errors import NoHealthCheckConfigured
from compose.errors import OperationFailedError from compose.errors import OperationFailedError
from compose.utils import get_output_stream 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): elif isinstance(exception, APIError):
errors[get_name(obj)] = exception.explanation errors[get_name(obj)] = exception.explanation
writer.write(get_name(obj), 'error') writer.write(get_name(obj), 'error')
elif isinstance(exception, OperationFailedError): elif isinstance(exception, (OperationFailedError, HealthCheckFailed, NoHealthCheckConfigured)):
errors[get_name(obj)] = exception.msg errors[get_name(obj)] = exception.msg
writer.write(get_name(obj), 'error') writer.write(get_name(obj), 'error')
elif isinstance(exception, UpstreamError): elif isinstance(exception, UpstreamError):
@ -164,7 +166,7 @@ def feed_queue(objects, func, get_deps, results, state):
for obj in pending: for obj in pending:
deps = get_deps(obj) deps = get_deps(obj)
try:
if any(dep[0] in state.failed for dep in deps): if any(dep[0] in state.failed for dep in deps):
log.debug('{} has upstream errors - not processing'.format(obj)) log.debug('{} has upstream errors - not processing'.format(obj))
results.put((obj, None, UpstreamError())) results.put((obj, None, UpstreamError()))
@ -179,6 +181,12 @@ def feed_queue(objects, func, get_deps, results, state):
t.daemon = True t.daemon = True
t.start() t.start()
state.started.add(obj) 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(): if state.is_done():
results.put(STOP) results.put(STOP)

View File

@ -60,12 +60,13 @@ sed -i -e 's/logo.png?raw=true/https:\/\/github.com\/docker\/compose\/raw\/maste
./script/build/write-git-sha ./script/build/write-git-sha
python setup.py sdist bdist_wheel python setup.py sdist bdist_wheel
if [ "$(command -v twine 2> /dev/null)" ]; then 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 else
python setup.py upload python setup.py upload
fi fi
echo "Testing pip package" echo "Testing pip package"
deactivate || true
virtualenv venv-test virtualenv venv-test
source venv-test/bin/activate source venv-test/bin/activate
pip install docker-compose==$VERSION pip install docker-compose==$VERSION

View File

@ -15,7 +15,7 @@
set -e set -e
VERSION="1.10.0-rc2" VERSION="1.10.0"
IMAGE="docker/compose:$VERSION" IMAGE="docker/compose:$VERSION"

View File

@ -1443,7 +1443,7 @@ class ProjectTest(DockerClientTestCase):
project = Project.from_config( project = Project.from_config(
name='composetest', config_data=config_data, client=self.client name='composetest', config_data=config_data, client=self.client
) )
with pytest.raises(HealthCheckFailed): with pytest.raises(ProjectError):
project.up() project.up()
containers = project.containers() containers = project.containers()
assert len(containers) == 1 assert len(containers) == 1
@ -1479,7 +1479,7 @@ class ProjectTest(DockerClientTestCase):
project = Project.from_config( project = Project.from_config(
name='composetest', config_data=config_data, client=self.client name='composetest', config_data=config_data, client=self.client
) )
with pytest.raises(NoHealthCheckConfigured): with pytest.raises(ProjectError):
project.up() project.up()
containers = project.containers() containers = project.containers()
assert len(containers) == 1 assert len(containers) == 1

View File

@ -22,6 +22,7 @@ from compose.config.config import V3_0
from compose.config.environment import Environment from compose.config.environment import Environment
from compose.config.errors import ConfigurationError from compose.config.errors import ConfigurationError
from compose.config.errors import VERSION_EXPLANATION from compose.config.errors import VERSION_EXPLANATION
from compose.config.serialize import denormalize_service_dict
from compose.config.types import VolumeSpec from compose.config.types import VolumeSpec
from compose.const import IS_WINDOWS_PLATFORM from compose.const import IS_WINDOWS_PLATFORM
from compose.utils import nanoseconds_from_time_seconds 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) return os.path.basename(filename)
finally: finally:
shutil.rmtree(project_dir) 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