CodePipeline:CodeDeploy报告“ BundleType必须为YAML或JSON”

时间:2018-11-03 22:31:50

标签: amazon-web-services aws-lambda aws-code-deploy aws-codepipeline

CodeDeploy reports "BundleType must be either YAML or JSON"

appspec.yml is in the root dir of CodeCommit

buildspec.yml:

version: 0.2

phases:
  build:
    commands:
      - echo Build started on `date`
      - echo Compiling the Python code...
      - python HelloWorld_tst.py
  post_build:
    commands:
      - echo Build completed on `date`
artifacts:
  files:
    - HelloWorld.py
    - appspec.yml
  discard-paths: yes

appspec.yml

version: 0.0
Resources:
    - autovisionfunction:
        Type: AWS::Lambda::Function
        Properties:
            Name: "autovisionfunction"
            Alias: "staging"
            CurrentVersion: "1"
            TargetVersion: "2"
            

在CodePipeline中似乎无法找到appspec.yml

我从S3存储桶中下载了artefact zip,里面有appspec.yml。

enter image description here

我想念什么?

谢谢

Olya

1 个答案:

答案 0 :(得分:4)

我目前一直在努力解决同一问题。

经过一番挖掘,我发现通过代码管道链接两个服务(codebuild和codedeploy)似乎是一个局限性

当前codebuild仅支持ZIP / TAR / TGZ作为codedeploy不支持的捆绑类型(输出)

具有AWS响应的相似线程 https://forums.aws.amazon.com/thread.jspa?messageID=864336

一种解决方法是通过codebuild :: project buildspec触发代码部署。下面的例子

export REVISION="revisionType=S3,s3Location{bucket=$BUCKET_DEPLOYMENTS,key=$CODEBUILD_BUILD_ID/appspec.yml,bundleType=YAML}"

aws deploy create-deployment \
    --application-name=$APPLICATION_NAME \
    --deployment-group-name=$DEPLOYMENT_GROUP_NAME \ 
    --revision=$REVISION \
    --deployment-config-name='CodeDeployDefault.LambdaCanary10Percent30Minutes'

希望这给您一些有关如何解决限制的想法

此致