CodePipeline: CodeDeploy reports “BundleType must be either YAML or JSON”

此生再无相见时 提交于 2020-01-12 09:31:24

问题


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"
            

Seems while in CodePipeline can't find appspec.yml

I have downloaded artefact zip from S3 bucket, it has appspec.yml inside.

What do I miss?

Thank you

Olya


回答1:


I've currently been struggling with the same issue.

After some digging, I've found that it looks to be a limitation of linking the two services (codebuild and codedeploy) via codepipelines

Currently codebuild only supports ZIP/TAR/TGZ as the bundletypes (outputs) which codedeploy doesnt support

similar thread with an AWS response https://forums.aws.amazon.com/thread.jspa?messageID=864336

A work around is to trigger the codedeploy via the codebuild::project buildspec. Example below

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'

Hopefully this gives you some ideas on how to work out the limitation

Regards,



来源:https://stackoverflow.com/questions/53136089/codepipeline-codedeploy-reports-bundletype-must-be-either-yaml-or-json

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!