diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 9030492..467983b 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -5,7 +5,7 @@ build: image: yourlabs/buildah script: - pip3 install -U --user -e .[cli] - - CACHE_DIR=$(pwd)/.cache python3 ./shlaxfile.py build push + - CACHE_DIR=$(pwd)/.cache python3 ./shlaxfile.py build push=docker://docker.io/yourlabs/shlax:$CI_COMMIT_SHORT_SHA stage: build build-itself: diff --git a/shlax/image.py b/shlax/image.py index dc58635..68d66eb 100644 --- a/shlax/image.py +++ b/shlax/image.py @@ -76,7 +76,7 @@ class Image: def __str__(self): return f'{self.repository}:{self.tags[-1]}' - async def push(self, target): + async def push(self, target, name=None): user = os.getenv('IMAGES_USER') passwd = os.getenv('IMAGES_PASS') if user and passwd: @@ -90,5 +90,5 @@ class Image: 'buildah', 'push', self.repository + ':final', - f'{self.registry}/{self.repository}:{tag}' + name if isinstance(name, str) else f'{self.registry}/{self.repository}:{tag}' ) diff --git a/shlax/targets/buildah.py b/shlax/targets/buildah.py index 71e3ebc..7de8bd5 100644 --- a/shlax/targets/buildah.py +++ b/shlax/targets/buildah.py @@ -37,7 +37,7 @@ class Buildah(Target): return 'Replacing with: buildah unshare ' + ' '.join(sys.argv) return f'Buildah({self.image})' - async def __call__(self, *actions, target=None, push: bool=False): + async def __call__(self, *actions, target=None, push: str=False): if target: self.parent = target @@ -122,7 +122,7 @@ class Buildah(Target): if result.status == 'success' and self.ctr: await self.commit() if self.push: - await self.image.push(target) + await self.image.push(target, self.push) if self.ctr is not None: await self.parent.exec('buildah', 'rm', self.ctr)