2
votes

I'm using CodeBuild to build Scala sbt project. during the build I'm doing the following steps.

  • checkout code from Git.
  • Install all sbt tools.
  • Build code.
  • Create Docker
  • Publish docker file to AWS ECR
  • Update K8s deployment file located in project root folder deployment/deployment.yaml with latest vesrion of published image using kustomize utility.
  • Publish this file to AWS S3 bucket to run further deployment on AWS EKS.

Unfortunately, the last step fails and I can't move this deployment file to AWS S3 bucket.

artifacts:
  files:
    - deployment/deployment.yaml
  discard-paths: yes
  base-directory: 'deployment'

What am I doing wrong?

1

1 Answers

4
votes
base-directory: 'deployment'

... would mean that CodeBuild will look into 'deployment' directory for "deployment/deployment.yaml" which is probably wrong.

Try this:

artifacts:
  files:
    - deployment/deployment.yaml
  discard-paths: yes

One trick I have found useful is to install 'tree' in my buildspec and inspect the tree structure of directory to make sure I am specifying the correct path.

In Install Phase:

- apt-get install tree

Later in Buildspec:

- tree .