Fixing container config support
This commit is contained in:
parent
4f5326c81b
commit
63e610ca4f
@ -144,13 +144,15 @@ class Buildah(Target):
|
|||||||
for src, dst in self.mounts.items():
|
for src, dst in self.mounts.items():
|
||||||
await self.parent.exec('umount', self.root / str(dst)[1:])
|
await self.parent.exec('umount', self.root / str(dst)[1:])
|
||||||
await self.parent.exec('buildah', 'umount', self.ctr)
|
await self.parent.exec('buildah', 'umount', self.ctr)
|
||||||
await self.parent.exec('buildah', 'rm', self.ctr)
|
|
||||||
|
|
||||||
if result.status == 'success':
|
if result.status == 'success':
|
||||||
await self.commit()
|
await self.commit()
|
||||||
if os.getenv('BUILDAH_PUSH'):
|
if os.getenv('BUILDAH_PUSH'):
|
||||||
await self.image.push(target)
|
await self.image.push(target)
|
||||||
|
|
||||||
|
if self.ctr is not None:
|
||||||
|
await self.parent.exec('buildah', 'rm', self.ctr)
|
||||||
|
|
||||||
async def mount(self, src, dst):
|
async def mount(self, src, dst):
|
||||||
"""Mount a host directory into the container."""
|
"""Mount a host directory into the container."""
|
||||||
target = self.root / str(dst)[1:]
|
target = self.root / str(dst)[1:]
|
||||||
@ -166,15 +168,13 @@ class Buildah(Target):
|
|||||||
_args += [' '.join([str(a) for a in args])]
|
_args += [' '.join([str(a) for a in args])]
|
||||||
return await self.parent.exec(*_args, **kwargs)
|
return await self.parent.exec(*_args, **kwargs)
|
||||||
|
|
||||||
async def commit(self, image=None):
|
async def commit(self):
|
||||||
image = image or self.image
|
for key, value in self.config.items():
|
||||||
if not image:
|
await self.parent.exec(f'buildah config --{key} "{value}" {self.ctr}')
|
||||||
return
|
|
||||||
|
|
||||||
if not image:
|
await self.parent.exec(
|
||||||
# don't go through that if layer commit
|
f'buildah commit {self.ctr} {self.image.repository}:final'
|
||||||
for key, value in self.config.items():
|
)
|
||||||
await self.parent.exec(f'buildah config --{key} "{value}" {self.ctr}')
|
|
||||||
|
|
||||||
ENV_TAGS = (
|
ENV_TAGS = (
|
||||||
# gitlab
|
# gitlab
|
||||||
@ -194,12 +194,12 @@ class Buildah(Target):
|
|||||||
if value:
|
if value:
|
||||||
self.image.tags.append(value)
|
self.image.tags.append(value)
|
||||||
|
|
||||||
if image.tags:
|
if self.image.tags:
|
||||||
tags = [f'{image.repository}:{tag}' for tag in image.tags]
|
tags = [f'{self.image.repository}:{tag}' for tag in self.image.tags]
|
||||||
else:
|
else:
|
||||||
tags = [image.repository]
|
tags = [self.image.repository]
|
||||||
|
|
||||||
await self.parent.exec('buildah', 'tag', self.image_previous, *tags)
|
await self.parent.exec('buildah', 'tag', self.image.repository + ':final', *tags)
|
||||||
|
|
||||||
async def mkdir(self, *paths):
|
async def mkdir(self, *paths):
|
||||||
return await self.parent.mkdir(*[self.path(path) for path in paths])
|
return await self.parent.mkdir(*[self.path(path) for path in paths])
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user