Let me give an example; I have a project in which I have configured (under Project Settings - Build Settings) an Environment Variable called
MY_ENV with a value of ‘Foo’. In my circle.yml file I then have:
ENV1: "$(if [ <SOME_CONDITION> ]; then echo Bar; else echo $MY_ENV; fi)"
I’ve found that if
<SOME_CONDITION> evaluates to
ENV1 has a blank value (rather than the intended value of ‘Foo’).
Looking at the build output, under the ‘MACHINE’ section I see ‘Exporting env vars from circle.yml’. After that I see ‘Exporting env vars from project settings’. To me, this suggests that any environment variables defined in Project Settings - Build Setting will not be available to the machine - environment section of the circle.yml.
Unless there’s a way to do some sort of lazy evaluation…