【发布时间】:2019-10-29 00:15:54
【问题描述】:
我有一个由 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'
【问题讨论】:
-
好的,我发现这是一种标准行为,请参阅this post
标签: amazon-web-services aws-codebuild