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:
parent
c2d34aeaff
commit
679a47e4fa
4 changed files with 65 additions and 0 deletions
|
@ -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',
|
||||
]
|
||||
|
|
19
src/kiwi/subcommands/build.py
Normal file
19
src/kiwi/subcommands/build.py
Normal 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
|
19
src/kiwi/subcommands/pull.py
Normal file
19
src/kiwi/subcommands/pull.py
Normal 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
|
21
src/kiwi/subcommands/update.py
Normal file
21
src/kiwi/subcommands/update.py
Normal 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
|
Loading…
Reference in a new issue