I have an AWS with two instances. I have configured CodeDeploy to deploy my project automatically on all instances.
In the appspec.yml
I have that section:
hooks:
AfterInstall:
- location: codedeploy_scripts/deploy_afterinstall
timeout: 300
runas: root
deploy_afterinstall
is a simple bash script. Sometimes some of commands in it fail. For example this command which updates/installs composer dependencies.
if [ -f "composer.lock" ]; then
composer update -n
else
composer install -n
fi
But CodeDeploy ignores any errors in this script and always says that deployment went successfully. How can I change this behaviour? I want deployment to fail when some of the commands in the hook haven't been finished successfully and to see the errors in the deployment console or log.