Ability to build container against docker swarm

Add a decode=True option during call to dockerAPI in order
to build container against recent docker swarm.

Closes-Bug: #1779460
Change-Id: I48f041e7ed9dd5a5f410b4eaa081f6f013119d17
This commit is contained in:
Victor Coutellier 2018-06-30 08:32:37 -04:00
parent 430f335a8b
commit f53fcc7e5b
2 changed files with 14 additions and 14 deletions

View File

@ -569,15 +569,15 @@ class BuildTask(DockerTask):
buildargs = self.update_buildargs() buildargs = self.update_buildargs()
try: try:
for response in self.dc.build(path=image.path, for stream in self.dc.build(path=image.path,
tag=image.canonical_name, tag=image.canonical_name,
nocache=not self.conf.cache, nocache=not self.conf.cache,
rm=True, rm=True,
decode=True,
network_mode=self.conf.network_mode, network_mode=self.conf.network_mode,
pull=pull, pull=pull,
forcerm=self.forcerm, forcerm=self.forcerm,
buildargs=buildargs): buildargs=buildargs):
stream = json.loads(response.decode('utf-8'))
if 'stream' in stream: if 'stream' in stream:
for line in stream['stream'].split('\n'): for line in stream['stream'].split('\n'):
if line: if line:

View File

@ -87,7 +87,7 @@ class TasksTest(base.TestCase):
builder.run() builder.run()
mock_client().build.assert_called_once_with( mock_client().build.assert_called_once_with(
path=self.image.path, tag=self.image.canonical_name, path=self.image.path, tag=self.image.canonical_name, decode=True,
network_mode=None, nocache=False, rm=True, pull=True, forcerm=True, network_mode=None, nocache=False, rm=True, pull=True, forcerm=True,
buildargs=None) buildargs=None)
@ -104,7 +104,7 @@ class TasksTest(base.TestCase):
builder.run() builder.run()
mock_client().build.assert_called_once_with( mock_client().build.assert_called_once_with(
path=self.image.path, tag=self.image.canonical_name, path=self.image.path, tag=self.image.canonical_name, decode=True,
network_mode='host', nocache=False, rm=True, pull=True, network_mode='host', nocache=False, rm=True, pull=True,
forcerm=True, buildargs=None) forcerm=True, buildargs=None)
@ -124,7 +124,7 @@ class TasksTest(base.TestCase):
builder.run() builder.run()
mock_client().build.assert_called_once_with( mock_client().build.assert_called_once_with(
path=self.image.path, tag=self.image.canonical_name, path=self.image.path, tag=self.image.canonical_name, decode=True,
network_mode=None, nocache=False, rm=True, pull=True, forcerm=True, network_mode=None, nocache=False, rm=True, pull=True, forcerm=True,
buildargs=build_args) buildargs=build_args)
@ -143,7 +143,7 @@ class TasksTest(base.TestCase):
builder.run() builder.run()
mock_client().build.assert_called_once_with( mock_client().build.assert_called_once_with(
path=self.image.path, tag=self.image.canonical_name, path=self.image.path, tag=self.image.canonical_name, decode=True,
network_mode=None, nocache=False, rm=True, pull=True, forcerm=True, network_mode=None, nocache=False, rm=True, pull=True, forcerm=True,
buildargs=build_args) buildargs=build_args)
@ -164,7 +164,7 @@ class TasksTest(base.TestCase):
builder.run() builder.run()
mock_client().build.assert_called_once_with( mock_client().build.assert_called_once_with(
path=self.image.path, tag=self.image.canonical_name, path=self.image.path, tag=self.image.canonical_name, decode=True,
network_mode=None, nocache=False, rm=True, pull=True, forcerm=True, network_mode=None, nocache=False, rm=True, pull=True, forcerm=True,
buildargs=build_args) buildargs=build_args)