【问题标题】:AWS CodeBuild: How to force buildspec.yml quit on errorAWS CodeBuild:如何强制 buildspec.yml 在错误时退出
【发布时间】: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'

【问题讨论】:

标签: amazon-web-services aws-codebuild


【解决方案1】:

将此添加到构建或您想要的任何部分

build:
on-failure: ABORT

this 也可能有助于显示交易状态

【讨论】:

    猜你喜欢
    • 2019-02-27
    • 1970-01-01
    • 2019-01-05
    • 2021-04-27
    • 1970-01-01
    • 1970-01-01
    • 2021-12-19
    • 2020-01-15
    • 2023-02-07
    相关资源
    最近更新 更多