Codepipeline 未找到匹配的工件

Codepipeline no matcing artifacts found

我正在尝试使用 codepipieline 部署 sam 应用程序,我收到以下错误日志

Running command sam package --template-file template.yaml --s3-bucket $BUCKET --output-template-file outputSamTemplate.yaml  
Uploading to d9f08f2a91c5f1bede6a22e7f8ecbcfc  46320 / 46320.0  (100.00%)
Successfully packaged artifacts and wrote output template to file outputSamTemplate.yaml.

[Container] 2020/04/06 09:08:46 Phase complete: BUILD State: SUCCEEDED
[Container] 2020/04/06 09:08:46 Phase context status code:  Message: 
[Container] 2020/04/06 09:08:46 Entering phase POST_BUILD
[Container] 2020/04/06 09:08:46 Running command echo Build completed on `date`
Build completed on Mon Apr 6 09:08:46 UTC 2020

[Container] 2020/04/06 09:08:46 Phase complete: POST_BUILD State: SUCCEEDED
[Container] 2020/04/06 09:08:46 Phase context status code:  Message: 
[Container] 2020/04/06 09:08:46 Expanding base directory path: .
[Container] 2020/04/06 09:08:46 Assembling file list
[Container] 2020/04/06 09:08:46 Expanding .
[Container] 2020/04/06 09:08:46 Expanding file paths for base directory .
[Container] 2020/04/06 09:08:46 Assembling file list
[Container] 2020/04/06 09:08:46 Expanding template.yml
[Container] 2020/04/06 09:08:46 Skipping invalid file path template.yml
[Container] 2020/04/06 09:08:46 Expanding outputSamTemplate.yml
[Container] 2020/04/06 09:08:46 Skipping invalid file path outputSamTemplate.yml
[Container] 2020/04/06 09:08:46 Phase complete: UPLOAD_ARTIFACTS State: FAILED
[Container] 2020/04/06 09:08:46 Phase context status code: CLIENT_ERROR Message: no matching artifact paths found

我在网上查了一下,它说我的路径文件可能无效,但我很确定它们是正确的,因此这个错误消息令人困惑...

我的构建规范:

version: 0.2

phases:
  install:
    runtime-versions:
      nodejs: 12
  pre_build:
    commands:
  build:
    commands:
      - echo Build started on `date`
      - export BUCKET=inspeq-sam
      - sam package --template-file template.yaml --s3-bucket $BUCKET --output-template-file outputSamTemplate.yaml
  post_build:
    commands:
      - ls
      - pwd
      - echo Build completed on `date`
artifacts:
  type: zip
  files:
    - template.yml
    - outputSamTemplate.yml

我在构建后添加了命令来列出文件夹的内容。这些文件列在那里。

[Container] 2020/04/06 10:38:55 Phase complete: BUILD State: SUCCEEDED
[Container] 2020/04/06 10:38:55 Phase context status code:  Message: 
[Container] 2020/04/06 10:38:55 Entering phase POST_BUILD
[Container] 2020/04/06 10:38:55 Running command pwd
/codebuild/output/src927271356/src

[Container] 2020/04/06 10:38:55 Running command ls
README.md
buildspec.yml
hello-world
outputSamTemplate.yaml
template.yaml
test.iml

[Container] 2020/04/06 10:38:55 Running command echo Build completed on `date`
Build completed on Mon Apr 6 10:38:55 UTC 2020

[Container] 2020/04/06 10:38:55 Phase complete: POST_BUILD State: SUCCEEDED

而不是 'yml',您需要 'yaml':

artifacts:
  type: zip
  files:
    - template.yaml
    - outputSamTemplate.yaml