Skip to content

Commit

Permalink
updated project_id var in sb delete
Browse files Browse the repository at this point in the history
  • Loading branch information
jonchenn committed Oct 25, 2023
1 parent 86af1e3 commit e04f0d4
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions solutions_builder/cli/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,8 @@ def deploy(
# Destory deployment.
@app.command()
def delete(profile: str = DEFAULT_DEPLOY_PROFILE,
component: str = None,
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):
Expand All @@ -208,14 +209,21 @@ def delete(profile: str = DEFAULT_DEPLOY_PROFILE,
validate_solution_folder(solution_path)

sb_yaml = read_yaml(f"{solution_path}/sb.yaml")
project_id = sb_yaml["project_id"]
global_variables = sb_yaml.get("global_variables", {})

# Get project_id 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."

if component:
component_flag = f" -m {component} "
else:
component_flag = ""

command = f"skaffold delete -p {profile} {component_flag} --default-repo=\"gcr.io/{project_id}\""
# Set Skaffold namespace
namespace_flag = f"-n {namespace}" if namespace else ""

command = f"skaffold delete -p {profile} {component_flag} {namespace_flag} --default-repo=\"gcr.io/{project_id}\""
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)
Expand Down

0 comments on commit e04f0d4

Please sign in to comment.