I have a buildspec.yml consumed by AWS CodeBuild with build and post_build tasks. I was a bit surprised when I found out that post_build tasks are executed even if any of build commands fail.
How is possible to force quit of execution if any of build commands fail?
Thanks!
version: 0.2
env:
variables:
S3_BUCKET: "..."
BUILD_ENV : "prod"
phases:
install:
commands:
- echo Installing source NPM dependencies...
- npm install
- npm install -g @angular/cli
build:
commands:
- echo Build started on `date`
- ng build --prod --aot --source-map=false
post_build:
commands:
- echo Running post_build commands on `date`
- aws s3 sync dist s3://${S3_BUCKET} --recursive
- aws cloudfront create-invalidation --distribution-id XXXXXXXXXXXXXX --paths '/index.html'