我正在使用git、codebuild和elastic beanstalk构建CI/CD流水线。
在codebuild执行过程中,如果由于测试用例的语法错误而导致构建失败,我看到codebuild进度到下一个阶段,最终会产生工件。
我的理解是,如果构建失败,执行应该停止。这是正确的行为吗?
请参见以下buildspec。
version: 0.2
phases:
install:
commands:
- echo Installing package.json..
- npm install
- echo Installing Mocha...
- npm install -g mocha
pre_build:
commands:
- echo Installing source NPM placeholder dependencies...
build:
commands:
- echo Build started on `date`
- echo Compiling the Node.js code
- mocha modules/**/tests/*.js
post_build:
commands:
- echo Build completed on `date`
artifacts:
files:
- modules/*
- node_modules/*
- package.json
- config/*
- server.js
buildspec.yml
命令在失败时返回非零退出代码。CODEBUILD_BUILD_SUCCEEDING
仅用于信息提示,手动更改它不会影响构建结果。 - Unsigned`post_build: commands: - test "$CODEBUILD_BUILD_SUCCEEDING" = "1"`
- bigfoot