mirror of
https://github.com/ansible-collections/community.docker.git
synced 2026-03-15 19:58:28 +00:00
Fix composition of --output parameters. (#947)
This commit is contained in:
parent
41445def33
commit
d91f854d45
2
changelogs/fragments/947-docker_image_build.yml
Normal file
2
changelogs/fragments/947-docker_image_build.yml
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
bugfixes:
|
||||||
|
- "docker_image_build - fix ``--output`` parameter composition for ``type=docker`` and ``type=image`` (https://github.com/ansible-collections/community.docker/issues/946, https://github.com/ansible-collections/community.docker/pull/947)."
|
||||||
@ -207,7 +207,8 @@ options:
|
|||||||
image:
|
image:
|
||||||
- This exporter writes the build result as an image or a manifest list.
|
- This exporter writes the build result as an image or a manifest list.
|
||||||
When using this driver, the image will appear in C(docker images).
|
When using this driver, the image will appear in C(docker images).
|
||||||
- The image name can be provided in O(outputs[].name). If it is not provided, the
|
- The image name can be provided in O(outputs[].name). If it is not provided,
|
||||||
|
O(name) and O(tag) will be used.
|
||||||
- Optionally, image can be automatically pushed to a registry by setting O(outputs[].push=true).
|
- Optionally, image can be automatically pushed to a registry by setting O(outputs[].push=true).
|
||||||
required: true
|
required: true
|
||||||
dest:
|
dest:
|
||||||
@ -433,19 +434,19 @@ class ImageBuilder(DockerBaseClass):
|
|||||||
if output['type'] == 'oci':
|
if output['type'] == 'oci':
|
||||||
args.extend(['--output', 'type=oci,dest={dest}'.format(dest=output['dest'])])
|
args.extend(['--output', 'type=oci,dest={dest}'.format(dest=output['dest'])])
|
||||||
if output['type'] == 'docker':
|
if output['type'] == 'docker':
|
||||||
more = []
|
subargs = ['type=docker']
|
||||||
if output['dest'] is not None:
|
if output['dest'] is not None:
|
||||||
more.append('dest={dest}'.format(dest=output['dest']))
|
subargs.append('dest={dest}'.format(dest=output['dest']))
|
||||||
if output['dest'] is not None:
|
if output['context'] is not None:
|
||||||
more.append('context={context}'.format(context=output['context']))
|
subargs.append('context={context}'.format(context=output['context']))
|
||||||
args.extend(['--output', 'type=docker,{more}'.format(more=','.join(more))])
|
args.extend(['--output', ','.join(subargs)])
|
||||||
if output['type'] == 'image':
|
if output['type'] == 'image':
|
||||||
more = []
|
subargs = ['type=image']
|
||||||
if output['name'] is not None:
|
if output['name'] is not None:
|
||||||
more.append('name={name}'.format(name=output['name']))
|
subargs.append('name={name}'.format(name=output['name']))
|
||||||
if output['push']:
|
if output['push']:
|
||||||
more.append('push=true')
|
subargs.append('push=true')
|
||||||
args.extend(['--output', 'type=image,{more}'.format(more=','.join(more))])
|
args.extend(['--output', ','.join(subargs)])
|
||||||
return environ_update
|
return environ_update
|
||||||
|
|
||||||
def build_image(self):
|
def build_image(self):
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user