Use a full string match for container images

When building the list of container images to pass to kolla-build, we
currently use the plain image names. However, since these are regexes,
we can hit problems with substring matches. For example, the 'rabbitmq'
image matches 'rabbitmq-3.7.10', an image which is being added to kolla
in the stable/train branch that Tripleo is not interested in.

This change uses a full string match to avoid this issue.

Change-Id: Ic78df6a98b7f0c796ec9e112f572c9b50cba396b
This commit is contained in:
Mark Goddard 2020-04-15 15:48:51 +01:00 committed by Alex Schultz
parent 0d5d323515
commit a72dcb41a9
2 changed files with 17 additions and 16 deletions

View File

@ -507,7 +507,8 @@ class KollaImageBuilder(base.BaseImageManager):
image = self.imagename_to_regex(i.get('imagename'))
# Make sure the image was properly parsed and not purposely skipped
if image and image not in excludes:
cmd.append(image)
# NOTE(mgoddard): Use a full string match.
cmd.append("^%s$" % image)
if template_only:
# build the dep list cmd line

View File

@ -119,10 +119,10 @@ class TestKollaImageBuilder(base.TestCase):
'kolla-build',
'--config-file',
'kolla-config.conf',
'nova-compute',
'nova-libvirt',
'heat-docker-agents-centos',
'image-with-missing-tag',
'^nova-compute$',
'^nova-libvirt$',
'^heat-docker-agents-centos$',
'^image-with-missing-tag$',
], env=env, stdout=-1, universal_newlines=True)
@mock.patch('tripleo_common.image.base.open',
@ -144,10 +144,10 @@ class TestKollaImageBuilder(base.TestCase):
'kolla-build',
'--config-file',
'kolla-config.conf',
'nova-compute',
'nova-libvirt',
'heat-docker-agents-centos',
'image-with-missing-tag',
'^nova-compute$',
'^nova-libvirt$',
'^heat-docker-agents-centos$',
'^image-with-missing-tag$',
'--template-only',
'--work-dir', '/tmp/kolla',
], env=env, stdout=-1, universal_newlines=True)
@ -155,10 +155,10 @@ class TestKollaImageBuilder(base.TestCase):
'kolla-build',
'--config-file',
'kolla-config.conf',
'nova-compute',
'nova-libvirt',
'heat-docker-agents-centos',
'image-with-missing-tag',
'^nova-compute$',
'^nova-libvirt$',
'^heat-docker-agents-centos$',
'^image-with-missing-tag$',
'--list-dependencies',
], env=env, stdout=-1, stderr=-1, universal_newlines=True)
calls = [call1, call2]
@ -200,9 +200,9 @@ class TestKollaImageBuilder(base.TestCase):
'kolla-build',
'--config-file',
'kolla-config.conf',
'nova-libvirt',
'heat-docker-agents-centos',
'image-with-missing-tag',
'^nova-libvirt$',
'^heat-docker-agents-centos$',
'^image-with-missing-tag$',
], env=env, stdout=-1, universal_newlines=True)