Skip to content

Commit

Permalink
Adjust to latest Radix API (#666)
Browse files Browse the repository at this point in the history
  • Loading branch information
anders-kiaer authored Feb 10, 2023
1 parent 7ba080e commit 9f0d998
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 24 deletions.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def get_long_description() -> str:

TESTS_REQUIRES = [
"bandit",
"black>=22.12",
"black>=22.12,<23",
"dash[testing]",
"jsonschema",
"mypy",
Expand Down
5 changes: 2 additions & 3 deletions webviz_config/_deployment/radix.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,15 +156,14 @@ def radix_initial_deployment(github_slug: str, build_directory: pathlib.Path) ->

progress_bar.write(
f"✓ Creating Radix application '{radix_config['application_name']}' "
f"in {radix_config['context']}."
f"in {radix_config['context']}. Remember to manually add correct "
"ServiceNow configuration item."
)
webhook_secret = secrets.token_urlsafe()
public_key = radix_cli.create_application(
application_name=radix_config["application_name"],
owner_email=radix_config["owner_email"],
repository_url=repository_url,
shared_secret=webhook_secret,
wbs=radix_config["wbs"],
context=radix_config["context"],
)
progress_bar.update()
Expand Down
8 changes: 2 additions & 6 deletions webviz_config/_deployment/radix_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,8 @@ def application_exists(application_name: str, context: str) -> bool:

def create_application(
application_name: str,
owner_email: str,
repository_url: str,
shared_secret: str,
wbs: str,
context: str,
) -> str:
result = subprocess.run(
Expand All @@ -81,16 +79,14 @@ def create_application(
"application",
"--application",
application_name,
"--owner",
owner_email,
"--config-branch",
"main",
"--configuration-item",
"insert-value-here",
"--repository",
repository_url,
"--shared-secret",
shared_secret,
"--wbs",
wbs,
"--context",
context,
],
Expand Down
14 changes: 0 additions & 14 deletions webviz_config/_deployment/radix_configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,23 +23,9 @@ def radix_configuration() -> Dict[str, str]:
reuse_allowed=False,
)

interactive_terminal.terminal_title("Radix owner e-mail")
radix_owner_email = interactive_terminal.user_input_from_stdin(
"WEBVIZ_RADIX_EMAIL", "e-mail", regex=r"[^@]+@[^@]+\.[^@]+"
)

interactive_terminal.terminal_title(
"WBS to use for Radix application cost allocation"
)
radix_wbs = interactive_terminal.user_input_from_stdin(
"WEBVIZ_RADIX_WBS", "WBS", regex=r"[a-zA-Z0-9]+\.+[a-zA-Z0-9.]*[a-zA-Z0-9]"
)

return {
"context": radix_context,
"application_name": radix_application_name,
"owner_email": radix_owner_email,
"wbs": radix_wbs,
"app_url": f"https://{radix_application_name}.app.{radix_subdomain}",
"webhook_receiver_url": f"https://webhook.{radix_subdomain}/events/github",
}

0 comments on commit 9f0d998

Please sign in to comment.