我有一个由AWS CodeBuild使用的buildspec.yml,带有build和post_build任务。当我发现即使任何构建命令失败后,都执行post_build任务时,我感到有些惊讶。
如果任何构建命令失败,如何强制退出执行?
谢谢!
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'