CodePipeline:CodeDeploy报告"BundleType必须为YAML或JSON"; [英] CodePipeline: CodeDeploy reports "BundleType must be either YAML or JSON"

查看:93
本文介绍了CodePipeline:CodeDeploy报告"BundleType必须为YAML或JSON";的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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.

我想念什么?

谢谢

Olya

解决方案

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

经过一番挖掘,我发现通过代码管道链接两个服务(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'

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

此致

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

解决方案

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,

这篇关于CodePipeline:CodeDeploy报告"BundleType必须为YAML或JSON";的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆