Google cloud – cloubduild and app variabile substitution in trigger

When you perform this step

# DEPLOY APP
- name: "gcr.io/cloud-builders/gcloud"
  args: ["app", "deploy", "-v", "${_VERSION}", "app.yaml"]
  dir: 'frontend'
  timeout: "20m"

The app.yaml is provided as-is to the gcloud command, and it’s not evaluated. You have to update it manually. Something like this

# REPLACE: PUT THE CORRECT VALUE IN APP.YAML FILE
- name: 'gcr.io/cloud-builders/gcloud'
  entrypoint: 'bash'
  args: ['-c', 'sed', "-i", "sed -i "s/\$${_VERSION}/${_VERSION}/g", 'app.yaml']

Of course if you let the

env_variables:
  VERSION: "${_VERSION}"

as-is in your app.yaml file. You can change this replacement string

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top