Skip to content

How to fail a codedeploy hook script that throws stderr in Linux?

0

When a deployment event script throws a stderr in the logs, deployment status still shows successful. How can I fail that event if there is presence of stderr?

asked 2 years ago140 views

1 Answer
6
Accepted Answer

Hello,

You can detect this stderr in your script and exit with 1, so CodeDeploy will fail.

Hope this helps! :)

EXPERT

answered 2 years ago

EXPERT

reviewed 2 years ago

  • Do you have an example?

  • Well, I don't have enough information to give you an example. But if you're using bash scripts, you could redirect the stderr to a file and then parse this file to check for errors, and if there are any, use exit 1

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.