Clearer var names
All checks were successful
Lint Checks / Run linter (pull_request) Successful in 33s
Deploy Test / Run deploy test suite (pull_request) Successful in 4m18s
Webapp Test / Run webapp test suite (pull_request) Successful in 3m19s
Smoke Test / Run basic test suite (pull_request) Successful in 3m12s
K8s Deploy Test / Run deploy test suite on kind/k8s (pull_request) Successful in 9m49s

This commit is contained in:
Thomas E Lackey 2024-02-21 13:51:08 -06:00
parent 08ec8d1eaa
commit 8465fa153f

View File

@ -33,6 +33,7 @@ from stack_orchestrator.deploy.webapp.util import (LaconicRegistryClient,
def process_app_deployment_request( def process_app_deployment_request(
run_id,
ctx, ctx,
laconic: LaconicRegistryClient, laconic: LaconicRegistryClient,
app_deployment_request, app_deployment_request,
@ -281,17 +282,18 @@ def command(ctx, kube_config, laconic_config, image_registry, deployment_parent_
for r in requests_to_execute: for r in requests_to_execute:
dump_known_requests(state_file, [r], "DEPLOYING") dump_known_requests(state_file, [r], "DEPLOYING")
status = "ERROR" status = "ERROR"
log_file = None run_log_file = None
try: try:
run_id = f"{r.id}-{str(time.time()).split('.')[0]}-{str(uuid.uuid4()).split('-')[0]}" run_id = f"{r.id}-{str(time.time()).split('.')[0]}-{str(uuid.uuid4()).split('-')[0]}"
if log_dir: if log_dir:
log_dir = os.path.join(log_dir, r.id) run_log_dir = os.path.join(log_dir, r.id)
if not os.path.exists(log_dir): if not os.path.exists(run_log_dir):
os.mkdir(log_dir) os.mkdir(run_log_dir)
log_file_path = os.path.join(log_dir, f"{run_id}.log") run_log_file_path = os.path.join(run_log_dir, f"{run_id}.log")
print(f"Directing deployment logs to: {log_file_path}") print(f"Directing deployment logs to: {run_log_file_path}")
log_file = open(log_file_path, "wt") run_log_file = open(run_log_file_path, "wt")
process_app_deployment_request( process_app_deployment_request(
run_id,
ctx, ctx,
laconic, laconic,
r, r,
@ -301,12 +303,12 @@ def command(ctx, kube_config, laconic_config, image_registry, deployment_parent_
os.path.abspath(deployment_parent_dir), os.path.abspath(deployment_parent_dir),
kube_config, kube_config,
image_registry, image_registry,
log_file run_log_file
) )
status = "DEPLOYED" status = "DEPLOYED"
except Exception as e: except Exception as e:
print("ERROR: " + str(e), file=log_file) print("ERROR: " + str(e), file=run_log_file)
finally: finally:
dump_known_requests(state_file, [r], status) dump_known_requests(state_file, [r], status)
if log_file: if run_log_file:
log_file.close() run_log_file.close()