diff --git a/setup.py b/setup.py index 078df4b..b15babf 100644 --- a/setup.py +++ b/setup.py @@ -7,6 +7,9 @@ setup( setup_requires='setupmeta', install_requires=['cli2'], extras_require=dict( + full=[ + 'pyyaml', + ], test=[ 'pytest', 'pytest-cov', diff --git a/shlax/contrib/gitlab.py b/shlax/contrib/gitlab.py index c125cac..1e7ce35 100644 --- a/shlax/contrib/gitlab.py +++ b/shlax/contrib/gitlab.py @@ -29,15 +29,10 @@ class GitLabCI(Script): job = self.kwargs[arg] _args = [] if not isinstance(job['image'], str): - await job['image'](**kwargs) image = str(job['image'].image) - _args.append('recreate') else: image = job['image'] - await Docker( - *cli.shlaxfile.actions[arg].actions, - image=image - )(*_args, **kwargs) + await self.action('Docker', Run(job['script']), image=image)(*_args, **kwargs) def colorized(self): return type(self).__name__ diff --git a/shlax/targets/docker.py b/shlax/targets/docker.py index 450fe19..331c8b9 100644 --- a/shlax/targets/docker.py +++ b/shlax/targets/docker.py @@ -12,7 +12,7 @@ class Docker(Localhost): def __init__(self, *args, **kwargs): self.image = kwargs.get('image', 'alpine') if not isinstance(self.image, Image): - self.image = Image(image) + self.image = Image(self.image) super().__init__(*args, **kwargs) self.context['ctr'] = None @@ -54,10 +54,6 @@ class Docker(Localhost): if self.context['ctr']: self.context['ctr'] = (await self.exec('docker', 'start', name)).out - else: - self.context['ctr'] = ( - await self.exec('sleep', '120', daemon=True) - ).out return await super().call(*args, **kwargs) async def copy(self, *args): diff --git a/shlaxfile.py b/shlaxfile.py index f7bd3df..df287da 100755 --- a/shlaxfile.py +++ b/shlaxfile.py @@ -24,34 +24,31 @@ build = Buildah( '''), Copy('shlax/', 'setup.py', '/app'), ), - Pip('/app'), + Pip('/app[full]'), commit='yourlabs/shlax', workdir='/app', ) shlax = Container( build=build, - test=test, -) - -pypi = Run( - 'pypi-release', - stage='deploy', - image='yourlabs/python', + test=Script(Run('./shlaxfile.py -d test')), ) gitlabci = GitLabCI( build=dict( stage='build', image='yourlabs/shlax', + script='./shlaxfile.py shlax build', ), test=dict( stage='test', + script='./shlaxfile.py -d test', image=build, ), pypi=dict( stage='deploy', only=['tags'], image='yourlabs/python', + script='pypi-release', ), )