我正在尝试在 aws 中创建一个代码构建项目。我已经成功配置了代码构建项目并且代码也在构建中,但是没有在指定的 S3 存储桶中创建测试报告,我已经在 buildspec.yml 中指定了人工制品,但仍然没有生成报告。下面是我的buildspec.yml
文件。
version: 0.1
phases:
install:
commands:
- echo Logging in to Amazon ECR...
- npm install
pre_build:
commands:
- echo nothing to do in pre-build
build:
commands:
- echo Build started on `date`
- echo Building the Server ...
- npm test
post_build:
commands:
- echo Build completed on `date`
artifacts:
files:
- buildreport.txt
discard-paths: yes
我还在 S3 Bucket 上指定了适当的权限来上传/创建文件。以下是成功构建后我得到的构建日志 -
[Container] 2017/03/09 17:02:01 Phase context status code: Message:
[Container] 2017/03/09 17:02:01 Entering phase POST_BUILD
[Container] 2017/03/09 17:02:01 Running command echo Build completed on `date`
[Container] 2017/03/09 17:02:01 Build completed on Thu Mar 9 17:02:01 UTC 2017
[Container] 2017/03/09 17:02:01 Running command echo $CODEBUILD_SRC_DIR
[Container] 2017/03/09 17:02:01 /tmp/src021393076/src
[Container] 2017/03/09 17:02:01 Phase complete: POST_BUILD Success: true
[Container] 2017/03/09 17:02:01 Phase context status code: Message:
[Container] 2017/03/09 17:02:01 Preparing to copy artifacts
[Container] 2017/03/09 17:02:01 Expanding base directory path
[Container] 2017/03/09 17:02:01 Assembling file list
[Container] 2017/03/09 17:02:01 Expanding .
[Container] 2017/03/09 17:02:01 Found .
[Container] 2017/03/09 17:02:01 Expanding artifact file paths for base directory .
[Container] 2017/03/09 17:02:01 Assembling file list
[Container] 2017/03/09 17:02:01 Expanding my-build
[Container] 2017/03/09 17:02:01 Skipping invalid artifact path my-build
[Container] 2017/03/09 17:02:01 Phase complete: UPLOAD_ARTIFACTS Success: false
[Container] 2017/03/09 17:02:01 Phase context status code: ARTIFACT_ERROR Message: No matching artifact paths found
[Container] 2017/03/09 17:02:01 Runtime error (No matching artifact paths found)
我在对齐和稍微改变后再次尝试buildspec.yml
如下 -
version: 0.1
phases:
install:
commands:
- echo Logging in to Amazon ECR...
- npm install
pre_build:
commands:
- echo nothing to do in pre-build
build:
commands:
- echo Build started on `date`
- echo Building the Server ...
- npm test
post_build:
commands:
- echo Build completed on `date`
- echo $CODEBUILD_SRC_DIR
artifacts:
files:
- my-build
但它仍然无法在 s3 文件夹中生成人工制品。