Skip to content

Commit dcd54a7

Browse files
committed
fix: handel error to codebuild
1 parent 0516d1e commit dcd54a7

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/emd/cfn/ecs/post_build.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import json
44
import os
55
import argparse
6+
import sys
67
from emd.models.utils.serialize_utils import load_extra_params
78

89
# Post build script for ECS, it will deploy the VPC and ECS cluster.
@@ -26,10 +27,10 @@ def wait_for_stack_completion(client, stack_name):
2627
print(f"Stack {stack_name} deployment complete")
2728
break
2829
else:
29-
raise Exception(
30+
print(
3031
f"Post build stage failed. The stack {stack_name} is in an unexpected status: {stack_status}. Please visit the AWS CloudFormation Console to delete the stack."
3132
)
32-
33+
sys.exit(1)
3334

3435
def get_stack_outputs(client, stack_name):
3536
response = client.describe_stacks(StackName=stack_name)
@@ -78,9 +79,10 @@ def create_or_update_stack(client, stack_name, template_path, parameters=[]):
7879
print(f"Started deployment of stack {stack_name} with ID {stack_id}")
7980
wait_for_stack_completion(client, stack_name)
8081
else:
81-
raise Exception(
82+
print(
8283
f"Post build stage failed. The stack {stack_name} is in an unexpected status: {stack_status}. Please visit the AWS CloudFormation Console to delete the stack."
8384
)
85+
sys.exit(1)
8486

8587

8688
def update_parameters_file(parameters_path, updates):

0 commit comments

Comments
 (0)