Skip to content

Commit

Permalink
Merge pull request #142 from GoogleCloudPlatform/fix-sb-vars
Browse files Browse the repository at this point in the history
updated root sb yaml in template_root; return non-zero status when error occurs.
  • Loading branch information
jonchenn authored Oct 25, 2023
2 parents c527021 + 25ef86a commit 2ebf243
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 11 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "solutions-builder"
version = "1.17.17"
version = "1.17.18"
description = "A solution framework to generate a project with built-in structure and modules"
authors = ["Jon Chen <[email protected]>"]
license = "Apache"
Expand Down
7 changes: 4 additions & 3 deletions solutions_builder/cli/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,6 @@ def deploy(
for command in commands:
exec_shell(env_var_str + command, working_dir=solution_path)


# Destory deployment.
@app.command()
def delete(profile: str = DEFAULT_DEPLOY_PROFILE,
Expand Down Expand Up @@ -244,7 +243,7 @@ def info(solution_path: Annotated[Optional[str],
print(f"{key}: {value}")
print()

print(f"Installed components:")
print("Installed components:")
for key, value in sb_yaml["components"].items():
print(f" - {key}")
print()
Expand All @@ -261,7 +260,7 @@ def version():

def main():
try:
print_highlight(f"Solutions Builder (version " +
print_highlight("Solutions Builder (version " +
typer.style(__version__, fg=typer.colors.CYAN, bold=True) +
")\n")
app()
Expand All @@ -271,7 +270,9 @@ def main():
if DEBUG:
traceback.print_exc()
print_error(e)
return -1

return 0

if __name__ == "__main__":
main()
4 changes: 2 additions & 2 deletions solutions_builder/cli/cli_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,8 @@ def exec_shell(command, working_dir=".", stop_when_error=True, stdout=None):
exit_status = proc.wait()

if exit_status != 0 and stop_when_error:
raise Exception(
f"Error when running command: {command} (working_dir={working_dir})")
raise RuntimeError(
f"Error occurs when running command: {command} (working_dir={working_dir})")

return exit_status

Expand Down
2 changes: 1 addition & 1 deletion solutions_builder/cli/set.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def project_id(
skip=yes)

# Update Root sb.yaml
new_project_number = int(get_project_number(new_project_id))
new_project_number = get_project_number(new_project_id)
assert new_project_number, "Unable to receive project number for project '{new_project_id}'"

global_variables["project_id"] = new_project_id
Expand Down
8 changes: 4 additions & 4 deletions solutions_builder/template_root/sb.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ _metadata:
components: {}
created_at: "{% now 'utc', '%Y-%b-%d %H:%M:%S UTC' %}"
modified_at: "{% now 'utc', '%Y-%b-%d %H:%M:%S UTC' %}"
project_number: {{project_number}}
project_id: {{project_id}} # sb-var:project_id
project_name: {{project_name}} # sb-var:project_name
global_variables: {}
global_variables:
project_number: {{project_number}} # sb-var:project_number
project_id: {{project_id}} # sb-var:project_id
project_name: {{project_name}} # sb-var:project_name

0 comments on commit 2ebf243

Please sign in to comment.