in solutions_builder/cli/cli.py [0:0]
def delete(profile: str = DEFAULT_DEPLOY_PROFILE,
component: Annotated[str, typer.Option(
"--component", "-c", "-m")] = None,
namespace: Annotated[str, typer.Option("--namespace", "-n")] = None,
solution_path: Annotated[Optional[str],
typer.Argument()] = ".",
yes: Optional[bool] = False):
"""
Delete deployment.
"""
validate_solution_folder(solution_path)
sb_yaml = read_yaml(f"{solution_path}/sb.yaml")
global_variables = sb_yaml.get("global_variables", {})
# Get global vars from sb.yaml.
project_id = global_variables.get("project_id", None)
assert project_id, "project_id is not set in 'global_variables' in sb.yaml."
component_flag = f" -m {component} " if component else ""
# Set Skaffold namespace
namespace_flag = f"-n {namespace}" if namespace else ""
# Set default repo to Artifact Registry
artifact_region = "us" # TODO: Add support to other multi-regions.
default_repo = f"\"{artifact_region}-docker.pkg.dev/{project_id}\""
command = f"skaffold delete -p {profile} {component_flag} {namespace_flag}" \
f" --default-repo={default_repo}"
print("This will DELETE deployed services using the command below:")
print_highlight(command)
confirm("\nThis may take a few minutes. Continue?", default=False, skip=yes)
exec_shell(command, working_dir=solution_path)