Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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

like image 504
Olya Basalay Avatar asked Nov 03 '18 22:11

Olya Basalay


People also ask

What is the difference between CodeDeploy and CodePipeline?

CodePipeline builds, tests, and deploys your code every time there is a code change, based on the release process models you define. AWS CodeDeploy belongs to "Deployment as a Service" category of the tech stack, while AWS CodePipeline can be primarily classified under "Continuous Deployment".

What is the difference between CodeDeploy and CodeBuild?

CodeBuild - A scalable service to compile, test, and package source code. CodeDeploy - A service to automate code deployments anywhere.

Does CodePipeline use CodeDeploy?

You use an AWS CodeDeploy action to deploy application code to your deployment fleet. Your deployment fleet can consist of Amazon EC2 instances, on-premises instances, or both. This reference topic describes the CodeDeploy deployment action for CodePipeline where the deployment platform is Amazon EC2.


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,

like image 88
sam_gordon Avatar answered Oct 23 '22 07:10

sam_gordon