Google Cloud Build - build.yaml & app.yaml in a sub directory not building correct source

Viewed 1126

I'm having trouble setting up my yaml files for google app engine. The configuration works correctly when my app.yaml file is in the root of the project but if it is within a subdirectory it does not build the correct source. I suspect I need to set the dir: option in the build config, but I have tried multiple variations and I can't get it to work.

Working file structure, deployed app is ~3mb in size.

src
deployment
└── staging
    └── build.yaml
app.staging.yaml


# build.yaml
steps:
- name: node:12
  entrypoint: yarn
- name: node:12
  entrypoint: yarn
  args: ['build']
- name: "gcr.io/cloud-builders/gcloud"
  args: ["app", "deploy", "app.staging.yaml"]
timeout: "1800s"

Not working file structure, deployed app is ~1kb in size.

src
deployment
└── staging
    └── build.yaml
    └── app.yaml


# build.yaml
steps:
- name: node:12
  entrypoint: yarn
- name: node:12
  entrypoint: yarn
  args: ['build']
- name: "gcr.io/cloud-builders/gcloud"
  args: ["app", "deploy", "deployment/staging/app.yaml"]
timeout: "1800s"

In both scenarios I am kicking off the deployment with: gcloud builds submit --config deployment/staging/build.yaml

What should my dir: be set to in the build.yaml steps so that the build step knows to build from root? Is there any way to debug this locally without having to upload the source every time?

Thanks! A

2 Answers

you cannot have the app.yaml and the cloudbuild.yaml in the same directory if you are deploying in a non-custom runtime. Please see this comment

I believe by default cloud build expects the app.yaml file to be in the uppermost directory. I'm not sure if it's possible to change this in the cloud build settings.

Related