Skip to content

Commit a28cabb

Browse files
author
Patrick Robinson
authored
Merge pull request #38 from envato/always-output-events
Output service events when deploy fails
2 parents a25cd93 + 38d8713 commit a28cabb

File tree

1 file changed

+15
-5
lines changed

1 file changed

+15
-5
lines changed

β€Žhooks/commandβ€Ž

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -169,12 +169,22 @@ aws ecs update-service \
169169

170170
## Now we wait till it's stable
171171
echo "--- :ecs: Waiting for services to stabilize"
172+
deploy_exitcode=0
172173
aws ecs wait services-stable \
173174
--cluster "${cluster}" \
174-
--services "${service_name}"
175+
--services "${service_name}" || deploy_exitcode=$?
175176

176-
aws ecs describe-services \
177-
--cluster "${cluster}" \
178-
--service "${service_name}"
179177

180-
echo "+++ :ecs: Service is up πŸš€"
178+
service_events=$(aws ecs describe-services \
179+
--cluster "${cluster}" \
180+
--service "${service_name}" \
181+
--query 'services[].events' --output text)
182+
183+
if [[ $deploy_exitcode -eq 0 ]]; then
184+
echo "--- :ecs: Service is up πŸš€"
185+
echo "$service_events"
186+
else
187+
echo "+++ :ecs: Service failed to deploy ❌"
188+
echo "$service_events"
189+
exit $deploy_exitcode
190+
fi

0 commit comments

Comments
Β (0)