Add --layers for tcib image layer caching

This flag will cause buildah bud to act like docker and check each
command before actually executing it. If it matches an existing
layer, then it will not be executed.

Change-Id: I4d153b838c9d515c53388105a4425b53a318cacf
This commit is contained in:
Rabi Mishra
2020-08-31 19:45:22 +05:30
parent ac7638e5c6
commit 9c241569ef
2 changed files with 10 additions and 7 deletions

View File

@@ -144,7 +144,7 @@ class BuildahBuilder(base.BaseBuilder):
# TODO(aschultz): drop --format docker when oci format is properly
# supported by the undercloud registry
bud_args.extend(['--format', 'docker', '--tls-verify=False',
'--logfile', logfile, '-t',
'--layers', '--logfile', logfile, '-t',
self._get_destination(container_name),
container_build_path])
args = self.buildah_cmd + bud_args

View File

@@ -76,8 +76,9 @@ class TestBuildahBuilder(base.TestCase):
container_build_path = WORK_DIR + '/' + 'fedora-base'
logfile = '/tmp/kolla/fedora-base/fedora-base-build.log'
buildah_cmd_build = ['bud', '--format', 'docker',
'--tls-verify=False', '--logfile',
logfile, '-t', dest, container_build_path]
'--tls-verify=False', '--layers',
'--logfile', logfile, '-t',
dest, container_build_path]
args.extend(buildah_cmd_build)
bb(WORK_DIR, DEPS).build('fedora-base', container_build_path)
mock_process.assert_called_once_with(
@@ -94,8 +95,9 @@ class TestBuildahBuilder(base.TestCase):
container_build_path = WORK_DIR + '/' + 'fedora-base'
logfile = '/tmp/kolla/fedora-base/fedora-base-build.log'
buildah_cmd_build = ['bud', '--format', 'docker',
'--tls-verify=False', '--logfile',
logfile, '-t', dest, container_build_path]
'--tls-verify=False', '--layers',
'--logfile', logfile, '-t', dest,
container_build_path]
args.extend(buildah_cmd_build)
bb(WORK_DIR, DEPS, img_type=False).build('fedora-base',
container_build_path)
@@ -115,8 +117,9 @@ class TestBuildahBuilder(base.TestCase):
buildah_cmd_build = ['bud', '--volume', '/etc/pki:/etc/pki',
'--volume', '/etc/dir2:/dir2',
'--format', 'docker',
'--tls-verify=False', '--logfile',
logfile, '-t', dest, container_build_path]
'--tls-verify=False', '--layers',
'--logfile', logfile, '-t', dest,
container_build_path]
args.extend(buildah_cmd_build)
bb(WORK_DIR, DEPS, volumes=VOLS).build('fedora-base',
container_build_path)