What is the recommended way to set an environment variable for a firebase function that originates from the google kms?
In my cloudbuild.yaml I have following step:
# Set env
- name: 'gcr.io/$_PROJECT_ID/firebase'
args: ['functions:config:set', 'env.environment=$_ENV', 'env.build=$BUILD_ID','api_key=$API_KEY', '--project', '$_PROJECT_ID']
dir: 'functions'
secretEnv: ['API_KEY','FIREBASE_TOKEN']
For the custom google cloud builder I followed the instructions from Follow instructions from https://github.com/GoogleCloudPlatform/cloud-builders-community/
The cloudbuild.yaml is either being invalidated or the substitution does not work.
Edit:
Error message
ERROR: (gcloud.builds.submit) INVALID_ARGUMENT: invalid build: key in the template "API_KEY" is not a valid built-in substitution
If I retrieve the firebase environment through firebase functions:config:get I see $API_KEY or $$API_KEY or API_KEY depending on the substitution strategy chosen.
If I add the unencrypted API_KEY to the environment variables in the Google Cloud Build Trigger, the substitution works as expected.