Push argument
This commit is contained in:
parent
b206a1e107
commit
5c941d38d6
@ -5,7 +5,7 @@ build:
|
|||||||
image: yourlabs/buildah
|
image: yourlabs/buildah
|
||||||
script:
|
script:
|
||||||
- pip3 install -U --user -e .[cli]
|
- 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
|
stage: build
|
||||||
|
|
||||||
build-itself:
|
build-itself:
|
||||||
|
|||||||
@ -76,7 +76,7 @@ class Image:
|
|||||||
def __str__(self):
|
def __str__(self):
|
||||||
return f'{self.repository}:{self.tags[-1]}'
|
return f'{self.repository}:{self.tags[-1]}'
|
||||||
|
|
||||||
async def push(self, target):
|
async def push(self, target, name=None):
|
||||||
user = os.getenv('IMAGES_USER')
|
user = os.getenv('IMAGES_USER')
|
||||||
passwd = os.getenv('IMAGES_PASS')
|
passwd = os.getenv('IMAGES_PASS')
|
||||||
if user and passwd:
|
if user and passwd:
|
||||||
@ -90,5 +90,5 @@ class Image:
|
|||||||
'buildah',
|
'buildah',
|
||||||
'push',
|
'push',
|
||||||
self.repository + ':final',
|
self.repository + ':final',
|
||||||
f'{self.registry}/{self.repository}:{tag}'
|
name if isinstance(name, str) else f'{self.registry}/{self.repository}:{tag}'
|
||||||
)
|
)
|
||||||
|
|||||||
@ -37,7 +37,7 @@ class Buildah(Target):
|
|||||||
return 'Replacing with: buildah unshare ' + ' '.join(sys.argv)
|
return 'Replacing with: buildah unshare ' + ' '.join(sys.argv)
|
||||||
return f'Buildah({self.image})'
|
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:
|
if target:
|
||||||
self.parent = target
|
self.parent = target
|
||||||
|
|
||||||
@ -122,7 +122,7 @@ class Buildah(Target):
|
|||||||
if result.status == 'success' and self.ctr:
|
if result.status == 'success' and self.ctr:
|
||||||
await self.commit()
|
await self.commit()
|
||||||
if self.push:
|
if self.push:
|
||||||
await self.image.push(target)
|
await self.image.push(target, self.push)
|
||||||
|
|
||||||
if self.ctr is not None:
|
if self.ctr is not None:
|
||||||
await self.parent.exec('buildah', 'rm', self.ctr)
|
await self.parent.exec('buildah', 'rm', self.ctr)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user