DEV Community

Discussion on: Google Cloud App Engine Environment Variables

Collapse
 
erivi profile image
Erika Violet • Edited

Just adding to the Cloud Build part; substitutions don't have to be passed as command line args. You can also define them within a Cloud Build Trigger within your project.
The Trigger can then be set to run automatically on repo changes, or manually using 'gcloud beta builds triggers run TRIGGER'.

There's still a problem here of course, that the substitutions are read into your cloudbuild.yaml file and not your app.yaml file... but in similar way as you used templates here, this can be achieved in Cloud Build using the envsubst community-builder like so:

cloudbuild.yaml
steps:
- name: 'gcr.io/$PROJECT_ID/envsubst'
args: ['app.yaml']
env: ['_ENVIRONMENT=${_ENVIRONMENT}']
[...]

app.yaml
[...]
env_variables:
ENVIRONMENT: ${_ENVIRONMENT}

Collapse
 
ajoshi31 profile image
Atul Joshi

In the cloud build I don't see an option to connect with gitlab, its only for github or bitbucket