Plumb CLI argument to deployer code
All checks were successful
Lint Checks / Run linter (pull_request) Successful in 37s
Webapp Test / Run webapp test suite (pull_request) Successful in 5m11s
Smoke Test / Run basic test suite (pull_request) Successful in 4m46s
Deploy Test / Run deploy test suite (pull_request) Successful in 5m33s
K8s Deploy Test / Run deploy test suite on kind/k8s (pull_request) Successful in 8m39s

This commit is contained in:
David Boreham 2024-08-12 16:33:07 -06:00
parent 5d4fdbf220
commit 6c2ce4272a
4 changed files with 10 additions and 8 deletions

View File

@ -29,14 +29,14 @@ class DockerDeployer(Deployer):
compose_env_file=compose_env_file)
self.type = type
def up(self, detach, services):
def up(self, detach, skip_cluster_management, services):
if not opts.o.dry_run:
try:
return self.docker.compose.up(detach=detach, services=services)
except DockerException as e:
raise DeployerException(e)
def down(self, timeout, volumes):
def down(self, timeout, volumes, skip_cluster_management):
if not opts.o.dry_run:
try:
return self.docker.compose.down(timeout=timeout, volumes=volumes)

View File

@ -102,7 +102,7 @@ def up_operation(ctx, services_list, stay_attached=False, skip_cluster_managemen
print(f"Running compose up with container_exec_env: {container_exec_env}, extra_args: {services_list}")
for pre_start_command in cluster_context.pre_start_commands:
_run_command(global_context, cluster_context.cluster, pre_start_command)
deploy_context.deployer.up(detach=not stay_attached, services=services_list)
deploy_context.deployer.up(detach=not stay_attached, skip_cluster_management=skip_cluster_management, services=services_list)
for post_start_command in cluster_context.post_start_commands:
_run_command(global_context, cluster_context.cluster, post_start_command)
_orchestrate_cluster_config(global_context, cluster_context.config, deploy_context.deployer, container_exec_env)
@ -113,7 +113,7 @@ def down_operation(ctx, delete_volumes, extra_args_list, skip_cluster_management
if extra_args_list:
timeout_arg = extra_args_list[0]
# Specify shutdown timeout (default 10s) to give services enough time to shutdown gracefully
ctx.obj.deployer.down(timeout=timeout_arg, volumes=delete_volumes)
ctx.obj.deployer.down(timeout=timeout_arg, volumes=delete_volumes, skip_cluster_management=skip_cluster_management)
def status_operation(ctx):

View File

@ -20,11 +20,11 @@ from pathlib import Path
class Deployer(ABC):
@abstractmethod
def up(self, detach, services):
def up(self, detach, skip_cluster_management, services):
pass
@abstractmethod
def down(self, timeout, volumes):
def down(self, timeout, volumes, skip_cluster_management):
pass
@abstractmethod

View File

@ -206,7 +206,8 @@ class K8sDeployer(Deployer):
return cert
return None
def up(self, detach, services):
def up(self, detach, skip_cluster_management, services):
self.skip_cluster_management = skip_cluster_management
if not opts.o.dry_run:
if self.is_kind() and not self.skip_cluster_management:
# Create the kind cluster
@ -263,7 +264,8 @@ class K8sDeployer(Deployer):
print("NodePort created:")
print(f"{nodeport_resp}")
def down(self, timeout, volumes): # noqa: C901
def down(self, timeout, volumes, skip_cluster_management): # noqa: C901
self.skip_cluster_management = skip_cluster_management
self.connect_api()
# Delete the k8s objects