rldw
rldw

Reputation: 145

Artifact from CodeBuild cannot be deployed with CodeDeploy

With CodeBuild I compile my SpringBoot application and put the resulting jar in a folder called deploy/. In my buildspec.yml at the end I provide:

artifacts:
   files:
    - deploy/*

When I plug this in to CodePipeline, this creates a zip file in S3. But the problem is, that this zip file contains the root folder, i.e. deploy. So the structure of the zip file is:

deploy.zip
  - deploy/
     - appspec.yml
     - app.jar
     - ...

This leads to the problem that CodeDeploy cannot find the appspec.yml, becuase it's not looking inside the deploy folder. I've been trying to overcome this providing a zip file as artifact at the end of the build process, but then in the pipeline it just gets zipped again..

Any idea how to solve this would be much appreciated.

Upvotes: 2

Views: 3506

Answers (2)

Bri
Bri

Reputation: 251

There is a new flag you can add in the artifacts section called base-directory to specify a base path for your artifacts package. This will allow you to truncate the deploy/ path out of your artifacts without losing the rest of the structure underneath.

artifacts:
  files:
    - **/*
  base-directory: deploy

http://docs.aws.amazon.com/codebuild/latest/userguide/build-spec-ref.html

Upvotes: 2

ricka
ricka

Reputation: 1147

You can add discard-paths: yes

artifacts:
  files:
    - deploy/*
  discard-paths: yes

Keep in mind that it discards ALL paths, including sub-directories

Source: http://docs.aws.amazon.com/codebuild/latest/userguide/build-spec-ref.html

Upvotes: 0

Related Questions