CodePipeline: CodeDeploy reports "BundleType must be either YAML or JSON"

Viewed 2980

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"
            

Seems while in CodePipeline can't find appspec.yml

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

enter image description here

What do I miss?

Thank you

Olya

1 Answers

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,

Related