1
0
Fork 0
mirror of https://github.com/yavook/kiwi-scp.git synced 2024-12-25 18:42:59 +00:00

subcommands "build", "pull", "update"

This commit is contained in:
Jörn-Michael Miehe 2020-08-18 14:37:07 +02:00
parent c2d34aeaff
commit 679a47e4fa
4 changed files with 65 additions and 0 deletions

View file

@ -1,15 +1,19 @@
# local
from .build import BuildCommand
from .cmd import CmdCommand
from .conf import ConfCopyCommand, ConfPurgeCommand
from .down import DownCommand
from .init import InitCommand
from .logs import LogsCommand
from .net import NetUpCommand, NetDownCommand
from .pull import PullCommand
from .sh import ShCommand
from .show import ShowCommand
from .up import UpCommand
from .update import UpdateCommand
__all__ = [
'BuildCommand',
'CmdCommand',
'ConfCopyCommand',
'ConfPurgeCommand',
@ -18,7 +22,9 @@ __all__ = [
'LogsCommand',
'NetUpCommand',
'NetDownCommand',
'PullCommand',
'ShCommand',
'ShowCommand',
'UpCommand',
'UpdateCommand',
]

View file

@ -0,0 +1,19 @@
# local
from ._subcommand import FlexCommand
from .utils.dockercommand import DockerCommand
class BuildCommand(FlexCommand):
"""kiwi build"""
def __init__(self):
super().__init__(
'build', "Building images",
description="Build images for the whole instance, a project or service(s) inside a project"
)
def _run_services(self, runner, config, args, services):
DockerCommand('docker-compose').run(
config, args, ['build', '--pull', *services]
)
return True

View file

@ -0,0 +1,19 @@
# local
from ._subcommand import FlexCommand
from .utils.dockercommand import DockerCommand
class PullCommand(FlexCommand):
"""kiwi pull"""
def __init__(self):
super().__init__(
'pull', "Pulling images",
description="Pull images for the whole instance, a project or service(s) inside a project"
)
def _run_services(self, runner, config, args, services):
DockerCommand('docker-compose').run(
config, args, ['pull', '--ignore-pull-failures', *services]
)
return True

View file

@ -0,0 +1,21 @@
# local
from ._subcommand import FlexCommand
class UpdateCommand(FlexCommand):
"""kiwi update"""
def __init__(self):
super().__init__(
'update', "Updating",
description="Update the whole instance, a project or service(s) inside a project"
)
def _run_services(self, runner, config, args, services):
result = runner.run('build')
result &= runner.run('pull')
result &= runner.run('conf-copy')
result &= runner.run('down')
result &= runner.run('up')
return result