From 36d2233567a13c19d1f7019e50e21a9eb19c2587 Mon Sep 17 00:00:00 2001 From: brb Date: Thu, 6 Jul 2023 17:30:40 +0200 Subject: [PATCH] updated exception handling when running commands from runner script --- code/app.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/code/app.py b/code/app.py index e277b54..f319d49 100644 --- a/code/app.py +++ b/code/app.py @@ -79,7 +79,13 @@ def handle_event(request: GiteaRequest): requirements_path = local_repo_dir / pipeline.requirements os.system(f'pip install -r {requirements_path}') for cmd in pipeline.script: - print(cmd) + try: + os.system(cmd) + except Exception as e: + raise HTTPException( + status_code=503, + detail=f'failed running {cmd}: {e}' + ) # send response raise HTTPException(