The environment variables defined on the cloudbuild.yaml file will be 
available within the instances running your Cloud Build steps. For the 
variables to persist on your App Engine application and be used at runtime 
they'd need to be defined on the app.yaml file. So, as explained on this 
stackoverflow posts [1], [2] you'd need to compile the app.yaml at runtime 
within a Cloud Build step. Additionally, you could always use other 
alternatives to hide your secrets, such as Secret Manager [3] if your 
environment variables contain sensible information you don't feel 
comfortable to be exposed within a file in source control.

[1] 
https://stackoverflow.com/questions/52840187/how-to-set-environment-variables-using-google-cloud-build-or-other-method-in-goo
[2] 
https://stackoverflow.com/questions/31122337/does-google-app-engine-support-environment-variables
[3] https://cloud.google.com/secret-manager/docs/accessing-the-api

On Friday, January 8, 2021 at 3:14:52 PM UTC+1 Bill wrote:

> The documentation says use options to define a list of global env 
> variables to be used within all build steps.
>
> Are these env variables going to persist when Laravel app (PHP) runs and 
> reads the system environment variables? That's the tricky part.
>
> On Fri, Jan 8, 2021 at 12:26 PM 'jstsetinin' via Google App Engine <
> [email protected]> wrote:
>
>> Hello,
>> I think it is possible but you have to use "options" field and "env" 
>> subfield. According to documentation [1] in "env" subfield you can specify 
>> "a list of global environment variable definitions that will exist for all 
>> build steps in this build. If a variable is defined in both globally and in 
>> a build step, the variable will use the build step value." 
>>
>> [1] https://cloud.google.com/cloud-build/docs/build-config#options
>>
>>
>> On Friday, 8 January 2021 at 00:43:23 UTC+1 Bill wrote:
>>
>>> Hi,
>>> The environment variables set inside the cloud_build.yaml file, are they 
>>> read by PHP? I mean, are they treated as system environment variables?
>>>
>>> I am considering using environment variables inside the cloud_build.yaml 
>>> file (via substitution) this way I can drop the use of app.yaml and not 
>>> expose my environment variables inside a file on source control.
>>>
>>> Thanks
>>> Bil 
>>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Google App Engine" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to [email protected].
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/google-appengine/4643414b-7557-450b-b8ce-c6bd1f09b421n%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/google-appengine/4643414b-7557-450b-b8ce-c6bd1f09b421n%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-appengine/0447c0e7-31f2-4b36-8285-603f66db74cbn%40googlegroups.com.

Reply via email to