From e0c902eb4736015f2583d981abc85e52d9eede0d Mon Sep 17 00:00:00 2001 From: jpic Date: Sun, 16 Feb 2020 14:47:03 +0100 Subject: [PATCH] Buildah: support push arg --- shlax/targets/buildah.py | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/shlax/targets/buildah.py b/shlax/targets/buildah.py index bfde5bb..ceabe60 100644 --- a/shlax/targets/buildah.py +++ b/shlax/targets/buildah.py @@ -169,17 +169,19 @@ class Buildah(Localhost): await self.exec('podman', 'push', f'{self.image.repository}:{tag}', buildah=False) async def clean(self, *args, **kwargs): - if self.is_wrapper(): - return + if not self.is_wrapper(): + for src, dst in self.mounts.items(): + await self.exec('umount', self.mnt / str(dst)[1:], buildah=False) - for src, dst in self.mounts.items(): - await self.exec('umount', self.mnt / str(dst)[1:], buildah=False) + if self.status == 'success': + await self.commit() - if self.status == 'success': - await self.commit() + if self.mnt is not None: + await self.exec('buildah', 'umount', self.ctr, buildah=False) - if self.mnt is not None: - await self.exec('buildah', 'umount', self.ctr, buildah=False) + if self.ctr is not None: + await self.exec('buildah', 'rm', self.ctr, buildah=False) - if self.ctr is not None: - await self.exec('buildah', 'rm', self.ctr, buildah=False) + if 'push' in args: + for tag in self.image.tags: + await self.exec('podman', 'push', f'{self.image.repository}:{tag}', buildah=False)