updated exception handling when running commands from runner script

This commit is contained in:
brb
2023-07-06 17:30:40 +02:00
parent 2fc979a845
commit 36d2233567
+7 -1
View File
@@ -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(