diff --git a/runtime-manager-action/script.py b/runtime-manager-action/script.py index dd8df93..0f30ee8 100644 --- a/runtime-manager-action/script.py +++ b/runtime-manager-action/script.py @@ -136,13 +136,19 @@ def runtime_manager_run_self_hosted_deploy(request_data: dict, manifest: dict): url=url, body=request_data, headers=HEADERS, timeout=TIMEOUT ) - if response.ok: - # Parse the response and extract relevant data - response_data = response.json() - print(f"> Deploy successfully started:\n{json.dumps(response_data, indent=4)}") - - # Save the response to the output log - save_output(response_data) + if response.status_code == 201: + try: + # Parse the response and extract relevant data + response_data = response.json() + print( + f"> Deploy successfully started:\n{json.dumps(response_data, indent=4)}" + ) + + # Save the response to the output log + save_output(response_data) + except json.JSONDecodeError: + print("> Error: Failed to parse JSON response.") + exit(1) else: print( f"> Error: Failed to start self-hosted deploy run. Status: {response.status_code}" diff --git a/script.py b/script.py index be55ccc..18f9306 100644 --- a/script.py +++ b/script.py @@ -53,6 +53,7 @@ def run_tasks(file_tasks: str, run_action: RunAction): IAC_SELF_HOSTED=lambda **i: run_action("runtime-iac-action", **i), DEPLOY_SELF_HOSTED=lambda **i: run_action("runtime-deploy-action", **i), DESTROY_SELF_HOSTED=lambda **i: run_action("runtime-destroy-action", **i), + PLAN=lambda **i: run_action("runtime-unified-action", **i), UNIFIED_IAC=lambda **i: run_action("runtime-unified-action", **i), UNIFIED_DEPLOY=lambda **i: run_action("runtime-unified-action", **i), UNIFIED_DESTROY=lambda **i: run_action("runtime-unified-action", **i), @@ -63,6 +64,8 @@ def run_tasks(file_tasks: str, run_action: RunAction): runner = task_runners.get(task_type) if "UNIFIED" in task_type: runner and runner(run_id=data.get("runId")) + elif "PLAN" == task_type: + runner and runner(run_id=data.get("runId")) else: runner and runner(run_task_id=t["runTaskId"])